From: millert Date: Mon, 30 Oct 2023 17:52:54 +0000 (+0000) Subject: Minor cosmetic changes to make our awk match my github branch. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=2a0b182908c2a78a8a4287dc02f370034ca7c6dc;p=openbsd Minor cosmetic changes to make our awk match my github branch. --- diff --git a/usr.bin/awk/README.md b/usr.bin/awk/README.md index 8de0cfee220..010a08f5c60 100644 --- a/usr.bin/awk/README.md +++ b/usr.bin/awk/README.md @@ -1,4 +1,4 @@ -$OpenBSD: README.md,v 1.7 2023/09/17 14:49:44 millert Exp $ +$OpenBSD: README.md,v 1.8 2023/10/30 17:52:54 millert Exp $ # The One True Awk @@ -30,7 +30,7 @@ when expanded. The option `--csv` turns on CSV processing of input: fields are separated by commas, fields may be quoted with -double-quote (`"`) characters, fields may contain embedded newlines. +double-quote (`"`) characters, quoted fields may contain embedded newlines. In CSV mode, `FS` is ignored. If no explicit separator argument is provided, diff --git a/usr.bin/awk/b.c b/usr.bin/awk/b.c index 67061379975..6ab51bae1bf 100644 --- a/usr.bin/awk/b.c +++ b/usr.bin/awk/b.c @@ -1,4 +1,4 @@ -/* $OpenBSD: b.c,v 1.44 2023/10/06 22:31:21 millert Exp $ */ +/* $OpenBSD: b.c,v 1.45 2023/10/30 17:52:54 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -440,7 +440,7 @@ int *cclenter(const char *argp) /* add a character class */ } while (c < c2) { if (i >= bufsz) { - buf = (int *) reallocarray(buf, bufsz, sizeof(int) * 2); + buf = (int *) reallocarray(buf, bufsz, 2 * sizeof(int)); if (buf == NULL) FATAL("out of space for character class [%.10s...] 2", p); bufsz *= 2; @@ -453,7 +453,7 @@ int *cclenter(const char *argp) /* add a character class */ } } if (i >= bufsz) { - buf = (int *) reallocarray(buf, bufsz, sizeof(int) * 2); + buf = (int *) reallocarray(buf, bufsz, 2 * sizeof(int)); if (buf == NULL) FATAL("out of space for character class [%.10s...] 2", p); bufsz *= 2; diff --git a/usr.bin/awk/lib.c b/usr.bin/awk/lib.c index ba5acf15214..f3c4b5668a7 100644 --- a/usr.bin/awk/lib.c +++ b/usr.bin/awk/lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib.c,v 1.53 2023/10/30 16:14:51 millert Exp $ */ +/* $OpenBSD: lib.c,v 1.54 2023/10/30 17:52:54 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -247,7 +247,7 @@ int readrec(char **pbuf, int *pbufsize, FILE *inf, bool newflag) /* read one rec } if (found) setptr(patbeg, '\0'); - isrec = (found == 0 && *buf == '\0') ? 0 : 1; + isrec = (found == 0 && *buf == '\0') ? false : true; } else { if ((sep = *rs) == 0) { sep = '\n'; @@ -277,7 +277,7 @@ int readrec(char **pbuf, int *pbufsize, FILE *inf, bool newflag) /* read one rec if (!adjbuf(&buf, &bufsize, 1+rr-buf, recsize, &rr, "readrec 3")) FATAL("input record `%.30s...' too long", buf); *rr = 0; - isrec = (c == EOF && rr == buf) ? 0 : 1; + isrec = (c == EOF && rr == buf) ? false : true; } *pbuf = buf; *pbufsize = bufsize; diff --git a/usr.bin/awk/maketab.c b/usr.bin/awk/maketab.c index 6dd4b773c92..2c4adf72c78 100644 --- a/usr.bin/awk/maketab.c +++ b/usr.bin/awk/maketab.c @@ -1,4 +1,4 @@ -/* $OpenBSD: maketab.c,v 1.20 2020/07/30 17:45:44 millert Exp $ */ +/* $OpenBSD: maketab.c,v 1.21 2023/10/30 17:52:54 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -160,13 +160,13 @@ int main(int argc, char *argv[]) } if (tok < FIRSTTOKEN || tok > LASTTOKEN) { tokentype = TOK_UNKNOWN; - /* fprintf(stderr, "maketab: funny token %d %s ignored\n", tok, buf); */ + /* fprintf(stderr, "maketab funny token %d %s ignored\n", tok, buf); */ continue; } names[tok-FIRSTTOKEN] = strdup(name); if (names[tok-FIRSTTOKEN] == NULL) { fprintf(stderr, "maketab out of space copying %s", name); - exit(1); + return 1; } printf("\t\"%s\",\t/* %d */\n", name, tok); i++; diff --git a/usr.bin/awk/tran.c b/usr.bin/awk/tran.c index 0456aed983f..c2bb1e0227e 100644 --- a/usr.bin/awk/tran.c +++ b/usr.bin/awk/tran.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tran.c,v 1.37 2023/09/17 14:49:44 millert Exp $ */ +/* $OpenBSD: tran.c,v 1.38 2023/10/30 17:52:54 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -120,7 +120,7 @@ void arginit(int ac, char **av) /* set up ARGV and ARGC */ for (i = 0; i < ac; i++) { double result; - snprintf(temp, sizeof temp, "%d", i); + snprintf(temp, sizeof(temp), "%d", i); if (is_number(*av, & result)) setsymtab(temp, *av, result, STR|NUM, ARGVtab); else