aboutsummaryrefslogtreecommitdiffstats
path: root/capture_opts.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2005-02-27 21:15:30 +0000
committerGuy Harris <guy@alum.mit.edu>2005-02-27 21:15:30 +0000
commit343810d95a1343a7d3f996827c938fb3109053bc (patch)
tree53cbefe97f297642f74521fd0ed7ffc4a01b91ac /capture_opts.c
parent36833b76d8b62c3eac22ef0943b9e553e3518bb9 (diff)
Move "get_natural_int()" and "get_positive_int()" from "capture_opts.c"
to "clopts_common.c", make them not static, and use them in "gtk/main.c". svn path=/trunk/; revision=13541
Diffstat (limited to 'capture_opts.c')
-rw-r--r--capture_opts.c45
1 files changed, 1 insertions, 44 deletions
diff --git a/capture_opts.c b/capture_opts.c
index cf3e87629c..f2bdc06900 100644
--- a/capture_opts.c
+++ b/capture_opts.c
@@ -43,7 +43,7 @@
#include "capture.h"
#include "ringbuffer.h"
-
+#include "clopts_common.h"
void
capture_opts_init(capture_options *capture_opts, void *cfile)
@@ -85,49 +85,6 @@ capture_opts_init(capture_options *capture_opts, void *cfile)
capture_opts->fork_child = -1; /* invalid process handle */
}
-static int
-get_natural_int(const char *appname, const char *string, const char *name)
-{
- long number;
- char *p;
-
- number = strtol(string, &p, 10);
- if (p == string || *p != '\0') {
- fprintf(stderr, "%s: The specified %s \"%s\" isn't a decimal number\n",
- appname, name, string);
- exit(1);
- }
- if (number < 0) {
- fprintf(stderr, "%s: The specified %s \"%s\" is a negative number\n",
- appname, name, string);
- exit(1);
- }
- if (number > INT_MAX) {
- fprintf(stderr, "%s: The specified %s \"%s\" is too large (greater than %d)\n",
- appname, name, string, INT_MAX);
- exit(1);
- }
- return number;
-}
-
-
-static int
-get_positive_int(const char *appname, const char *string, const char *name)
-{
- long number;
-
- number = get_natural_int(appname, string, name);
-
- if (number == 0) {
- fprintf(stderr, "%s: The specified %s is zero\n",
- appname, 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