Allow wslog parameters in all applications

Since wslog command line parameters are no longer removed from argv/argc, applications need to be able to ignore them if they are picky about the options for the application.
This commit is contained in:
Michael Mann 2025-04-29 14:00:41 -04:00 committed by John Thacker
parent 6384324bdc
commit e55955feab
10 changed files with 48 additions and 4 deletions

View File

@ -456,8 +456,14 @@ main(int argc, char **argv)
break;
case '?':
print_usage(EXIT_FAILURE);
break;
default:
/* wslog arguments are okay */
if (ws_log_is_wslog_arg(opt))
break;
ws_assert_not_reached();
break;
}
}

View File

@ -1907,6 +1907,10 @@ main(int argc, char *argv[])
case '?': /* Bad options - print usage */
default:
/* wslog arguments are okay */
if (ws_log_is_wslog_arg(opt))
break;
switch(ws_optopt) {
case'F':
list_capture_types(stdout);

View File

@ -307,6 +307,11 @@ main(int argc, char *argv[])
}
break;
case '?': /* Bad options if GNU getopt */
default:
/* wslog arguments are okay */
if (ws_log_is_wslog_arg(opt))
break;
switch(ws_optopt) {
case'F':
list_capture_types();

View File

@ -214,6 +214,10 @@ main(int argc, char *argv[])
/* FALLTHROUGH */
default:
/* wslog arguments are okay */
if (ws_log_is_wslog_arg(opt))
break;
usage(true);
ret = WS_EXIT_INVALID_OPTION;
goto clean_exit;

View File

@ -667,8 +667,12 @@ main(int argc, char *argv[])
goto clean_exit;
}
break;
default:
case '?': /* Bad flag - print usage message */
default:
/* wslog arguments are okay */
if (ws_log_is_wslog_arg(opt))
break;
print_usage(stderr);
ret = WS_EXIT_INVALID_OPTION;
goto clean_exit;

View File

@ -217,6 +217,11 @@ main(int argc, char *argv[])
show_version();
goto clean_exit;
case '?':
default:
/* wslog arguments are okay */
if (ws_log_is_wslog_arg(opt))
break;
print_usage(stderr);
ret = WS_EXIT_INVALID_OPTION;
goto clean_exit;

View File

@ -344,6 +344,10 @@ sharkd_init(int argc, char **argv)
break;
default:
/* wslog arguments are okay */
if (ws_log_is_wslog_arg(opt))
break;
if (!ws_optopt)
fprintf(stderr, "This option isn't supported: %s\n", argv[ws_optind]);
fprintf(stderr, "Use sharkd -h for details of supported options\n");

View File

@ -747,8 +747,12 @@ main(int argc, char *argv[])
goto clean_exit;
}
break;
default:
case '?': /* Bad flag - print usage message */
default:
/* wslog arguments are okay */
if (ws_log_is_wslog_arg(opt))
break;
print_usage(stderr);
exit_status = WS_EXIT_INVALID_OPTION;
goto clean_exit;

View File

@ -1935,8 +1935,12 @@ main(int argc, char *argv[])
goto clean_exit;
}
break;
default:
case '?': /* Bad flag - print usage message */
default:
/* wslog arguments are okay */
if (ws_log_is_wslog_arg(opt))
break;
switch(ws_optopt) {
case 'F':
list_capture_types();

View File

@ -714,8 +714,12 @@ void commandline_other_options(int argc, char *argv[], bool opt_reset)
arg_error = true;
#endif
break;
default:
case '?': /* Bad flag - print usage message */
default:
/* wslog arguments are okay */
if (ws_log_is_wslog_arg(opt))
break;
arg_error = true;
break;
}