aboutsummaryrefslogtreecommitdiff
path: root/lib/lib.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2013-11-28 21:11:34 -0600
committerRob Landley <rob@landley.net>2013-11-28 21:11:34 -0600
commitb5e74165d1462d69deaecbf14305dbf2eee746d5 (patch)
tree039b23d58a1316bd69fcb68b4743800451c34fb9 /lib/lib.c
parent5ec4ab3113dcc813b6040d7ded38e297df99dc0e (diff)
downloadtoybox-b5e74165d1462d69deaecbf14305dbf2eee746d5.tar.gz
Oops, cleaned up ifconfig uses atolx_range() instead of get_int_list(). Check that in.
Diffstat (limited to 'lib/lib.c')
-rw-r--r--lib/lib.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/lib.c b/lib/lib.c
index de8c7be0..14de91df 100644
--- a/lib/lib.c
+++ b/lib/lib.c
@@ -203,6 +203,16 @@ long atolx(char *numstr)
return val;
}
+long atolx_range(char *numstr, long low, long high)
+{
+ long val = atolx(numstr);
+
+ if (val < low) error_exit("%ld < %ld", val, low);
+ if (val > high) error_exit("%ld > %ld", val, high);
+
+ return val;
+}
+
int numlen(long l)
{
int len = 0;