diff options
Diffstat (limited to 'tethereal.c')
-rw-r--r-- | tethereal.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/tethereal.c b/tethereal.c index 07a0c89ec9..4d3835fca9 100644 --- a/tethereal.c +++ b/tethereal.c @@ -1,6 +1,6 @@ /* tethereal.c * - * $Id: tethereal.c,v 1.187 2003/06/13 03:44:36 guy Exp $ + * $Id: tethereal.c,v 1.188 2003/06/22 16:06:03 deniel Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -255,7 +255,7 @@ print_usage(gboolean print_ver) #ifdef HAVE_LIBPCAP static int -get_positive_int(const char *string, const char *name) +get_natural_int(const char *string, const char *name) { long number; char *p; @@ -271,11 +271,6 @@ get_positive_int(const char *string, const char *name) 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 is too large (greater than %d)\n", name, INT_MAX); @@ -284,6 +279,22 @@ get_positive_int(const char *string, const char *name) return number; } +static int +get_positive_int(const char *string, const char *name) +{ + long number; + + number = get_natural_int(string, name); + + if (number == 0) { + fprintf(stderr, "tethereal: The specified %s is zero\n", + name); + exit(1); + } + + return number; +} + /* * Given a string of the form "<autostop criterion>:<value>", as might appear * as an argument to a "-a" option, parse it and set the criterion in @@ -350,7 +361,7 @@ get_ring_arguments(const char *arg) } capture_opts.ringbuffer_num_files = - get_positive_int(arg, "number of ring buffer files"); + get_natural_int(arg, "number of ring buffer files"); if (colonp == NULL) return TRUE; |