fix exit status

This commit is contained in:
ceriel 1988-09-09 11:36:57 +00:00
parent 2d98c32cb2
commit 5b50914bea
2 changed files with 7 additions and 3 deletions

View file

@ -221,6 +221,8 @@ va_dcl
va_end(pvar);
}
extern int nerrors;
/*VARARGS*/
error(va_alist)
va_dcl
@ -228,6 +230,7 @@ va_dcl
char *fmt;
va_list pvar;
nerrors++;
va_start(pvar);
fmt = va_arg(pvar, char *);
fprint( STDERR, "!! ERROR : ");

View file

@ -124,21 +124,22 @@ if_statement : IF
{
int nerrors;
static int saved = 0, token;
LLmessage( inserted_token)
int inserted_token;
{
nerrors++;
if ( inserted_token == 0) {
fprint( STDERR, "Sytax error in line %d, ", yylineno);
print_token( LLsymb);
fprint( STDERR, " will be deleted!!\n");
}
else if ( inserted_token < 0) {
fprint( STDERR, "Stack overflow in line %d, fatal error!\n",
fprint( STDERR, "Garbage at end, line %d!!\n",
yylineno);
exit( 1);
}
else {
fprint( STDERR, "Sytax error in line %d, ", yylineno);
@ -194,7 +195,7 @@ int lex_analyzer()
main()
{
table();
return( 0);
exit(nerrors);
}
}