Small cleanups before merge to master.
This commit is contained in:
parent
94e4c04561
commit
ed6ff8c1cb
4
FIXES
4
FIXES
@ -25,6 +25,10 @@ THIS SOFTWARE.
|
|||||||
This file lists all bug fixes, changes, etc., made since the AWK book
|
This file lists all bug fixes, changes, etc., made since the AWK book
|
||||||
was sent to the printers in August, 1987.
|
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:
|
February 6, 2020:
|
||||||
Additional small cleanups from Christos Zoulas. awk is now
|
Additional small cleanups from Christos Zoulas. awk is now
|
||||||
a little more robust about reporting I/O errors upon exit.
|
a little more robust about reporting I/O errors upon exit.
|
||||||
|
32
main.c
32
main.c
@ -22,7 +22,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
|||||||
THIS SOFTWARE.
|
THIS SOFTWARE.
|
||||||
****************************************************************/
|
****************************************************************/
|
||||||
|
|
||||||
const char *version = "version 20200206";
|
const char *version = "version 20200218";
|
||||||
|
|
||||||
#define DEBUG
|
#define DEBUG
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@ -57,24 +57,24 @@ static __attribute__((__noreturn__)) void fpecatch(int n
|
|||||||
, siginfo_t *si, void *uc
|
, siginfo_t *si, void *uc
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
#ifdef SA_SIGINFO
|
#ifdef SA_SIGINFO
|
||||||
static const char *emsg[] = {
|
static const char *emsg[] = {
|
||||||
[0] = "Unknown error",
|
[0] = "Unknown error",
|
||||||
[FPE_INTDIV] = "Integer divide by zero",
|
[FPE_INTDIV] = "Integer divide by zero",
|
||||||
[FPE_INTOVF] = "Integer overflow",
|
[FPE_INTOVF] = "Integer overflow",
|
||||||
[FPE_FLTDIV] = "Floating point divide by zero",
|
[FPE_FLTDIV] = "Floating point divide by zero",
|
||||||
[FPE_FLTOVF] = "Floating point overflow",
|
[FPE_FLTOVF] = "Floating point overflow",
|
||||||
[FPE_FLTUND] = "Floating point underflow",
|
[FPE_FLTUND] = "Floating point underflow",
|
||||||
[FPE_FLTRES] = "Floating point inexact result",
|
[FPE_FLTRES] = "Floating point inexact result",
|
||||||
[FPE_FLTINV] = "Invalid Floating point operation",
|
[FPE_FLTINV] = "Invalid Floating point operation",
|
||||||
[FPE_FLTSUB] = "Subscript out of range",
|
[FPE_FLTSUB] = "Subscript out of range",
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
FATAL("floating point exception"
|
FATAL("floating point exception"
|
||||||
#ifdef SA_SIGINFO
|
#ifdef SA_SIGINFO
|
||||||
": %s\n", (size_t)si->si_code < sizeof(emsg) / sizeof(emsg[0]) &&
|
": %s", (size_t)si->si_code < sizeof(emsg) / sizeof(emsg[0]) &&
|
||||||
emsg[si->si_code] ? emsg[si->si_code] : emsg[0]
|
emsg[si->si_code] ? emsg[si->si_code] : emsg[0]
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -144,8 +144,7 @@ int main(int argc, char *argv[])
|
|||||||
yyin = NULL;
|
yyin = NULL;
|
||||||
symtab = makesymtab(NSYMTAB/NSYMTAB);
|
symtab = makesymtab(NSYMTAB/NSYMTAB);
|
||||||
while (argc > 1 && argv[1][0] == '-' && argv[1][1] != '\0') {
|
while (argc > 1 && argv[1][0] == '-' && argv[1][1] != '\0') {
|
||||||
if (strcmp(argv[1], "-version") == 0 ||
|
if (strcmp(argv[1], "-version") == 0 || strcmp(argv[1], "--version") == 0) {
|
||||||
strcmp(argv[1], "--version") == 0) {
|
|
||||||
printf("awk %s\n", version);
|
printf("awk %s\n", version);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -165,8 +164,7 @@ int main(int argc, char *argv[])
|
|||||||
maxpfile += 20;
|
maxpfile += 20;
|
||||||
pfile = realloc(pfile, maxpfile * sizeof(*pfile));
|
pfile = realloc(pfile, maxpfile * sizeof(*pfile));
|
||||||
if (pfile == NULL)
|
if (pfile == NULL)
|
||||||
FATAL("error allocating space for "
|
FATAL("error allocating space for -f options");
|
||||||
"-f options");
|
|
||||||
}
|
}
|
||||||
pfile[npfile++] = fn;
|
pfile[npfile++] = fn;
|
||||||
break;
|
break;
|
||||||
|
@ -139,7 +139,7 @@ int main(int argc, char *argv[])
|
|||||||
if (tokentype != TOK_ENUM) {
|
if (tokentype != TOK_ENUM) {
|
||||||
n = sscanf(buf, "%1c %199s %199s %d", &c, def, name,
|
n = sscanf(buf, "%1c %199s %199s %d", &c, def, name,
|
||||||
&tok);
|
&tok);
|
||||||
if (c == '#' && n == 4 && strcmp(def, "define") == 0) {
|
if (n == 4 && c == '#' && strcmp(def, "define") == 0) {
|
||||||
tokentype = TOK_DEFINE;
|
tokentype = TOK_DEFINE;
|
||||||
} else if (tokentype != TOK_UNKNOWN) {
|
} else if (tokentype != TOK_UNKNOWN) {
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user