-/* $OpenBSD: cc.c,v 1.14 2008/08/17 18:40:12 ragge Exp $ */
+/* $OpenBSD: cc.c,v 1.15 2008/08/18 20:54:10 ragge Exp $ */
/*
* Copyright(C) Caldera International Inc. 2001-2002. All rights reserved.
*
#define MAXOPT 100
char *tmp3;
char *tmp4;
-char *outfile;
+char *outfile, *ermfile;
char *Bprefix(char *);
char *copy(char *, int),*setsuf(char *, char);
int getsuf(char *);
int xcflag;
int ascpp;
-char *passp = LIBEXECDIR PREPROCESSOR;
-char *pass0 = LIBEXECDIR COMPILER;
+char *passp = LIBEXECDIR "/" PREPROCESSOR;
+char *pass0 = LIBEXECDIR "/" COMPILER;
char *as = ASSEMBLER;
char *ld = LINKER;
char *Bflag;
if (!Eflag && !Mflag)
av[na++] = tmp4;
if (Eflag && outfile)
- av[na++] = outfile;
+ ermfile = av[na++] = outfile;
av[na++]=0;
if (callsys(passp, av))
{exfail++; eflag++;}
else
tmp3 = setsuf(clist[i], 's');
}
- av[na++] = tmp3;
+ ermfile = av[na++] = tmp3;
#if 0
if (proflag) {
av[3] = "-XP";
av[na++] = "-k";
av[na++] = "-o";
if (outfile && cflag)
- av[na++] = outfile;
+ ermfile = av[na++] = outfile;
else
- av[na++] = setsuf(clist[i], 'o');
+ ermfile = av[na++] = setsuf(clist[i], 'o');
av[na++] = assource;
if (dflag)
av[na++] = alist;
cunlink(tmp3);
cunlink(tmp4);
}
+ if (exfail || eflag)
+ cunlink(ermfile);
if (eval == 100)
_exit(eval);
exit(eval);
-/* $OpenBSD: cpp.c,v 1.10 2008/08/17 18:40:13 ragge Exp $ */
+/* $OpenBSD: cpp.c,v 1.11 2008/08/18 20:54:10 ragge Exp $ */
/*
* Copyright (c) 2004 Anders Magnusson (ragge@ludd.luth.se).
struct recur *rp;
{
struct recur rp2;
- register usch *vp, *cp;
- int c, rv = 0, ws;
+ register usch *vp, *cp, *obp;
+ int c, nl;
DPRINT(("subst: %s\n", sp->namep));
/*
/* should we be here at all? */
/* check if identifier is followed by parentheses */
- rv = 1;
- ws = 0;
+
+ obp = stringbuf;
+ nl = 0;
do {
- c = yylex();
+ c = cinput();
+ *stringbuf++ = c;
if (c == WARN) {
gotwarn++;
if (rp == NULL)
- goto noid;
- } else if (c == WSPACE || c == '\n')
- ws = 1;
- } while (c == WSPACE || c == '\n' || c == WARN);
-
- cp = (usch *)yytext;
- while (*cp)
- cp++;
- while (cp > (usch *)yytext)
- cunput(*--cp);
+ break;
+ }
+ if (c == '\n')
+ nl++;
+ } while (c == ' ' || c == '\t' || c == '\n' ||
+ c == '\r' || c == WARN);
+
DPRINT(("c %d\n", c));
if (c == '(' ) {
+ cunput(c);
+ stringbuf = obp;
+ ifiles->lineno += nl;
expdef(vp, &rp2, gotwarn);
- return rv;
+ return 1;
} else {
- /* restore identifier */
-noid: while (gotwarn--)
- cunput(WARN);
- if (ws)
- cunput(' ');
- cp = sp->namep;
- while (*cp)
- cp++;
- while (cp > sp->namep)
- cunput(*--cp);
+ *stringbuf = 0;
+ unpstr(obp);
+ unpstr(sp->namep);
if ((c = yylex()) != IDENT)
error("internal sync error");
+ stringbuf = obp;
return 0;
}
} else {
%{
-/* $OpenBSD: scanner.l,v 1.10 2008/08/17 18:40:13 ragge Exp $ */
+/* $OpenBSD: scanner.l,v 1.11 2008/08/18 20:54:10 ragge Exp $ */
/*
* Copyright (c) 2004 Anders Magnusson. All rights reserved.
}
. {
+ if (contr) {
+ while (input() != '\n')
+ ;
+ unput('\n');
+ BEGIN 0;
+ contr = 0;
+ goto yy;
+ }
if (YYSTATE || slow)
return yytext[0];
if (yytext[0] == 6) { /* PRAGS */
} else {
PRTOUT(yytext[0]);
}
+ yy:;
}
%%