diff --git a/src/libCom/yacc/antelope.c b/src/libCom/yacc/antelope.c index 65d360a58..7143b38ff 100644 --- a/src/libCom/yacc/antelope.c +++ b/src/libCom/yacc/antelope.c @@ -115,7 +115,11 @@ getargs(int argc, char *argv[]) int i; char *s; - if (argc > 0) myname = argv[0]; + if (argc > 0) { + myname = strrchr(argv[0], '/'); + if (myname) myname++; + else myname = argv[0]; + } for (i = 1; i < argc; ++i) { s = argv[i]; diff --git a/src/libCom/yacc/error.c b/src/libCom/yacc/error.c index 2c72241a5..d95c92a3a 100644 --- a/src/libCom/yacc/error.c +++ b/src/libCom/yacc/error.c @@ -14,7 +14,7 @@ void fatal(char *msg) { - fprintf(stderr, "%s: f - %s\n", myname, msg); + fprintf(stderr, "%s: fatal - %s\n", myname, msg); done(2); } @@ -22,7 +22,7 @@ fatal(char *msg) void no_space(void) { - fprintf(stderr, "%s: f - out of space\n", myname); + fprintf(stderr, "%s: fatal - out of space\n", myname); done(2); } @@ -30,7 +30,7 @@ no_space(void) void open_error(char *filename) { - fprintf(stderr, "%s: f - cannot open \"%s\"\n", myname, filename); + fprintf(stderr, "%s: fatal - cannot open \"%s\"\n", myname, filename); done(2); } @@ -38,7 +38,7 @@ open_error(char *filename) void unexpected_EOF(void) { - fprintf(stderr, "%s: e - line %d of \"%s\", unexpected end-of-file\n", + fprintf(stderr, "%s: error - line %d of \"%s\", unexpected end-of-file\n", myname, lineno, input_file_name); done(1); } @@ -74,7 +74,7 @@ print_pos(char *st_line, char *st_cptr) void syntax_error(int st_lineno, char *st_line, char *st_cptr) { - fprintf(stderr, "%s: e - line %d of \"%s\", syntax error\n", + fprintf(stderr, "%s: error - line %d of \"%s\", syntax error\n", myname, st_lineno, input_file_name); print_pos(st_line, st_cptr); done(1); @@ -84,7 +84,7 @@ syntax_error(int st_lineno, char *st_line, char *st_cptr) void unterminated_comment(int c_lineno, char *c_line, char *c_cptr) { - fprintf(stderr, "%s: e - line %d of \"%s\", unmatched /*\n", + fprintf(stderr, "%s: error - line %d of \"%s\", unmatched /*\n", myname, c_lineno, input_file_name); print_pos(c_line, c_cptr); done(1); @@ -94,7 +94,7 @@ unterminated_comment(int c_lineno, char *c_line, char *c_cptr) void unterminated_string(int s_lineno, char *s_line, char *s_cptr) { - fprintf(stderr, "%s: e - line %d of \"%s\", unterminated string\n", + fprintf(stderr, "%s: error - line %d of \"%s\", unterminated string\n", myname, s_lineno, input_file_name); print_pos(s_line, s_cptr); done(1); @@ -104,7 +104,7 @@ unterminated_string(int s_lineno, char *s_line, char *s_cptr) void unterminated_text(int t_lineno, char *t_line, char *t_cptr) { - fprintf(stderr, "%s: e - line %d of \"%s\", unmatched %%{\n", + fprintf(stderr, "%s: error - line %d of \"%s\", unmatched %%{\n", myname, t_lineno, input_file_name); print_pos(t_line, t_cptr); done(1); @@ -114,7 +114,7 @@ unterminated_text(int t_lineno, char *t_line, char *t_cptr) void unterminated_union(int u_lineno, char *u_line, char *u_cptr) { - fprintf(stderr, "%s: e - line %d of \"%s\", unterminated %%union \ + fprintf(stderr, "%s: error - line %d of \"%s\", unterminated %%union \ declaration\n", myname, u_lineno, input_file_name); print_pos(u_line, u_cptr); done(1); @@ -124,7 +124,7 @@ declaration\n", myname, u_lineno, input_file_name); void over_unionized(char *u_cptr) { - fprintf(stderr, "%s: e - line %d of \"%s\", too many %%union \ + fprintf(stderr, "%s: error - line %d of \"%s\", too many %%union \ declarations\n", myname, lineno, input_file_name); print_pos(line, u_cptr); done(1); @@ -134,7 +134,7 @@ declarations\n", myname, lineno, input_file_name); void illegal_tag(int t_lineno, char *t_line, char *t_cptr) { - fprintf(stderr, "%s: e - line %d of \"%s\", illegal tag\n", + fprintf(stderr, "%s: error - line %d of \"%s\", illegal tag\n", myname, t_lineno, input_file_name); print_pos(t_line, t_cptr); done(1); @@ -144,7 +144,7 @@ illegal_tag(int t_lineno, char *t_line, char *t_cptr) void illegal_character(char *c_cptr) { - fprintf(stderr, "%s: e - line %d of \"%s\", illegal character\n", + fprintf(stderr, "%s: error - line %d of \"%s\", illegal character\n", myname, lineno, input_file_name); print_pos(line, c_cptr); done(1); @@ -154,7 +154,7 @@ illegal_character(char *c_cptr) void used_reserved(char *s) { - fprintf(stderr, "%s: e - line %d of \"%s\", illegal use of reserved symbol \ + fprintf(stderr, "%s: error - line %d of \"%s\", illegal use of reserved symbol \ %s\n", myname, lineno, input_file_name, s); done(1); } @@ -163,7 +163,7 @@ used_reserved(char *s) void tokenized_start(char *s) { - fprintf(stderr, "%s: e - line %d of \"%s\", the start symbol %s cannot be \ + fprintf(stderr, "%s: error - line %d of \"%s\", the start symbol %s cannot be \ declared to be a token\n", myname, lineno, input_file_name, s); done(1); } @@ -172,7 +172,7 @@ declared to be a token\n", myname, lineno, input_file_name, s); void retyped_warning(char *s) { - fprintf(stderr, "%s: w - line %d of \"%s\", the type of %s has been \ + fprintf(stderr, "%s: warning - line %d of \"%s\", the type of %s has been \ redeclared\n", myname, lineno, input_file_name, s); } @@ -180,7 +180,7 @@ redeclared\n", myname, lineno, input_file_name, s); void reprec_warning(char *s) { - fprintf(stderr, "%s: w - line %d of \"%s\", the precedence of %s has been \ + fprintf(stderr, "%s: warning - line %d of \"%s\", the precedence of %s has been \ redeclared\n", myname, lineno, input_file_name, s); } @@ -188,7 +188,7 @@ redeclared\n", myname, lineno, input_file_name, s); void revalued_warning(char *s) { - fprintf(stderr, "%s: w - line %d of \"%s\", the value of %s has been \ + fprintf(stderr, "%s: warning - line %d of \"%s\", the value of %s has been \ redeclared\n", myname, lineno, input_file_name, s); } @@ -196,7 +196,7 @@ redeclared\n", myname, lineno, input_file_name, s); void terminal_start(char *s) { - fprintf(stderr, "%s: e - line %d of \"%s\", the start symbol %s is a \ + fprintf(stderr, "%s: error - line %d of \"%s\", the start symbol %s is a \ token\n", myname, lineno, input_file_name, s); done(1); } @@ -205,7 +205,7 @@ token\n", myname, lineno, input_file_name, s); void restarted_warning(void) { - fprintf(stderr, "%s: w - line %d of \"%s\", the start symbol has been \ + fprintf(stderr, "%s: warning - line %d of \"%s\", the start symbol has been \ redeclared\n", myname, lineno, input_file_name); } @@ -213,7 +213,7 @@ redeclared\n", myname, lineno, input_file_name); void no_grammar(void) { - fprintf(stderr, "%s: e - line %d of \"%s\", no grammar has been \ + fprintf(stderr, "%s: error - line %d of \"%s\", no grammar has been \ specified\n", myname, lineno, input_file_name); done(1); } @@ -222,7 +222,7 @@ specified\n", myname, lineno, input_file_name); void terminal_lhs(int s_lineno) { - fprintf(stderr, "%s: e - line %d of \"%s\", a token appears on the lhs \ + fprintf(stderr, "%s: error - line %d of \"%s\", a token appears on the lhs \ of a production\n", myname, s_lineno, input_file_name); done(1); } @@ -231,7 +231,7 @@ of a production\n", myname, s_lineno, input_file_name); void prec_redeclared(void) { - fprintf(stderr, "%s: w - line %d of \"%s\", conflicting %%prec \ + fprintf(stderr, "%s: warning - line %d of \"%s\", conflicting %%prec \ specifiers\n", myname, lineno, input_file_name); } @@ -239,7 +239,7 @@ specifiers\n", myname, lineno, input_file_name); void unterminated_action(int a_lineno, char *a_line, char *a_cptr) { - fprintf(stderr, "%s: e - line %d of \"%s\", unterminated action\n", + fprintf(stderr, "%s: error - line %d of \"%s\", unterminated action\n", myname, a_lineno, input_file_name); print_pos(a_line, a_cptr); done(1); @@ -249,7 +249,7 @@ unterminated_action(int a_lineno, char *a_line, char *a_cptr) void dollar_warning(int a_lineno, int i) { - fprintf(stderr, "%s: w - line %d of \"%s\", $%d references beyond the \ + fprintf(stderr, "%s: warning - line %d of \"%s\", $%d references beyond the \ end of the current rule\n", myname, a_lineno, input_file_name, i); } @@ -257,7 +257,7 @@ end of the current rule\n", myname, a_lineno, input_file_name, i); void dollar_error(int a_lineno, char *a_line, char *a_cptr) { - fprintf(stderr, "%s: e - line %d of \"%s\", illegal $-name\n", + fprintf(stderr, "%s: error - line %d of \"%s\", illegal $-name\n", myname, a_lineno, input_file_name); print_pos(a_line, a_cptr); done(1); @@ -267,7 +267,7 @@ dollar_error(int a_lineno, char *a_line, char *a_cptr) void untyped_lhs(void) { - fprintf(stderr, "%s: e - line %d of \"%s\", $$ is untyped\n", + fprintf(stderr, "%s: error - line %d of \"%s\", $$ is untyped\n", myname, lineno, input_file_name); done(1); } @@ -276,7 +276,7 @@ untyped_lhs(void) void untyped_rhs(int i, char *s) { - fprintf(stderr, "%s: e - line %d of \"%s\", $%d (%s) is untyped\n", + fprintf(stderr, "%s: error - line %d of \"%s\", $%d (%s) is untyped\n", myname, lineno, input_file_name, i, s); done(1); } @@ -285,7 +285,7 @@ untyped_rhs(int i, char *s) void unknown_rhs(int i) { - fprintf(stderr, "%s: e - line %d of \"%s\", $%d is untyped\n", + fprintf(stderr, "%s: error - line %d of \"%s\", $%d is untyped\n", myname, lineno, input_file_name, i); done(1); } @@ -294,7 +294,7 @@ unknown_rhs(int i) void default_action_warning(void) { - fprintf(stderr, "%s: w - line %d of \"%s\", the default action assigns an \ + fprintf(stderr, "%s: warning - line %d of \"%s\", the default action assigns an \ undefined value to $$\n", myname, lineno, input_file_name); } @@ -302,7 +302,7 @@ undefined value to $$\n", myname, lineno, input_file_name); void undefined_goal(char *s) { - fprintf(stderr, "%s: e - the start symbol %s is undefined\n", myname, s); + fprintf(stderr, "%s: error - the start symbol %s is undefined\n", myname, s); done(1); } @@ -310,5 +310,5 @@ undefined_goal(char *s) void undefined_symbol_warning(char *s) { - fprintf(stderr, "%s: w - the symbol %s is undefined\n", myname, s); + fprintf(stderr, "%s: warning - the symbol %s is undefined\n", myname, s); }