projects
/
unix-history
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
tags
|
clone url
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add .o's to OBJS list
[unix-history]
/
usr
/
src
/
old
/
lex
/
sub1.c
diff --git
a/usr/src/old/lex/sub1.c
b/usr/src/old/lex/sub1.c
index
1b9f1ba
..
f5314ff
100644
(file)
--- a/
usr/src/old/lex/sub1.c
+++ b/
usr/src/old/lex/sub1.c
@@
-1,5
+1,5
@@
#ifndef lint
#ifndef lint
-static char sccsid[] = "@(#)sub1.c 4.
2
(Berkeley) %G%";
+static char sccsid[] = "@(#)sub1.c 4.
4
(Berkeley) %G%";
#endif
# include "ldefs.c"
#endif
# include "ldefs.c"
@@
-37,8
+37,8
@@
digit(c)
}
error(s,p,d)
{
}
error(s,p,d)
{
- if(!eof)fprintf(errorf,"%d: ",yyline);
-
fprintf(errorf,"(Error) "
);
+ fprintf(errorf,"\"%s\", line %d: (Error) ",
+
fptr > 0 ? sargv[fptr] : "<stdin>", yyline
);
fprintf(errorf,s,p,d);
putc('\n',errorf);
# ifdef DEBUG
fprintf(errorf,s,p,d);
putc('\n',errorf);
# ifdef DEBUG
@@
-57,8
+57,8
@@
error(s,p,d)
warning(s,p,d)
{
warning(s,p,d)
{
- if(!eof)fprintf(errorf,"%d: ",yyline);
-
fprintf(errorf,"(Warning) "
);
+ fprintf(errorf,"\"%s\", line %d: (Warning) ",
+
fptr > 0 ? sargv[fptr] : "<stdin>", yyline
);
fprintf(errorf,s,p,d);
putc('\n',errorf);
fflush(errorf);
fprintf(errorf,s,p,d);
putc('\n',errorf);
fflush(errorf);
@@
-371,17
+371,25
@@
error("Premature EOF");
}
gch(){
register int c;
}
gch(){
register int c;
+ static int hadeof;
+
+ if (hadeof) {
+ hadeof = 0;
+ yyline = 0;
+ }
prev = pres;
c = pres = peek;
peek = pushptr > pushc ? *--pushptr : getc(fin);
if(peek == EOF && sargc > 1){
prev = pres;
c = pres = peek;
peek = pushptr > pushc ? *--pushptr : getc(fin);
if(peek == EOF && sargc > 1){
+ hadeof = 1;
fclose(fin);
fin = fopen(sargv[++fptr],"r");
fclose(fin);
fin = fopen(sargv[++fptr],"r");
- if(fin == NULL)
+ if(fin == NULL) {
+ yyline = 0;
error("Cannot open file %s",sargv[fptr]);
error("Cannot open file %s",sargv[fptr]);
+ }
peek = getc(fin);
sargc--;
peek = getc(fin);
sargc--;
- sargv++;
}
if(c == EOF) {
eof = TRUE;
}
if(c == EOF) {
eof = TRUE;
@@
-489,7
+497,7
@@
munput(t,p) /* implementation dependent */
register int i,j;
if(t == 'c'){
*pushptr++ = peek; /* watch out for this */
register int i,j;
if(t == 'c'){
*pushptr++ = peek; /* watch out for this */
- peek = p;
+ peek =
(int)
p;
}
else if(t == 's'){
*pushptr++ = peek;
}
else if(t == 's'){
*pushptr++ = peek;
@@
-556,7
+564,7
@@
allprint(c)
default:
if(!printable(c)){
printf("\\%-3o",c);
default:
if(!printable(c)){
printf("\\%-3o",c);
- charc
=+
3;
+ charc
+=
3;
}
else
putchar(c);
}
else
putchar(c);