aboutsummaryrefslogtreecommitdiff
path: root/lib/pending.c
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2013-09-10 01:01:35 -0500
committerRob Landley <rob@landley.net>2013-09-10 01:01:35 -0500
commite3e80849a6980f675289195225542c35154f756f (patch)
tree9c6ecc71e8fa9dc1cc4409f072b8a6765b97f58e /lib/pending.c
parentdc44b6bb4ce30a8e515d49c2285b87e3e40dc408 (diff)
downloadtoybox-e3e80849a6980f675289195225542c35154f756f.tar.gz
Remove two unused functions and shrink another.
Diffstat (limited to 'lib/pending.c')
-rw-r--r--lib/pending.c33
1 files changed, 5 insertions, 28 deletions
diff --git a/lib/pending.c b/lib/pending.c
index a06912ee..eda45b40 100644
--- a/lib/pending.c
+++ b/lib/pending.c
@@ -38,38 +38,15 @@ unsigned long get_int_value(const char *numstr, unsigned long lowrange, unsigned
{
unsigned long rvalue = 0;
char *ptr;
- if(*numstr == '-' || *numstr == '+' || isspace(*numstr)) perror_exit("invalid number '%s'", numstr);
+
+ if (!isdigit(*numstr)) perror_exit("bad number '%s'", numstr);
errno = 0;
rvalue = strtoul(numstr, &ptr, 10);
- if(errno || numstr == ptr) perror_exit("invalid number '%s'", numstr);
- if(*ptr) perror_exit("invalid number '%s'", numstr);
- if(rvalue >= lowrange && rvalue <= highrange) return rvalue;
- else {
- perror_exit("invalid number '%s'", numstr);
- return rvalue; //Not reachable; to avoid waring message.
- }
-}
-/*
- * strcat to mallocated buffer
- * reallocate if need be
- */
-char *astrcat (char *x, char *y) {
- char *z;
- z = x;
- x = realloc (x, (x ? strlen (x) : 0) + strlen (y) + 1);
- if (!x) return 0;
- (z ? strcat : strcpy) (x, y);
- return x;
-}
+ if (errno || numstr == ptr || *ptr || rvalue < lowrange || rvalue > highrange)
+ perror_exit("bad number '%s'", numstr);
-/*
- * astrcat, but die on failure
- */
-char *xastrcat (char *x, char *y) {
- x = astrcat (x, y);
- if (!x) error_exit ("xastrcat");
- return x;
+ return rvalue;
}
void daemonize(void)