aboutsummaryrefslogtreecommitdiff
path: root/coreutils/printf.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2004-03-06 22:11:45 +0000
committerEric Andersen <andersen@codepoet.org>2004-03-06 22:11:45 +0000
commit2479445562a9b5a9f226d0b00c41dbd533e63213 (patch)
treee4891420283c085d688683a41cc217dc896917b8 /coreutils/printf.c
parentc4db0833a6c91dd3714bec1db076a80910af6e30 (diff)
downloadbusybox-w32-2479445562a9b5a9f226d0b00c41dbd533e63213.tar.gz
busybox-w32-2479445562a9b5a9f226d0b00c41dbd533e63213.tar.bz2
busybox-w32-2479445562a9b5a9f226d0b00c41dbd533e63213.zip
Fix/eliminate use of atol
Diffstat (limited to 'coreutils/printf.c')
-rw-r--r--coreutils/printf.c30
1 files changed, 3 insertions, 27 deletions
diff --git a/coreutils/printf.c b/coreutils/printf.c
index 181c70bfb..76f59686b 100644
--- a/coreutils/printf.c
+++ b/coreutils/printf.c
@@ -405,48 +405,24 @@ print_direc(char *start, size_t length, int field_width, int precision,
405static unsigned long xstrtoul(char *arg) 405static unsigned long xstrtoul(char *arg)
406{ 406{
407 unsigned long result; 407 unsigned long result;
408 char *endptr; 408 if (safe_strtoul(arg, &result))
409 //int errno_save = errno;
410
411 assert(arg!=NULL);
412
413 errno = 0;
414 result = strtoul(arg, &endptr, 0);
415 if (errno != 0 || *endptr!='\0' || endptr==arg)
416 fprintf(stderr, "%s", arg); 409 fprintf(stderr, "%s", arg);
417 //errno = errno_save;
418 return result; 410 return result;
419} 411}
420 412
421static long xstrtol(char *arg) 413static long xstrtol(char *arg)
422{ 414{
423 long result; 415 long result;
424 char *endptr; 416 if (safe_strtol(arg, &result))
425 //int errno_save = errno;
426
427 assert(arg!=NULL);
428
429 errno = 0;
430 result = strtoul(arg, &endptr, 0);
431 if (errno != 0 || *endptr!='\0' || endptr==arg)
432 fprintf(stderr, "%s", arg); 417 fprintf(stderr, "%s", arg);
433 //errno = errno_save;
434 return result; 418 return result;
435} 419}
436 420
437static double xstrtod(char *arg) 421static double xstrtod(char *arg)
438{ 422{
439 double result; 423 double result;
440 char *endptr; 424 if (safe_strtod(arg, &result))
441 //int errno_save = errno;
442
443 assert(arg!=NULL);
444
445 errno = 0;
446 result = strtod(arg, &endptr);
447 if (errno != 0 || *endptr!='\0' || endptr==arg)
448 fprintf(stderr, "%s", arg); 425 fprintf(stderr, "%s", arg);
449 //errno = errno_save;
450 return result; 426 return result;
451} 427}
452 428