mirror of
https://github.com/onyx-and-iris/vmrcli.git
synced 2024-11-15 17:40:56 +00:00
default log level to LOG_WARN
write message to stderr if -D flag out of range
This commit is contained in:
parent
4488a386b8
commit
0b6e0800ce
16
src/vmrcli.c
16
src/vmrcli.c
@ -42,10 +42,10 @@ int main(int argc, char *argv[])
|
|||||||
if (argc == 1)
|
if (argc == 1)
|
||||||
{
|
{
|
||||||
help();
|
help();
|
||||||
return EXIT_SUCCESS;
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
log_set_level(LOG_INFO);
|
log_set_level(LOG_WARN);
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "k:ihD:")) != -1)
|
while ((opt = getopt(argc, argv, "k:ihD:")) != -1)
|
||||||
{
|
{
|
||||||
@ -62,10 +62,18 @@ int main(int argc, char *argv[])
|
|||||||
help();
|
help();
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
case 'D':
|
case 'D':
|
||||||
if ((dvalue = atoi(optarg)) && dvalue >= LOG_TRACE && dvalue <= LOG_FATAL)
|
dvalue = atoi(optarg);
|
||||||
|
if (dvalue >= LOG_TRACE && dvalue <= LOG_FATAL)
|
||||||
{
|
{
|
||||||
log_set_level(dvalue);
|
log_set_level(dvalue);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fputs(
|
||||||
|
"-D arg out of range, expected value from 0 up to 5\n"
|
||||||
|
"Log level will default to LOG_WARN (3).\n",
|
||||||
|
stderr);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
abort();
|
abort();
|
||||||
@ -224,7 +232,7 @@ void parse_command(T_VBVMR_INTERFACE *vmr, char *command)
|
|||||||
puts(res.val.s);
|
puts(res.val.s);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fputs("Unknown result...", stderr);
|
fputs("Unexpected result type", stderr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user