diff options
Diffstat (limited to 'dc.c')
-rw-r--r-- | dc.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -8,11 +8,11 @@ | |||
8 | 8 | ||
9 | /* Tiny RPN calculator, because "expr" didn't give me bitwise operations. */ | 9 | /* Tiny RPN calculator, because "expr" didn't give me bitwise operations. */ |
10 | 10 | ||
11 | static const char dc_usage[] = "math expression ...\n" | 11 | static const char dc_usage[] = "dc expression ...\n" |
12 | #ifndef BB_FEATURE_TRIVIAL_HELP | 12 | #ifndef BB_FEATURE_TRIVIAL_HELP |
13 | "\nThis is a Tiny RPN calculator that understands the\n" | 13 | "\nThis is a Tiny RPN calculator that understands the\n" |
14 | "following operations: +, -, /, *, and, or, not, eor.\n" | 14 | "following operations: +, -, /, *, and, or, not, eor.\n" |
15 | "i.e. 'math 2 2 add' -> 4, and 'math 8 8 \\* 2 2 + /' -> 16\n" | 15 | "i.e. 'dc 2 2 add' -> 4, and 'dc 8 8 \\* 2 2 + /' -> 16\n" |
16 | #endif | 16 | #endif |
17 | ; | 17 | ; |
18 | 18 | ||
@@ -22,7 +22,7 @@ static unsigned int pointer; | |||
22 | static void push(double a) | 22 | static void push(double a) |
23 | { | 23 | { |
24 | if (pointer >= (sizeof(stack) / sizeof(*stack))) { | 24 | if (pointer >= (sizeof(stack) / sizeof(*stack))) { |
25 | fprintf(stderr, "math: stack overflow\n"); | 25 | fprintf(stderr, "dc: stack overflow\n"); |
26 | exit(-1); | 26 | exit(-1); |
27 | } else | 27 | } else |
28 | stack[pointer++] = a; | 28 | stack[pointer++] = a; |
@@ -31,7 +31,7 @@ static void push(double a) | |||
31 | static double pop() | 31 | static double pop() |
32 | { | 32 | { |
33 | if (pointer == 0) { | 33 | if (pointer == 0) { |
34 | fprintf(stderr, "math: stack underflow\n"); | 34 | fprintf(stderr, "dc: stack underflow\n"); |
35 | exit(-1); | 35 | exit(-1); |
36 | } | 36 | } |
37 | return stack[--pointer]; | 37 | return stack[--pointer]; |
@@ -132,7 +132,7 @@ static void stack_machine(const char *argument) | |||
132 | } | 132 | } |
133 | o++; | 133 | o++; |
134 | } | 134 | } |
135 | fprintf(stderr, "math: %s: syntax error.\n", argument); | 135 | fprintf(stderr, "dc: %s: syntax error.\n", argument); |
136 | exit(-1); | 136 | exit(-1); |
137 | } | 137 | } |
138 | 138 | ||