From 470e89210e4580b4e8e1b247a2559680cc9c4510 Mon Sep 17 00:00:00 2001 From: Curtis F Kaylor Date: Thu, 8 Feb 2018 23:21:46 -0500 Subject: [PATCH] Changed all error messages to print to stderr --- common.c | 2 +- cond.c | 2 +- expr.c | 2 +- include.c | 19 +++++++++---------- parse.c | 4 ++-- stmnt.c | 2 +- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/common.c b/common.c index 71aab00..0e73e98 100644 --- a/common.c +++ b/common.c @@ -22,7 +22,7 @@ void exterr(int errnum) Args: expected - Description of what was expected */ void expctd(char *expstr) { - printf("Expected %s, but found '%c'\n", expstr, nxtchr); + fprintf(stderr, "Expected %s, but found '%c'\n", expstr, nxtchr); exterr(EXIT_FAILURE); } diff --git a/cond.c b/cond.c index 84584a0..66d06bd 100644 --- a/cond.c +++ b/cond.c @@ -80,7 +80,7 @@ void prccmp() asmlin("BNE", cndlbl); break; default: - printf("Unsupported comparison operator index %d\n", cmprtr); + fprintf(stderr, "Unsupported comparison operator index %d\n", cmprtr); exterr(EXIT_FAILURE); } } diff --git a/expr.c b/expr.c index dc4e7ef..1bcbb91 100644 --- a/expr.c +++ b/expr.c @@ -223,7 +223,7 @@ void prcopr() asmlin("EOR", term); break; default: - printf("Unrecognized operator '%c'\n", oper); + fprintf(stderr, "Unrecognized operator '%c'\n", oper); exterr(EXIT_FAILURE); } oper = 0; diff --git a/include.c b/include.c index 6f84191..45e8bd6 100644 --- a/include.c +++ b/include.c @@ -76,7 +76,7 @@ void pascii() invasc = TRUE; } else { - printf("Unrecognized option '%s'\n", word); + fprintf(stderr, "Unrecognized option '%s'\n", word); exterr(EXIT_FAILURE); } @@ -134,7 +134,7 @@ void pincdr() if (wordis("PRAGMA")) pprgma(); else { - printf("Unrecognized directive '%s'\n", word); + fprintf(stderr, "Unrecognized directive '%s'\n", word); exterr(EXIT_FAILURE); } } @@ -143,7 +143,7 @@ void pincdr() void phdwrd() { getwrd(); if (!ptype(MTNONE)) { - printf("Unexpected word '%s' in header\n", word); + fprintf(stderr, "Unexpected word '%s' in header\n", word); exterr(EXIT_FAILURE); } } @@ -192,11 +192,10 @@ void inchdr() { skpcmt(); else if (isalph()) phdwrd(); - else - { - printf("Unexpected character '%c'\n", nxtchr); - exterr(EXIT_FAILURE); - } + else { + fprintf(stderr, "Unexpected character '%c'\n", nxtchr); + exterr(EXIT_FAILURE); + } } clsinc(); rstsrc(); @@ -214,7 +213,7 @@ void pincfl() DEBUG("Processing include file '%s'\n", incnam); char *dot = strrchr(incnam, '.'); //find extension if (dot == NULL) { - printf("Invalid include file name '%sn", incnam); + fprintf(stderr, "Invalid include file name '%sn", incnam); exterr(EXIT_FAILURE); } if (strcmp(dot, ".a02") == 0) @@ -229,7 +228,7 @@ void pincfl() incasm(); //Process Assembly File with Same Name } else { - printf("Unrecognized include file extension '%s'\n'", dot); + fprintf(stderr, "Unrecognized include file extension '%s'\n'", dot); exterr(EXIT_FAILURE); } } diff --git a/parse.c b/parse.c index 3496302..5bc75bb 100644 --- a/parse.c +++ b/parse.c @@ -92,7 +92,7 @@ void expect(char c) if (c == 0) return; if (look(c)) return; else { - printf("Expected Character '%c', but found '%c'\n", c, nxtchr); + fprintf(stderr, "Expected Character '%c', but found '%c'\n", c, nxtchr); exterr(EXIT_FAILURE); } } @@ -448,7 +448,7 @@ void prcpst(char* name, char *index) asmlin("LSR", name); break; default: - printf("Unrecognized post operator '%c'\n", oper); + fprintf(stderr, "Unrecognized post operator '%c'\n", oper); exterr(EXIT_FAILURE); } } diff --git a/stmnt.c b/stmnt.c index 64b09e7..07cd68b 100644 --- a/stmnt.c +++ b/stmnt.c @@ -60,7 +60,7 @@ void prcasn(char trmntr) void poperr() { - printf("Illegal post-operation %c%c on register %s\n", oper, oper, asnvar); + fprintf(stderr, "Illegal post-operation %c%c on register %s\n", oper, oper, asnvar); exterr(EXIT_FAILURE); }