36#include "cmdhandler.h"
38#include "clientpipe.h"
39#include "longgetopt.h"
45static const char *module_str =
"verbosity_cmd";
58 client_printf(sockfd,
"Set verbosity.\n\n"
63run(cmdhandler_ctx_type* context,
int argc,
char* argv[])
65 int sockfd = context->sockfd;
67 char *endptr, *errorstr;
69 ods_log_debug(
"[%s] verbosity command", module_str);
71 client_printf(sockfd,
"Current verbosity is set to %d.\n",
83 }
else if (argc == 2) {
85 val = strtol(argv[1], &endptr, 10);
86 if ((errno == ERANGE && (val == LONG_MAX || val == LONG_MIN))
87 || (errno != 0 && val == 0)) {
88 errorstr = strerror(errno);
89 client_printf(sockfd,
"Error parsing verbosity value: %s.\n", errorstr);
92 if (endptr == argv[1]) {
93 client_printf(sockfd,
"Error parsing verbosity value: No digits were found.\n");
97 client_printf(sockfd,
"Error parsing verbosity value: must be >= 0.\n");
100 ods_log_setverbosity(val);
101 client_printf(sockfd,
"Verbosity level set to %li.\n", val);
104 client_printf(sockfd,
"Too many arguments.\n");
111 "verbosity", &usage, &help, NULL, NULL, &run, NULL
struct cmd_func_block verbosity_funcblock