aboutsummaryrefslogtreecommitdiffstats
path: root/wsutil/clopts_common.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2018-10-31 11:34:35 +0100
committerAnders Broman <a.broman58@gmail.com>2018-11-01 05:09:10 +0000
commit8b977a43d68d8fd9c2c7e7b8ccc0711df13c64ee (patch)
tree65e161a12e70ac3dade19f0781fa26315a419d94 /wsutil/clopts_common.c
parent01784a594698d5d358c1d80319e77b68c939f7d7 (diff)
Move condition logic to dumpcap.c
Move the condition logic from capture_stop_conditions.c to dumpcap.c. Remove capture_stop_conditions.[ch] and conditions.[ch]. Switch duration values to doubles. Change-Id: Ifa74fb13ec8fc923b0721597a6cf071d72069ea0 Reviewed-on: https://code.wireshark.org/review/30440 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'wsutil/clopts_common.c')
-rw-r--r--wsutil/clopts_common.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/wsutil/clopts_common.c b/wsutil/clopts_common.c
index ab21be9980..79d139a204 100644
--- a/wsutil/clopts_common.c
+++ b/wsutil/clopts_common.c
@@ -90,6 +90,23 @@ get_nonzero_guint32(const char *string, const char *name)
return number;
}
+double
+get_positive_double(const char *string, const char *name)
+{
+ double number = g_ascii_strtod(string, NULL);
+
+ if (errno == EINVAL) {
+ cmdarg_err("The specified %s \"%s\" isn't a floating point number", name, string);
+ exit(1);
+ }
+ if (number < 0.0) {
+ cmdarg_err("The specified %s \"%s\" is a negative number", name, string);
+ exit(1);
+ }
+
+ return number;
+}
+
/*
* Editor modelines - http://www.wireshark.org/tools/modelines.html
*