new: Fix a pointer problem
authormarkus schnalke <meillo@marmaro.de>
Thu, 15 Jan 2015 20:40:53 +0000 (21:40 +0100)
committermarkus schnalke <meillo@marmaro.de>
Thu, 15 Jan 2015 20:43:15 +0000 (21:43 +0100)
I should learn to get such stuff right without the need to draw
the memory layout with boxes and lines on paper ...

Thanks to the test suite for catching this one!

uip/new.c

index a43a710..1ee95ff 100644 (file)
--- a/uip/new.c
+++ b/uip/new.c
@@ -314,7 +314,7 @@ doit(char *cur, char *folders, char *sequences[])
        char *sequences_s = NULL;
        int argc = 0;
        char *argv[MAXARGS];
-       char *cp;
+       char **seqp;
        char buf[BUFSIZ];
 
        if (cur == NULL || cur[0] == '\0') {
@@ -391,8 +391,8 @@ doit(char *cur, char *folders, char *sequences[])
                        argv[argc++] = "scan";
                        snprintf(buf, sizeof buf, "+%s", node->n_name);
                        argv[argc++] = buf;
-                       for (cp=*sequences; *cp; cp++) {
-                               argv[argc++] = cp;
+                       for (seqp=sequences; *seqp; seqp++) {
+                               argv[argc++] = *seqp;
                        }
                        argv[argc] = (char *)NULL;
                        execprog(*argv, argv);