Use errorMsg rather than fprintf.

This commit is contained in:
Matt Kraai
2000-07-14 01:51:25 +00:00
parent 4ac6cb534d
commit d537a95fdb
81 changed files with 391 additions and 473 deletions

6
dc.c
View File

@@ -22,7 +22,7 @@ static unsigned int pointer;
static void push(double a)
{
if (pointer >= (sizeof(stack) / sizeof(*stack))) {
fprintf(stderr, "dc: stack overflow\n");
errorMsg("stack overflow\n");
exit(-1);
} else
stack[pointer++] = a;
@@ -31,7 +31,7 @@ static void push(double a)
static double pop()
{
if (pointer == 0) {
fprintf(stderr, "dc: stack underflow\n");
errorMsg("stack underflow\n");
exit(-1);
}
return stack[--pointer];
@@ -132,7 +132,7 @@ static void stack_machine(const char *argument)
}
o++;
}
fprintf(stderr, "dc: %s: syntax error.\n", argument);
errorMsg("%s: syntax error.\n", argument);
exit(-1);
}