This diff updates awk to the 20121220 upstream version, with a few
fixups.

ok?

Index: FIXES
===================================================================
RCS file: /cvs/src/usr.bin/awk/FIXES,v
retrieving revision 1.16
diff -u -p -r1.16 FIXES
--- FIXES       28 Sep 2011 19:27:18 -0000      1.16
+++ FIXES       22 Jun 2013 21:58:34 -0000
@@ -26,6 +26,22 @@ THIS SOFTWARE.
 This file lists all bug fixes, changes, etc., made since the AWK book
 was sent to the printers in August, 1987.
 
+Dec 20, 2012:
+       fiddled makefile to get correct yacc and bison flags.  pick yacc
+       (linux) or bison (mac) as necessary.
+
+       added  __attribute__((__noreturn__)) to a couple of lines in
+       proto.h, to silence someone's enthusiastic checker.
+
+       fixed obscure call by value bug in split(a[1],a) reported on
+       9fans.  the management of temporary values is just a mess; i
+       took a shortcut by making an extra string copy.  thanks
+       to paul patience and arnold robbins for passing it on and for
+       proposed patches.
+
+       tiny fiddle in setfval to eliminate -0 results in T.expr, which
+       has irritated me for 20+ years.
+
 Aug 10, 2011:
        another fix to avoid core dump with delete(ARGV); again, many thanks
        to ruslan ermilov.
Index: main.c
===================================================================
RCS file: /cvs/src/usr.bin/awk/main.c,v
retrieving revision 1.17
diff -u -p -r1.17 main.c
--- main.c      28 Sep 2011 19:27:18 -0000      1.17
+++ main.c      22 Jun 2013 21:52:59 -0000
@@ -23,7 +23,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE
 THIS SOFTWARE.
 ****************************************************************/
 
-const char     *version = "version 20110810";
+const char     *version = "version 20121220";
 
 #define DEBUG
 #include <stdio.h>
Index: proto.h
===================================================================
RCS file: /cvs/src/usr.bin/awk/proto.h,v
retrieving revision 1.9
diff -u -p -r1.9 proto.h
--- proto.h     28 Sep 2011 19:27:18 -0000      1.9
+++ proto.h     22 Jun 2013 21:36:31 -0000
@@ -47,7 +47,7 @@ extern        void    freetr(Node *);
 extern int     hexstr(uschar **);
 extern int     quoted(uschar **);
 extern char    *cclenter(const char *);
-extern void    overflo(const char *);
+extern void    overflo(const char *) __dead;
 extern void    cfoll(fa *, Node *);
 extern int     first(Node *);
 extern void    follow(Node *);
@@ -133,7 +133,7 @@ extern      void    fpecatch(int);
 extern void    bracecheck(void);
 extern void    bcheck2(int, int, int);
 extern void    SYNTAX(const char *, ...);
-extern void    FATAL(const char *, ...);
+extern void    FATAL(const char *, ...) __dead;
 extern void    WARNING(const char *, ...);
 extern void    error(void);
 extern void    eprint(void);
Index: run.c
===================================================================
RCS file: /cvs/src/usr.bin/awk/run.c,v
retrieving revision 1.33
diff -u -p -r1.33 run.c
--- run.c       28 Sep 2011 19:27:18 -0000      1.33
+++ run.c       22 Jun 2013 21:52:29 -0000
@@ -1218,13 +1218,13 @@ Cell *dopa2(Node **a, int n)    /* a[0], a[
 Cell *split(Node **a, int nnn) /* split(a[0], a[1], a[2]); a[3] is type */
 {
        Cell *x = 0, *y, *ap;
-       char *s;
+       char *s, *origs;
        int sep;
        char *t, temp, num[50], *fs = 0;
        int n, tempstat, arg3type;
 
        y = execute(a[0]);      /* source string */
-       s = getsval(y);
+       origs = s = strdup(getsval(y));
        arg3type = ptoi(a[3]);
        if (a[2] == 0)          /* fs string */
                fs = *FS;
@@ -1344,6 +1344,7 @@ Cell *split(Node **a, int nnn)    /* split(
        }
        tempfree(ap);
        tempfree(y);
+       free(origs);
        if (a[2] != 0 && arg3type == STRING) {
                tempfree(x);
        }
Index: tran.c
===================================================================
RCS file: /cvs/src/usr.bin/awk/tran.c,v
retrieving revision 1.15
diff -u -p -r1.15 tran.c
--- tran.c      28 Sep 2011 19:27:18 -0000      1.15
+++ tran.c      22 Jun 2013 21:47:01 -0000
@@ -299,6 +299,8 @@ Awkfloat setfval(Cell *vp, Awkfloat f)      /
                xfree(vp->sval); /* free any previous string */
        vp->tval &= ~STR;       /* mark string invalid */
        vp->tval |= NUM;        /* mark number ok */
+       if (f == -0)  /* who would have thought this possible? */
+               f = 0;
           dprintf( ("setfval %p: %s = %g, t=%o\n", (void*)vp, NN(vp->nval), f, 
vp->tval) );
        return vp->fval = f;
 }

Reply via email to