*/
#include "eval_arg.h"
-#include "common.h"
-#include <stdlib.h>
-#include <ctype.h>
+#include "command.h" /* jump_buf */
#include <setjmp.h>
#include "print-utils.h"
-#include "command.h" /* jump_buf */
static jmp_buf eval_jbuf;
static char ch;
{
do
ch = *bp++;
- while (ch == ' ' || ch == '\n');
+ while (isspace(ch));
}
static long number (void)
next();
else
error ();
+ } else {
+ char sign = ch;
+ if (sign == '+' || sign == '-') {
+ next();
+ }
+ f = number();
+ if (sign == '-')
+ f = -f;
}
- else
- f = number ();
-
return f;
}
static long expr(void)
{
- long e;
-
- if (ch == '+') {
- next();
- e = term ();
- } else if (ch == '-') {
- next();
- e = - term ();
- } else
- e = term ();
+ long e = term ();
while (ch == '+' || ch == '-') {
char op = ch;