[BusyBox-cvs] busybox/coreutils printf.c,1.20,1.21

Erik Andersen andersen at busybox.net
Sat Mar 6 22:11:47 UTC 2004


Update of /var/cvs/busybox/coreutils
In directory nail:/tmp/cvs-serv7369/coreutils

Modified Files:
	printf.c 
Log Message:
Fix/eliminate use of atol


Index: printf.c
===================================================================
RCS file: /var/cvs/busybox/coreutils/printf.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- a/printf.c	8 Aug 2003 07:39:57 -0000	1.20
+++ b/printf.c	6 Mar 2004 22:11:45 -0000	1.21
@@ -405,48 +405,24 @@
 static unsigned long xstrtoul(char *arg)
 {
 	unsigned long result;
-	char *endptr;
-	//int errno_save = errno;
-
-	assert(arg!=NULL);
-
-	errno = 0;
-	result = strtoul(arg, &endptr, 0);
-	if (errno != 0 || *endptr!='\0' || endptr==arg)
+	if (safe_strtoul(arg, &result))
 		fprintf(stderr, "%s", arg);
-	//errno = errno_save;
 	return result;
 }
 
 static long xstrtol(char *arg)
 {
 	long result;
-	char *endptr;
-	//int errno_save = errno;
-
-	assert(arg!=NULL);
-
-	errno = 0;
-	result = strtoul(arg, &endptr, 0);
-	if (errno != 0 || *endptr!='\0' || endptr==arg)
+	if (safe_strtol(arg, &result))
 		fprintf(stderr, "%s", arg);
-	//errno = errno_save;
 	return result;
 }
 
 static double xstrtod(char *arg)
 {
 	double result;
-	char *endptr;
-	//int errno_save = errno;
-
-	assert(arg!=NULL);
-
-	errno = 0;
-	result = strtod(arg, &endptr);
-	if (errno != 0 || *endptr!='\0' || endptr==arg)
+	if (safe_strtod(arg, &result))
 		fprintf(stderr, "%s", arg);
-	//errno = errno_save;
 	return result;
 }
 




More information about the busybox-cvs mailing list