X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;ds=sidebyside;f=audiod_command.c;fp=audiod_command.c;h=29c330f36a526d1004cb8595248fb75008033438;hb=5967ac5353739c3ff571dd12d4c6814fa8493ad8;hp=795e2ac84657150a1a8d64947e30a7ba4a217796;hpb=b142089267ef501e438c3dc77ecf19bead3d4e58;p=paraslash.git diff --git a/audiod_command.c b/audiod_command.c index 795e2ac8..29c330f3 100644 --- a/audiod_command.c +++ b/audiod_command.c @@ -240,6 +240,42 @@ static int com_help(int fd, struct lls_parse_result *lpr) } EXPORT_AUDIOD_CMD_HANDLER(help) +static int com_ll(int fd, struct lls_parse_result *lpr) +{ + unsigned ll; + char *errctx; + const char *sev[] = {SEVERITIES}; + const char *arg; + int ret = lls(lls_check_arg_count(lpr, 0, 1, &errctx)); + + if (ret < 0) { + char *tmp = make_message("%s\n", errctx); + free(errctx); + client_write(fd, tmp); + free(tmp); + return ret; + } + if (lls_num_inputs(lpr) == 0) { + char *msg; + ll = daemon_get_loglevel(); + msg = make_message("%s\n", sev[ll]); + ret = client_write(fd, msg); + free(msg); + return ret; + } + arg = lls_input(0, lpr); + for (ll = 0; ll < NUM_LOGLEVELS; ll++) { + if (!strcmp(arg, sev[ll])) + break; + } + if (ll >= NUM_LOGLEVELS) + return -ERRNO_TO_PARA_ERROR(EINVAL); + PARA_INFO_LOG("new log level: %s\n", sev[ll]); + daemon_set_loglevel(ll); + return 1; +} +EXPORT_AUDIOD_CMD_HANDLER(ll) + static int com_tasks(int fd, __a_unused struct lls_parse_result *lpr) { int ret;