Quick Search:

Mode

Context

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

Other Diffs

Ignore

Blank Lines Whitespace: Expand:

Diff

1.50
 
1.51
 
MAIN:ragge:20070808202914
 
cpp.c
_>7878 #include <string.h>
 7979 #include <time.h>
 8080 #include <unistd.h>
<> 81+#include <ctype.h>
8182 
 8283 #ifdef HAVE_ALLOCA_H
 8384 #include <alloca.h>
     
 !
102103 #define DDPRINT(x)
 103104 #endif
 104105 
<>105 -static int ofd;
  106+int ofd;
106107 static usch outbuf[CPPBUF];
 107108 static int obufp, istty;
<>108 -int Cflag;
  109+int Cflag, Mflag;
  110+usch *Mfile;
109111 
 110112 /* avoid recursion */
 111113 struct recur {
     
 !
173175         register int ch;
 174176         usch *osp;
 175177 
<>176 -        while ((ch = getopt(argc, argv, "CD:I:S:U:td")) != -1)
  178+        while ((ch = getopt(argc, argv, "CD:I:MS:U:td")) != -1)
177179                 switch (ch) {
 178180                 case 'C': /* Do not discard comments */
 179181                         Cflag++;
     
 !
204206                         nl->value = osp;
 205207                         break;
 206208 
<> 209+                case 'M': /* Generate dependencies for make */
  210+                        Mflag++;
  211+                        break;
  212+
207213                 case 'S':
 208214                 case 'I':
 209215                         w = calloc(sizeof(struct incs), 1);
     
 !
264270                 nl->value = stringbuf-1;
 265271         }
 266272 
<> 273+        if (Mflag) {
  274+                usch *c;
  275+
  276+                if (argc < 1)
  277+                        error("-M and no infile");
  278+                if ((c = (usch *)strrchr(argv[0], '/')) == NULL)
  279+                        c = (usch *)argv[0];
  280+                else
  281+                        c++;
  282+                Mfile = stringbuf;
  283+                savstr(c); savch(0);
  284+                if ((c = (usch *)strrchr((char *)Mfile, '.')) == NULL)
  285+                        error("-M and no extension: ");
  286+                c[1] = 'o';
  287+                c[2] = 0;
  288+        }
  289+
267290         if (argc == 2) {
 268291                 if ((ofd = open(argv[1], O_WRONLY|O_CREAT, 0600)) < 0)
 269292                         error("Can't creat %s", argv[1]);
     
 !
482505                 yytext[strlen(yytext)-1] = 0;
 483506                 fn = (usch *)&yytext[1];
 484507                 /* first try to open file relative to previous file */
<>485 -                savstr(ifiles->fname);
  508+                savstr(ifiles->orgfn);
486509                 if ((stringbuf = (usch *)strrchr((char *)nm, '/')) == NULL)
 487510                         stringbuf = nm;
 488511                 else
     
 !
544567         if (yylex() != WSPACE || yylex() != IDENT)
 545568                 goto bad;
 546569 
<> 570+        if (isdigit((int)yytext[0]))
  571+                goto bad;
  572+
547573         np = lookup((usch *)yytext, ENTER);
 548574         redef = np->value != NULL;
 549575 
     
 !
11601186 {
 11611187         if (obufp == 0)
 11621188                 return;
<>1163 -        if (write(ofd, outbuf, obufp) < 0)
  1189+        if (Mflag == 0 && write(ofd, outbuf, obufp) < 0)
<_11641190                 error("obuf write error");
 11651191         obufp = 0;
 11661192 }
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-08-28 07:06 +0200