mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-20 13:21:29 +02:00
MINOR: trace: accept trace spec right after "-dt" on the command line
I continue to mistakenly set the traces using "-dtXXX" and to have to refer to the doc to figure that it requires a separate argument and differs from some other options. Worse, "-dthelp" doesn't say anything and silently ignores the argument. Let's make the parser take whatever follows "-dt" as the argument if present, otherwise take the next one (as it currently does). Doing this even allows to simplify the code, and is easier to figure the syntax since "-dthelp" now works.
This commit is contained in:
parent
abfd6f3b93
commit
670dc299d3
@ -697,7 +697,7 @@ static void usage(char *name)
|
||||
" -vq/-vqs/-vqb only displays version, short version, branch.\n"
|
||||
" -d enters debug mode ; -db only disables background mode.\n"
|
||||
" -dM[<byte>,help,...] debug memory (default: poison with <byte>/0x50)\n"
|
||||
" -dt activate traces on stderr\n"
|
||||
" -dt activate traces on stderr; see '-dt help'\n"
|
||||
" -V enters verbose mode (disables quiet mode)\n"
|
||||
" -D goes daemon ; -C changes to <dir> before loading files.\n"
|
||||
" -W master-worker mode.\n"
|
||||
@ -1624,8 +1624,15 @@ static void init_args(int argc, char **argv)
|
||||
kwd_dump = flag + 2;
|
||||
}
|
||||
else if (*flag == 'd' && flag[1] == 't') {
|
||||
if (argc > 1 && argv[1][0] != '-') {
|
||||
int ret = trace_parse_cmd(argv[1], &err_msg);
|
||||
char *arg = flag + 2;
|
||||
int ret;
|
||||
|
||||
if (!*arg && argc > 1 && argv[1][0] != '-') {
|
||||
arg = argv[1];
|
||||
argc--; argv++;
|
||||
}
|
||||
|
||||
ret = trace_parse_cmd(arg, &err_msg);
|
||||
if (ret <= -1) {
|
||||
if (ret < -1) {
|
||||
ha_alert("-dt: %s.\n", err_msg);
|
||||
@ -1638,11 +1645,6 @@ static void init_args(int argc, char **argv)
|
||||
exit(0);
|
||||
}
|
||||
}
|
||||
argc--; argv++;
|
||||
}
|
||||
else {
|
||||
trace_parse_cmd(NULL, NULL);
|
||||
}
|
||||
}
|
||||
#ifdef HA_USE_KTLS
|
||||
else if (*flag == 'd' && flag[1] == 'T') {
|
||||
|
@ -1008,7 +1008,7 @@ int trace_parse_cmd(const char *arg_src, char **errmsg)
|
||||
char *arg, *oarg;
|
||||
char *saveptr;
|
||||
|
||||
if (!arg_src) {
|
||||
if (!arg_src || !*arg_src) {
|
||||
/* No trace specification, activate all sources on error level. */
|
||||
struct trace_source *src = NULL;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user