forked from osmocom/wireshark
capinfos: use single exit point.
Change-Id: Ib1b556c07ec3e1f788c48038ed6bb0ae6af5cb7d Reviewed-on: https://code.wireshark.org/review/20196 Petri-Dish: Dario Lombardo <lomato@gmail.com> Reviewed-by: Michael Mann <mmann78@netscape.net>pespin/osmux-stats
parent
2de30dd18d
commit
53fb7e41b1
15
capinfos.c
15
capinfos.c
|
@ -95,6 +95,9 @@
|
|||
#include <wsutil/unicode-utils.h>
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#define INVALID_OPTION 1
|
||||
#define BAD_FLAG 1
|
||||
|
||||
/*
|
||||
* By default capinfos now continues processing
|
||||
* the next filename if and when wiretap detects
|
||||
|
@ -1388,7 +1391,7 @@ main(int argc, char *argv[])
|
|||
int err;
|
||||
gchar *err_info;
|
||||
int opt;
|
||||
int overall_error_status;
|
||||
int overall_error_status = EXIT_SUCCESS;
|
||||
static const struct option long_options[] = {
|
||||
{"help", no_argument, NULL, 'h'},
|
||||
{"version", no_argument, NULL, 'v'},
|
||||
|
@ -1619,7 +1622,7 @@ main(int argc, char *argv[])
|
|||
"See https://www.wireshark.org for more information.\n",
|
||||
get_ws_vcs_version_info());
|
||||
print_usage(stdout);
|
||||
exit(0);
|
||||
goto exit;
|
||||
break;
|
||||
|
||||
case 'v':
|
||||
|
@ -1628,19 +1631,21 @@ main(int argc, char *argv[])
|
|||
show_version("Capinfos (Wireshark)", comp_info_str, runtime_info_str);
|
||||
g_string_free(comp_info_str, TRUE);
|
||||
g_string_free(runtime_info_str, TRUE);
|
||||
exit(0);
|
||||
goto exit;
|
||||
break;
|
||||
|
||||
case '?': /* Bad flag - print usage message */
|
||||
print_usage(stderr);
|
||||
exit(1);
|
||||
overall_error_status = BAD_FLAG;
|
||||
goto exit;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ((argc - optind) < 1) {
|
||||
print_usage(stderr);
|
||||
exit(1);
|
||||
overall_error_status = INVALID_OPTION;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (!long_report && table_report_header) {
|
||||
|
|
Loading…
Reference in New Issue