Small cleanups before merge to master.
diff --git a/FIXES b/FIXES
index 598608a..8fe301a 100644
--- a/FIXES
+++ b/FIXES
@@ -25,6 +25,10 @@
This file lists all bug fixes, changes, etc., made since the AWK book
was sent to the printers in August, 1987.
+February 18, 2020:
+ Additional cleanups from Christos Zoulas. It's no longer necessary
+ to use the -y flag to bison.
+
February 6, 2020:
Additional small cleanups from Christos Zoulas. awk is now
a little more robust about reporting I/O errors upon exit.
diff --git a/main.c b/main.c
index 5a1ecbf..5894dde 100644
--- a/main.c
+++ b/main.c
@@ -22,7 +22,7 @@
THIS SOFTWARE.
****************************************************************/
-const char *version = "version 20200206";
+const char *version = "version 20200218";
#define DEBUG
#include <stdio.h>
@@ -57,24 +57,24 @@
, siginfo_t *si, void *uc
#endif
)
- {
+{
#ifdef SA_SIGINFO
static const char *emsg[] = {
- [0] = "Unknown error",
- [FPE_INTDIV] = "Integer divide by zero",
- [FPE_INTOVF] = "Integer overflow",
- [FPE_FLTDIV] = "Floating point divide by zero",
- [FPE_FLTOVF] = "Floating point overflow",
- [FPE_FLTUND] = "Floating point underflow",
- [FPE_FLTRES] = "Floating point inexact result",
- [FPE_FLTINV] = "Invalid Floating point operation",
- [FPE_FLTSUB] = "Subscript out of range",
+ [0] = "Unknown error",
+ [FPE_INTDIV] = "Integer divide by zero",
+ [FPE_INTOVF] = "Integer overflow",
+ [FPE_FLTDIV] = "Floating point divide by zero",
+ [FPE_FLTOVF] = "Floating point overflow",
+ [FPE_FLTUND] = "Floating point underflow",
+ [FPE_FLTRES] = "Floating point inexact result",
+ [FPE_FLTINV] = "Invalid Floating point operation",
+ [FPE_FLTSUB] = "Subscript out of range",
};
#endif
FATAL("floating point exception"
#ifdef SA_SIGINFO
- ": %s\n", (size_t)si->si_code < sizeof(emsg) / sizeof(emsg[0]) &&
- emsg[si->si_code] ? emsg[si->si_code] : emsg[0]
+ ": %s", (size_t)si->si_code < sizeof(emsg) / sizeof(emsg[0]) &&
+ emsg[si->si_code] ? emsg[si->si_code] : emsg[0]
#endif
);
}
@@ -144,8 +144,7 @@
yyin = NULL;
symtab = makesymtab(NSYMTAB/NSYMTAB);
while (argc > 1 && argv[1][0] == '-' && argv[1][1] != '\0') {
- if (strcmp(argv[1], "-version") == 0 ||
- strcmp(argv[1], "--version") == 0) {
+ if (strcmp(argv[1], "-version") == 0 || strcmp(argv[1], "--version") == 0) {
printf("awk %s\n", version);
return 0;
}
@@ -165,8 +164,7 @@
maxpfile += 20;
pfile = realloc(pfile, maxpfile * sizeof(*pfile));
if (pfile == NULL)
- FATAL("error allocating space for "
- "-f options");
+ FATAL("error allocating space for -f options");
}
pfile[npfile++] = fn;
break;
diff --git a/maketab.c b/maketab.c
index 5a04212..2384d51 100644
--- a/maketab.c
+++ b/maketab.c
@@ -139,7 +139,7 @@
if (tokentype != TOK_ENUM) {
n = sscanf(buf, "%1c %199s %199s %d", &c, def, name,
&tok);
- if (c == '#' && n == 4 && strcmp(def, "define") == 0) {
+ if (n == 4 && c == '#' && strcmp(def, "define") == 0) {
tokentype = TOK_DEFINE;
} else if (tokentype != TOK_UNKNOWN) {
continue;