diff options
author | Ulf Lamping <ulf.lamping@web.de> | 2006-02-10 02:05:30 +0000 |
---|---|---|
committer | Ulf Lamping <ulf.lamping@web.de> | 2006-02-10 02:05:30 +0000 |
commit | e4e8df5e1d7baea590c02edf369c65e82ffaece2 (patch) | |
tree | e906ceda128cc5fd13c23de04c9414e5864af895 /tethereal.c | |
parent | 0d9c276e901f8a3e5de9ae2502a078ffb3d90064 (diff) |
remove all calls to exit() from the capture_opts.c and replace them by status return values (0,1 or 2).
This way makes it much easier to debug, e.g. to set a common breakpoint if a command line parameter fails.
svn path=/trunk/; revision=17240
Diffstat (limited to 'tethereal.c')
-rw-r--r-- | tethereal.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/tethereal.c b/tethereal.c index 27ea607b45..10d6049c1d 100644 --- a/tethereal.c +++ b/tethereal.c @@ -683,6 +683,7 @@ main(int argc, char *argv[]) e_prefs *prefs; char badopt; GLogLevelFlags log_flags; + int status; #define OPTSTRING_INIT "a:b:c:d:Df:F:hi:lLnN:o:pqr:R:s:St:T:vVw:xX:y:z:" #ifdef HAVE_LIBPCAP @@ -885,7 +886,10 @@ main(int argc, char *argv[]) case 'B': /* Buffer size */ #endif /* _WIN32 */ #ifdef HAVE_LIBPCAP - capture_opts_add_opt(&capture_opts, opt, optarg, &start_capture); + status = capture_opts_add_opt(&capture_opts, opt, optarg, &start_capture); + if(status != 0) { + exit(status); + } #else capture_option_specified = TRUE; arg_error = TRUE; @@ -897,8 +901,8 @@ main(int argc, char *argv[]) break; case 'D': /* Print a list of capture devices and exit */ #ifdef HAVE_LIBPCAP - capture_opts_list_interfaces(); - exit(0); + status = capture_opts_list_interfaces(); + exit(status); #else capture_option_specified = TRUE; arg_error = TRUE; @@ -1386,8 +1390,8 @@ main(int argc, char *argv[]) /* if requested, list the link layer types and exit */ if (list_link_layer_types) { - capture_opts_list_link_layer_types(&capture_opts); - exit(0); + status = capture_opts_list_link_layer_types(&capture_opts); + exit(status); } if (!quiet) { |