From 347761e2fc734e10f4394e4dbce95a54776c4cae Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 27 Aug 2011 18:02:47 +0200 Subject: Switch to strtol --- src/randsleep.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/randsleep.c b/src/randsleep.c index bf7bdc3..23db7a7 100644 --- a/src/randsleep.c +++ b/src/randsleep.c @@ -5,13 +5,19 @@ int main (int argc, char **argv) { long maxsleep; + char * strtol_err; if (argc < 2) { fputs("Usage: randsleep [ []]\n", stderr); return 1; } - maxsleep = atol(argv[1]); + maxsleep = strtol(argv[1], &strtol_err, 0); + + if (strtol_err) { + printf("randsleep: strtol: Conversion error at '%s'\n", strtol_err); + return 1; + } srand(time(NULL) + getpid()); -- cgit v1.2.3