git: 9front

Download patch

ref: ef2def5af2b27ea9334ac3a7f87d1571e011031a
parent: 6f90213cae7f70b5244fea567defa91f498b703e
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Mon Aug 3 14:30:02 EDT 2015

resample: simplify getint()

--- a/sys/src/cmd/resample.c
+++ b/sys/src/cmd/resample.c
@@ -54,14 +54,13 @@
 int
 getint(char *s, int *percent)
 {
+	int n;
+
 	if(s == nil)
 		usage();
-	*percent = (s[strlen(s)-1] == '%');
-	if(*s == '+')
-		return atoi(s+1);
-	if(*s == '-')
-		return -atoi(s+1);
-	return atoi(s);
+	n = strtol(s, &s, 0);
+	*percent = *s == '%';
+	return n;
 }
 
 void
--