ref: 517c0feacaede7dcba7dea95aef49d78c94e8c7c
parent: a1bc7c76ba7392960086e53132bbc5f358bd6b03
author: ppatience0 <[email protected]>
date: Mon May 6 16:24:19 EDT 2013
ape: fix uninitialized variable bug in getfields()
--- a/sys/src/ape/lib/ap/plan9/9iounit.c
+++ b/sys/src/ape/lib/ap/plan9/9iounit.c
@@ -14,7 +14,7 @@
getfields(char *str, char **args, int max, int mflag)
{
char r;
- int nr, intok, narg;
+ int intok, narg;
if(max <= 0)
return 0;
@@ -24,8 +24,8 @@
if(!mflag)
narg++;
intok = 0;
- for(;;) {
- r = *str++;
+ for(;; str++) {
+ r = *str;
if(r == 0)
break;
if(r == ' ' || r == '\t'){
@@ -33,7 +33,7 @@
break;
*str = 0;
intok = 0;
- args[narg] = str + nr;
+ args[narg] = str + 1;
if(!mflag)
narg++;
} else {