Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-9]: src/external/historical/nawk/dist Pull up following revision(...



details:   https://anonhg.NetBSD.org/src/rev/47739a64b078
branches:  netbsd-9
changeset: 453085:47739a64b078
user:      martin <martin%NetBSD.org@localhost>
date:      Sun Aug 04 19:19:31 2019 +0000

description:
Pull up following revision(s) (requested by christos in ticket #11):

        external/historical/nawk/dist/awk.h: revision 1.3
        external/historical/nawk/dist/run.c: revision 1.10
        external/historical/nawk/dist/FIXES: revision 1.2
        external/historical/nawk/dist/b.c: revision 1.7
        external/historical/nawk/dist/b.c: revision 1.8
        external/historical/nawk/dist/lex.c: revision 1.5
        external/historical/nawk/dist/main.c: revision 1.9
        external/historical/nawk/dist/proto.h: revision 1.8
        external/historical/nawk/dist/tran.c: revision 1.10
        external/historical/nawk/dist/proto.h: revision 1.9
        external/historical/nawk/dist/awk.1: revision 1.2
        external/historical/nawk/dist/lib.c: revision 1.9
        external/historical/nawk/dist/ytab.c: revision 1.2
        external/historical/nawk/dist/tran.c: revision 1.9

remove trailing whitespace.

PR/54424: Martijn Dekker: awk: broken character classes in UTF-8 locale:
only the first matches

Pick up some of the fixes from upstream:
        - posix paren matching
        - print \v \a
        - some more fatal handling
        - init all the character range.

remove ### error output accidentally committed.

Add translators for \v and \a per posix.

diffstat:

 external/historical/nawk/dist/FIXES  |  34 +++++++++---------
 external/historical/nawk/dist/awk.1  |  12 +++---
 external/historical/nawk/dist/awk.h  |   4 +-
 external/historical/nawk/dist/b.c    |  63 +++++++++++++++++++++++++----------
 external/historical/nawk/dist/lex.c  |  22 ++++++------
 external/historical/nawk/dist/lib.c  |   2 +-
 external/historical/nawk/dist/main.c |   6 +-
 external/historical/nawk/dist/run.c  |   4 +-
 external/historical/nawk/dist/tran.c |  14 ++++---
 external/historical/nawk/dist/ytab.c |  10 ++--
 10 files changed, 99 insertions(+), 72 deletions(-)

diffs (truncated from 657 to 300 lines):

diff -r 9de2ac0e68f1 -r 47739a64b078 external/historical/nawk/dist/FIXES
--- a/external/historical/nawk/dist/FIXES       Sun Aug 04 19:09:16 2019 +0000
+++ b/external/historical/nawk/dist/FIXES       Sun Aug 04 19:19:31 2019 +0000
@@ -52,10 +52,10 @@
        /pat/, \n /pat/ {...} is now legal, though bad style to use.
 
        added checks to new -v code that permits -vnospace; thanks to
-       ruslan ermilov for spotting this and providing the patch. 
+       ruslan ermilov for spotting this and providing the patch.
 
        removed fixed limit on number of open files; thanks to aleksey
-       cheusov and christos zoulos. 
+       cheusov and christos zoulos.
 
        fixed day 1 bug that resurrected deleted elements of ARGV when
        used as filenames (in lib.c).
@@ -73,10 +73,10 @@
        and arnold robbins, changed srand() to return the previous
        seed (which is 1 on the first call of srand).  the seed is
        an Awkfloat internally though converted to unsigned int to
-       pass to the library srand().  thanks, everyone. 
+       pass to the library srand().  thanks, everyone.
 
        fixed a subtle (and i hope low-probability) overflow error
-       in fldbld, by adding space for one extra \0.  thanks to 
+       in fldbld, by adding space for one extra \0.  thanks to
        robert bassett for spotting this one and providing a fix.
 
        removed the files related to compilation on windows.  i no
@@ -113,7 +113,7 @@
 
 Oct 23, 2007:
        minor fix in lib.c: increase inputFS to 100, change malloc
-       for fields to n+1.  
+       for fields to n+1.
 
        fixed memory fault caused by out of order test in setsval.
 
@@ -160,7 +160,7 @@
 
        core dump on linux with BEGIN {nextfile}, now fixed.
 
-       removed some #ifdef's in run.c and lex.c that appear to no 
+       removed some #ifdef's in run.c and lex.c that appear to no
        longer be necessary.
 
 Apr 24, 2005:
@@ -174,8 +174,8 @@
        rethinking it.
 
 Dec 31, 2004:
-       prevent overflow of -f array in main, head off potential error in 
-       call of SYNTAX(), test malloc return in lib.c, all with thanks to 
+       prevent overflow of -f array in main, head off potential error in
+       call of SYNTAX(), test malloc return in lib.c, all with thanks to
        todd miller.
 
 Dec 22, 2004:
@@ -203,8 +203,8 @@
        code known to man.
 
        fixed a storage leak in call() that appears to have been there since
-       1983 or so -- a function without an explicit return that assigns a 
-       string to a parameter leaked a Cell.  thanks to moinak ghosh for 
+       1983 or so -- a function without an explicit return that assigns a
+       string to a parameter leaked a Cell.  thanks to moinak ghosh for
        spotting this very subtle one.
 
 Jul 31, 2003:
@@ -226,7 +226,7 @@
        radix character in programs and command line arguments regardless of
        the locale; otherwise, the locale should prevail for input and output
        of numbers.  so it's intended to work that way.
-       
+
        i have rescinded the attempt to use strcoll in expanding shorthands in
        regular expressions (cclenter).  its properties are much too
        surprising; for example [a-c] matches aAbBc in locale en_US but abBcC
@@ -290,7 +290,7 @@
 Jun 28, 2002:
        modified run/format() and tran/getsval() to do a slightly better
        job on using OFMT for output from print and CONVFMT for other
-       number->string conversions, as promised by posix and done by 
+       number->string conversions, as promised by posix and done by
        gawk and mawk.  there are still places where it doesn't work
        right if CONVFMT is changed; by then the STR attribute of the
        variable has been irrevocably set.  thanks to arnold robbins for
@@ -322,7 +322,7 @@
 Jan 1, 2002:
        fflush() or fflush("") flushes all files and pipes.
 
-       length(arrayname) returns number of elements; thanks to 
+       length(arrayname) returns number of elements; thanks to
        arnold robbins for suggestion.
 
        added a makefile.win to make it easier to build on windows.
@@ -372,7 +372,7 @@
 
 May 25, 2000:
        yet another attempt at making 8-bit input work, with another
-       band-aid in b.c (member()), and some (uschar) casts to head 
+       band-aid in b.c (member()), and some (uschar) casts to head
        off potential errors in subscripts (like isdigit).  also
        changed HAT to NCHARS-2.  thanks again to santiago vila.
 
@@ -419,7 +419,7 @@
        the test case.)
 
 Apr 16, 1999:
-       with code kindly provided by Bruce Lilly, awk now parses 
+       with code kindly provided by Bruce Lilly, awk now parses
        /=/ and similar constructs more sensibly in more places.
        Bruce also provided some helpful test cases.
 
@@ -476,7 +476,7 @@
 
 Oct 19, 1998:
        fixed a couple of bugs in getrec: could fail to update $0
-       after a getline var; because inputFS wasn't initialized, 
+       after a getline var; because inputFS wasn't initialized,
        could split $0 on every character, a misleading diversion.
 
        fixed caching bug in makedfa: LRU was actually removing
@@ -622,7 +622,7 @@
        input file. (thanks to arnold robbins for inspiration and code).
 
        small fixes to regexpr code:  can now handle []], [[], and
-       variants;  [] is now a syntax error, rather than matching 
+       variants;  [] is now a syntax error, rather than matching
        everything;  [z-a] is now empty, not z.  far from complete
        or correct, however.  (thanks to jeffrey friedl for pointing out
        some awful behaviors.)
diff -r 9de2ac0e68f1 -r 47739a64b078 external/historical/nawk/dist/awk.1
--- a/external/historical/nawk/dist/awk.1       Sun Aug 04 19:09:16 2019 +0000
+++ b/external/historical/nawk/dist/awk.1       Sun Aug 04 19:19:31 2019 +0000
@@ -49,7 +49,7 @@
 Each line is matched against the
 pattern portion of every pattern-action statement;
 the associated action is performed for each matched pattern.
-The file name 
+The file name
 .B \-
 means the standard input.
 Any
@@ -91,7 +91,7 @@
 .IP
 .IB pattern " { " action " }
 .PP
-A missing 
+A missing
 .BI { " action " }
 means print the line;
 a missing pattern always matches.
@@ -195,7 +195,7 @@
 .BR sin ,
 .BR cos ,
 and
-.BR atan2 
+.BR atan2
 are built in.
 Other built-in functions:
 .TF length
@@ -224,7 +224,7 @@
 substring of
 .I s
 that begins at position
-.IR m 
+.IR m
 counted from 1.
 .TP
 .BI index( s , " t" )
@@ -352,7 +352,7 @@
 of regular expressions and
 relational expressions.
 Regular expressions are as in
-.IR egrep ; 
+.IR egrep ;
 see
 .IR grep (1).
 Isolated regular expressions
@@ -512,7 +512,7 @@
 .fi
 .EE
 .SH SEE ALSO
-.IR lex (1), 
+.IR lex (1),
 .IR sed (1)
 .br
 A. V. Aho, B. W. Kernighan, P. J. Weinberger,
diff -r 9de2ac0e68f1 -r 47739a64b078 external/historical/nawk/dist/awk.h
--- a/external/historical/nawk/dist/awk.h       Sun Aug 04 19:09:16 2019 +0000
+++ b/external/historical/nawk/dist/awk.h       Sun Aug 04 19:19:31 2019 +0000
@@ -32,7 +32,7 @@
 
 #define        xfree(a)        { if ((a) != NULL) { free((void *) (a)); (a) = NULL; } }
 
-#define        NN(p)   ((p) ? (p) : "(null)")  /* guaranteed non-null for dprintf 
+#define        NN(p)   ((p) ? (p) : "(null)")  /* guaranteed non-null for dprintf
 */
 #define        DEBUG
 #ifdef DEBUG
@@ -155,7 +155,7 @@
 #define CCOPY  6
 #define CCON   5
 #define CTEMP  4
-#define CNAME  3 
+#define CNAME  3
 #define CVAR   2
 #define CFLD   1
 #define        CUNK    0
diff -r 9de2ac0e68f1 -r 47739a64b078 external/historical/nawk/dist/b.c
--- a/external/historical/nawk/dist/b.c Sun Aug 04 19:09:16 2019 +0000
+++ b/external/historical/nawk/dist/b.c Sun Aug 04 19:19:31 2019 +0000
@@ -31,6 +31,7 @@
 #define        DEBUG
 
 #include <ctype.h>
+#include <limits.h>
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>
@@ -220,7 +221,7 @@
        f->curstat = 2;
        f->out[2] = 0;
        k = *(f->re[0].lfollow);
-       xfree(f->posns[2]);                     
+       xfree(f->posns[2]);
        if ((f->posns[2] = calloc(1, (k+1)*sizeof(int))) == NULL)
                overflo("out of space in makeinit");
        for (i=0; i <= k; i++) {
@@ -333,6 +334,10 @@
                c = '\r';
        else if (c == 'b')
                c = '\b';
+       else if (c == 'v')
+               c = '\v';
+       else if (c == 'a')
+               c = '\a';
        else if (c == '\\')
                c = '\\';
        else if (c == 'x') {    /* hexadecimal goo follows */
@@ -649,9 +654,9 @@
  * RETURN VALUES
  *     0    No match found.
  *     1    Match found.
- */  
+ */
 
-int fnematch(fa *pfa, FILE *f, uschar **pbuf, int *pbufsize, int quantum)      
+int fnematch(fa *pfa, FILE *f, uschar **pbuf, int *pbufsize, int quantum)
 {
        uschar *buf = *pbuf;
        int bufsize = *pbufsize;
@@ -676,7 +681,7 @@
                        if (++j == k) {
                                if (k == bufsize)
                                        if (!adjbuf(&buf, &bufsize, bufsize+1, quantum, 0, "fnematch"))
-                                               FATAL("stream '%.30s...' too long", buf);       
+                                               FATAL("stream '%.30s...' too long", buf);
                                buf[k++] = (c = getc(f)) != EOF ? c : 0;
                        }
                        c = buf[j];
@@ -716,7 +721,7 @@
                 */
                do
                        if (buf[--k] && ungetc(buf[k], f) == EOF)
-                               FATAL("unable to ungetc '%c'", buf[k]); 
+                               FATAL("unable to ungetc '%c'", buf[k]);
                while (k > i + patlen);
                buf[k] = 0;
                return 1;
@@ -905,8 +910,8 @@
        uschar *buf = 0;
        int ret = 1;
        int init_q = (firstnum==0);             /* first added char will be ? */
-       int n_q_reps = secondnum-firstnum;      /* m>n, so reduce until {1,m-n} left  */ 
-       int prefix_length = reptok - basestr;   /* prefix includes first rep    */ 
+       int n_q_reps = secondnum-firstnum;      /* m>n, so reduce until {1,m-n} left  */
+       int prefix_length = reptok - basestr;   /* prefix includes first rep    */
        int suffix_length = strlen(reptok) - reptoklen; /* string after rep specifier   */
        int size = prefix_length +  suffix_length;
 
@@ -924,7 +929,7 @@
        }
        if ((buf = (uschar *) malloc(size+1)) == NULL)
                FATAL("out of space in reg expr %.10s..", lastre);
-       memcpy(buf, basestr, prefix_length);    /* copy prefix  */ 
+       memcpy(buf, basestr, prefix_length);    /* copy prefix  */
        j = prefix_length;
        if (special_case == REPEAT_ZERO) {
                j -= atomlen;
@@ -978,26 +983,28 @@
        if (secondnum < 0) {    /* means {n,} -> repeat n-1 times followed by PLUS */
                if (firstnum < 2) {
                        /* 0 or 1: should be handled before you get here */
+                       FATAL("internal error");
                } else {
-                       return replace_repeat(reptok, reptoklen, atom, atomlen, 
+                       return replace_repeat(reptok, reptoklen, atom, atomlen,
                                firstnum, secondnum, REPEAT_PLUS_APPENDED);



Home | Main Index | Thread Index | Old Index