rgbasm: use errx() for some error messages

Need to replace fstk_Dump to fix the rest of the error messages
This commit is contained in:
bentley
2010-01-15 18:51:14 -07:00
parent bd84313462
commit 7474cee70d

View File

@@ -5,11 +5,12 @@
* *
*/ */
#include <stdlib.h> #include <err.h>
#include <stdio.h>
#include <time.h>
#include <math.h> #include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h> #include <string.h>
#include <time.h>
#include "asm/symbol.h" #include "asm/symbol.h"
#include "asm/fstack.h" #include "asm/fstack.h"
@@ -134,9 +135,7 @@ opt_Parse(char *s)
newopt.gbgfx[2] = s[3]; newopt.gbgfx[2] = s[3];
newopt.gbgfx[3] = s[4]; newopt.gbgfx[3] = s[4];
} else { } else {
printf errx(5, "Must specify exactly 4 characters for option 'g'");
("*ERROR*\t :\n\tMust specify exactly 4 characters for option 'g'\n");
exit(5);
} }
break; break;
case 'b': case 'b':
@@ -144,9 +143,7 @@ opt_Parse(char *s)
newopt.binary[0] = s[1]; newopt.binary[0] = s[1];
newopt.binary[1] = s[2]; newopt.binary[1] = s[2];
} else { } else {
printf errx(5, "Must specify exactly 2 characters for option 'b'");
("*ERROR*\t :\n\tMust specify exactly 2 characters for option 'b'\n");
exit(5);
} }
break; break;
case 'z': case 'z':
@@ -155,14 +152,10 @@ opt_Parse(char *s)
result = sscanf(&s[1], "%lx", &newopt.fillchar); result = sscanf(&s[1], "%lx", &newopt.fillchar);
if (!((result == EOF) || (result == 1))) { if (!((result == EOF) || (result == 1))) {
printf errx(5, "Invalid argument for option 'z'");
("*ERROR*\t :\n\tInvalid argument for option 'z'\n");
exit(5);
} }
} else { } else {
printf errx(5, "Invalid argument for option 'z'");
("*ERROR*\t :\n\tInvalid argument for option 'z'\n");
exit(5);
} }
break; break;
default: default:
@@ -296,10 +289,7 @@ main(int argc, char *argv[])
opt_Parse(&argv[argn][1]); opt_Parse(&argv[argn][1]);
break; break;
default: default:
printf("*ERROR*\t :\n\tUnknown option '%c'\n", errx(5, "Unknown option '%c'", argv[argn][1]);
argv[argn][1]);
exit(5);
break;
} }
argn += 1; argn += 1;
argc -= 1; argc -= 1;
@@ -372,8 +362,7 @@ main(int argc, char *argv[])
exit(5); exit(5);
} }
} else { } else {
printf errx(5, "Unterminated IF construct (%ld levels)!",
("*ERROR*\t:\tUnterminated IF construct (%ld levels)!\n",
nIFDepth); nIFDepth);
exit(5); exit(5);
} }