#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
-#include "err.h"
+#include "common/err.h"
#include "parse.h"
#define DEBUG 0
char *buffer_read = buffer_terminate(state);
if (state->expression->type == EX_INTLIT || state->expression->type == EX_ARGNUM) {
- state->expression->value.int_value = atoi(buffer_read);
+ state->expression->value.int_value = atol(buffer_read);
free(buffer_read);
} else {
state->expression->value.str_value = buffer_read;
printf("%s\n", __FUNCTION__);
#endif
- if (c == '\"' || c == '$' || c == ':' || c == ',' || c == '&' || c == '(' || c == ')' || isdigit(c))
+ if (c == '\"' || c == '$' || c == '.' || c == ',' || c == '&' || c == '(' || c == ')' || isdigit(c))
return false;
if (! isspace(c)) {
FILE *f = fopen(filename, "r");
if (! f)
- error("%s: unable to open\n", filename);
+ syserror("fopen", f);
#if DEBUG
printf("[File %s]\n[Line %d]\n", filename, lines);
break;
if (ferror(f))
- error("%s: I/O error\n", filename);
+ syserror("getc", f);
if (c == '\n')
++lines;
#endif
if (! parse_character(&state, c))
- error("%s: syntax error in line %d\n", filename, lines);
+ error("syntax error: in file %s, line %d\n", filename, lines);
}
if (state.buffer || state.expression)
- error("%s: syntax error at end of file\n", filename);
+ error("syntax error: at end of file %s\n", filename);
fclose(f);