X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=lttng%2Flttng.c;fp=lttng%2Flttng.c;h=45a6fa0be1f961f84dfe10c74fcd9d8a8d0ec721;hp=d0f23579d4af38db63ba9ec2e9f76aaa7155b299;hb=bcfa8a05018b339b9b5609fe975a3a7b29cc0c6e;hpb=ec8f26de70d4862d4fad73f844c19fabf30b19c8 diff --git a/lttng/lttng.c b/lttng/lttng.c index d0f23579d..45a6fa0be 100644 --- a/lttng/lttng.c +++ b/lttng/lttng.c @@ -359,6 +359,23 @@ end: return ret; } +/* + * Check for the "help" option in the argv. If found, return 1 else return 0. + */ +static int check_help_command(int argc, char **argv) +{ + int i; + + for (i = 0; i < argc; i++) { + if ((strncmp(argv[i], "-h", 2) == 0) || + strncmp(argv[i], "--h", 3)) { + return 1; + } + } + + return 0; +} + /* * parse_args * @@ -414,7 +431,8 @@ static int parse_args(int argc, char **argv) } /* Spawn session daemon if needed */ - if (opt_no_sessiond == 0 && (check_sessiond() < 0)) { + if (opt_no_sessiond == 0 && check_help_command(argc, argv) == 0 && + (check_sessiond() < 0)) { goto error; }