diff options
author | Guy Harris <guy@alum.mit.edu> | 2002-02-24 06:01:03 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2002-02-24 06:01:03 +0000 |
commit | b767826991ba30b900ae917a290927871bc62976 (patch) | |
tree | 02e8f9b9e89c525112f7f61cce532b6e6a4bee90 /tethereal.c | |
parent | 8bd63530ed159d50e5375f1268b047d5e519c73b (diff) | |
download | wireshark-b767826991ba30b900ae917a290927871bc62976.tar.gz wireshark-b767826991ba30b900ae917a290927871bc62976.tar.bz2 wireshark-b767826991ba30b900ae917a290927871bc62976.zip |
Have "get_positive_int()" really check for positive integers, not just
non-negative integers.
Get rid of unused "get_positive_int()" routine in "gtk/capture_dlg.c".
svn path=/trunk/; revision=4796
Diffstat (limited to 'tethereal.c')
-rw-r--r-- | tethereal.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tethereal.c b/tethereal.c index d7b2a764f8..33d7b82a7e 100644 --- a/tethereal.c +++ b/tethereal.c @@ -1,6 +1,6 @@ /* tethereal.c * - * $Id: tethereal.c,v 1.124 2002/02/24 03:33:04 guy Exp $ + * $Id: tethereal.c,v 1.125 2002/02/24 06:01:01 guy Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -200,13 +200,18 @@ get_positive_int(const char *string, const char *name) exit(1); } if (number < 0) { - fprintf(stderr, "tethereal: The specified %s \"%s\" is a negative number\n", - name, string); + fprintf(stderr, "tethereal: The specified %s is a negative number\n", + name); + exit(1); + } + if (number == 0) { + fprintf(stderr, "tethereal: The specified %s is zero\n", + name); exit(1); } if (number > INT_MAX) { - fprintf(stderr, "tethereal: The specified %s \"%s\" is too large (greater than %d)\n", - name, string, INT_MAX); + fprintf(stderr, "tethereal: The specified %s is too large (greater than %d)\n", + name, INT_MAX); exit(1); } return number; @@ -445,11 +450,6 @@ main(int argc, char *argv[]) case 'c': /* Capture xxx packets */ #ifdef HAVE_LIBPCAP packet_count = get_positive_int(optarg, "packet count"); - if (packet_count == 0) { - fprintf(stderr, "tethereal: The specified packet count \"%s\" is zero\n", - optarg); - exit(1); - } #else capture_option_specified = TRUE; arg_error = TRUE; |