]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/cc: Fix -I switch to handle a path with blankspaces correctly
authorSergio Luis O. B. Correia <sergio@larces.uece.br>
Tue, 17 Nov 2009 17:02:47 +0000 (09:02 -0800)
committerRuss Cox <rsc@golang.org>
Tue, 17 Nov 2009 17:02:47 +0000 (09:02 -0800)
Currently, -I switch can't deal with a path containing spaces.
This commit simplify setinclude(), by removing the special case
of a string that had spaces. After this change, setinclude() will
merely add the given directories to the include path, if it does
not yet exist, and this approach works.

Will be needed for solving issue 115.

R=agl1, rsc, iant2, r
https://golang.org/cl/155059

src/cmd/cc/lex.c

index 428ba55ad94d5746508641d3e462d2221eee9558..118efd231187297a3d9abe43d37c2f22e3daee91 100644 (file)
@@ -1517,16 +1517,11 @@ void
 setinclude(char *p)
 {
        int i;
-       char *e;
-
-       while(*p != 0) {
-               e = strchr(p, ' ');
-               if(e != 0)
-                       *e = '\0';
 
+       if(*p != 0) {
                for(i=1; i < ninclude; i++)
                        if(strcmp(p, include[i]) == 0)
-                               break;
+                               return;
 
                if(i >= ninclude)
                        include[ninclude++] = p;
@@ -1536,9 +1531,6 @@ setinclude(char *p)
                        exits("ninclude");
                }
 
-               if(e == 0)
-                       break;
-               p = e+1;
        }
 }