Add debug flag to initctl client tool

This patch makes it possible to see debug traces when running the client
program initctl, using `--debug`.  Please note, this does not affect the
debug command to the daemon.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson
2015-11-22 15:57:56 +01:00
parent 924bf041bc
commit 4ada42f380
+8 -2
View File
@@ -206,10 +206,11 @@ static int usage(int rc)
{
fprintf(stderr, "Usage: %s [OPTIONS] <COMMAND>\n\n"
"Options:\n"
" -d, --debug Debug initctl (client)\n"
" -v, --verbose Verbose output\n"
" -h, --help This help text\n\n"
"Commands:\n"
" debug Toggle Finit debug\n"
" debug Toggle Finit (daemon) debug\n"
" emit <EV> Emit an event. Can be a predefined event: RELOAD, STOP,\n"
" START, or a custom string to match the event list in a\n"
" service stanza, e.g: GW, IFUP:IFNAME, IFDN:IFNAME, where\n"
@@ -244,17 +245,22 @@ int main(int argc, char *argv[])
};
struct option long_options[] = {
{"help", 0, NULL, 'h'},
{"debug", 0, NULL, 'd'},
{"verbose", 0, NULL, 'v'},
{NULL, 0, NULL, 0}
};
verbose = 0;
while ((c = getopt_long(argc, argv, "h?v", long_options, NULL)) != EOF) {
while ((c = getopt_long(argc, argv, "dh?v", long_options, NULL)) != EOF) {
switch(c) {
case 'h':
case '?':
return usage(0);
case 'd':
debug = 1;
break;
case 'v':
verbose = 1;
break;