commit e68f375d310745b6740e259f0dee3d28812a695c
parent 02c269e2b30419cc19a65e7ee1f552cfee98c7b0
Author: zavok <an2qzavok@gmail.com>
Date: Mon, 23 Mar 2020 00:16:29 +0300
meh
Diffstat:
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/svex.c b/svex.c
@@ -18,7 +18,7 @@ long blen;
long curp, addr[2];
void load(void);
-int parseaddr(char*);
+int parseaddr(char*, long*);
char* getrow(long);
int printrow(long);
@@ -48,10 +48,10 @@ main (int argc, char *argv[])
char *cmd;
n = read(0, ibuf, 1024);
ibuf[n] = 0;
- cmd = ibuf + parseaddr(ibuf);
+ cmd = ibuf + parseaddr(ibuf, addr);
switch (cmd[0]){
case 'p':
- printrow(addr[1]);
+ printrow(addr[0]);
break;
case '\0':
case 'q':
@@ -66,16 +66,16 @@ main (int argc, char *argv[])
}
int
-parseaddr(char *buf)
+parseaddr(char *buf, long *addr)
{
long n;
char *bp;
- addr[1] = curp;
+ *addr = curp;
bp = buf;
switch (buf[0]){
case '.':
// current position
- addr[1] = curp;
+ *addr = curp;
bp++;
break;
case '$':
@@ -89,7 +89,7 @@ parseaddr(char *buf)
break;
default:
n = strtol(buf, &bp, 10);
- if (bp != buf) addr[1] = n;
+ if (bp != buf) *addr = n;
}
return (bp - buf);
}