Quick Search:

Mode

Context

Displaying 3 lines of context. None | Less | More | Full

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.19
 
1.20
 
MAIN:ragge:20050102175425
 
cpp.c
_>103103 struct incs {
 104104         struct incs *next;
 105105         char *dir;
<>106 -} *incdir[3];
 107 -#define DOTINC 0
 108 -#define INCINC 1
 109 -#define SYSINC 2
  106+} *incdir[2];
  107+#define INCINC 0
  108+#define SYSINC 1
110109 
 111110 static struct symtab *filloc;
 112111 static struct symtab *linloc;
     
 !
155154 int
 156155 main(int argc, char **argv)
 157156 {
<>158 -        struct incs *w, *w2, incs;
  157+        struct incs *w, *w2;
159158         struct symtab *nl, *thisnl;
 160159         register int c, gotspc, ch;
 161160         usch *osp;
<>162 -        char *idir;
163161 
 164162         while ((ch = getopt(argc, argv, "D:I:S:U:td")) != -1)
 165163                 switch (ch) {
     
 !
217215         argv += optind;
 218216 
 219217         exfail = 0;
<>220 -        incs.dir = ".";
221218         if (argc) {
<>222 -                char *p;
 223 -
224219                 if (freopen(argv[0], "r", stdin) == NULL) {
 225220                         fprintf(stderr, "Can't open %s", argv[0]);
 226221                         exit(8);
 227222                 }
<>228 -                p = strdup(argv[0]);
 229 -                if ((idir = strrchr(p, '/')) != NULL) {
 230 -                        *idir = 0;
 231 -                        incs.dir = p;
 232 -                }
233223         }
<>234 -        incs.next = NULL;
 235 -        incdir[DOTINC] = &incs;
236224 
 237225         if (pushfile(argc ? argv[0] : "<stdin>"))
 238226                 error("cannot open %s", argv[0]);
     
 !
515503 
 516504 /*
 517505  * Include a file. Include order:
<>518 - * - if name inside <>, only search system includes.
 519 - * - if name inside "", first search current dir, then -I dirs,
 520 - *   then system includes.
  506+ * - For <...> files, first search -I directories, then system directories.
  507+ * - For "..." files, first search "current" dir, then as <...> files.
521508  */
 522509 void
 523510 include()
     
 !
550537                         savstr(yystr);
 551538                 }
 552539                 savch('\0');
<>553 -                it = INCINC;
  540+                it = SYSINC;
554541         } else {
<> 542+                usch *nm = stringbuf;
  543+
555544                 yystr[strlen(yystr)-1] = 0;
 556545                 fn = &yystr[1];
<>557 -                it = DOTINC;
  546+                /* first try to open file relative to previous file */
  547+                savstr(curfile());
  548+                if ((stringbuf = strrchr(nm, '/')) == NULL)
  549+                        stringbuf = nm;
  550+                else
  551+                        stringbuf++;
  552+                savstr(fn); savch(0);
  553+                if (pushfile(nm) == 0)
  554+                        goto ret;
  555+                stringbuf = nm;
558556         }
 559557 
 560558         /* create search path and try to open file */
<>561 -        for (i = it; i < 3; i++) {
  559+        for (i = 0; i < 2; i++) {
562560                 for (w = incdir[i]; w; w = w->next) {
 563561                         usch *nm = stringbuf;
 564562 
     
 !
675673                 }
 676674                 c = yylex();
 677675         }
<> 676+        /* remove trailing whitespace */
  677+        while (stringbuf > sbeg) {
  678+                if (stringbuf[-1] == ' ' || stringbuf[-1] == '\t')
  679+                        stringbuf--;
  680+                else
  681+                        break;
  682+        }
<_678683         savch(narg < 0 ? OBJCT : narg);
 679684         if (redef) {
 680685                 usch *o = np->value, *n = stringbuf-1;
FishEye: Open Source License registered to PCC.
Your maintenance has expired. You can renew your license at http://www.atlassian.com/fisheye/renew
Atlassian FishEye, CVS analysis. (Version:1.6.3 Build:build-336 2008-11-04) - Administration - Page generated 2014-10-31 16:48 +0100