projects
/
oweals
/
busybox.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Note that insmod now also supports powerpc and mips. Thanks Larry.
[oweals/busybox.git]
/
dc.c
diff --git
a/dc.c
b/dc.c
index fac48e895a73da16eb00059aef05c08e7c6a5f4d..8d7a92a2802f5c871f40a4cb65bafd22667d9abe 100644
(file)
--- a/
dc.c
+++ b/
dc.c
@@
-1,10
+1,11
@@
/* vi: set sw=4 ts=4: */
/* vi: set sw=4 ts=4: */
-#include "internal.h"
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
#include <math.h>
#include <unistd.h>
#include <math.h>
+#include "busybox.h"
/* Tiny RPN calculator, because "expr" didn't give me bitwise operations. */
/* Tiny RPN calculator, because "expr" didn't give me bitwise operations. */
@@
-13,19
+14,15
@@
static unsigned int pointer;
static void push(double a)
{
static void push(double a)
{
- if (pointer >= (sizeof(stack) / sizeof(*stack))) {
- errorMsg("stack overflow\n");
- exit(-1);
- } else
- stack[pointer++] = a;
+ if (pointer >= (sizeof(stack) / sizeof(*stack)))
+ error_msg_and_die("stack overflow");
+ stack[pointer++] = a;
}
static double pop()
{
}
static double pop()
{
- if (pointer == 0) {
- errorMsg("stack underflow\n");
- exit(-1);
- }
+ if (pointer == 0)
+ error_msg_and_die("stack underflow");
return stack[--pointer];
}
return stack[--pointer];
}
@@
-124,8
+121,7
@@
static void stack_machine(const char *argument)
}
o++;
}
}
o++;
}
- errorMsg("%s: syntax error.\n", argument);
- exit(-1);
+ error_msg_and_die("%s: syntax error.", argument);
}
/* return pointer to next token in buffer and set *buffer to one char
}
/* return pointer to next token in buffer and set *buffer to one char
@@
-174,7
+170,7
@@
int dc_main(int argc, char **argv)
}
} else {
if (*argv[1]=='-')
}
} else {
if (*argv[1]=='-')
-
usage(dc_usage
);
+
show_usage(
);
while (argc >= 2) {
stack_machine(argv[1]);
argv++;
while (argc >= 2) {
stack_machine(argv[1]);
argv++;
@@
-182,5
+178,5
@@
int dc_main(int argc, char **argv)
}
}
stack_machine(0);
}
}
stack_machine(0);
- return
( TRUE)
;
+ return
EXIT_SUCCESS
;
}
}