shithub: riscv

Download patch

ref: 09151748500b86d3dc3322ac35100cab0b655c2d
parent: 9289c4b796b03fc1f164964466542090a2779be4
author: cinap_lenrek <[email protected]>
date: Mon Aug 3 11:32:16 EDT 2015

libcontrol: use strtol() to parse integer arguments

--- a/sys/src/libcontrol/control.c
+++ b/sys/src/libcontrol/control.c
@@ -416,9 +416,9 @@
 		cp->receiver = nil;
 	for(i=0; i<cp->nargs; i++){
 		t = cp->args[i];
-		while(*t == '[')	/* %R gives [0 0] [1 1]; atoi will stop at closing ] */
+		while(*t == '[')	/* %R gives [0 0] [1 1]; strtol will stop at closing ] */
 			t++;
-		cp->iargs[i] = atoi(t);
+		cp->iargs[i] = strtol(t, 0, 0);
 	}
 	return cp->nargs;
 }
--- a/sys/src/libcontrol/menu.c
+++ b/sys/src/libcontrol/menu.c
@@ -238,7 +238,7 @@
 		break;
 	case EFocus:
 		_ctlargcount(m, cp, 2);
-		if(atoi(cp->args[1]) == 0)
+		if(strtol(cp->args[1], 0, 0) == 0)
 			menuhide(m);
 		break;
 	case EFont: