aboutsummaryrefslogtreecommitdiff
path: root/lib/lib.c
diff options
context:
space:
mode:
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;