gawk-diffs
[Top][All Lists]
Advanced

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

[gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-904


From: Arnold Robbins
Subject: [gawk-diffs] [SCM] gawk branch, gawk-4.1-stable, updated. gawk-4.1.0-904-g9867841
Date: Wed, 1 Jun 2016 15:39:21 +0000 (UTC)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, gawk-4.1-stable has been updated
       via  9867841a4767347cd89c9fd0127db3c7eaf943e6 (commit)
       via  88c6afdf1c83a7ea51225fbb173d910533c51bb0 (commit)
      from  c74913824e580aa909f6e53346401d198314d6a6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=9867841a4767347cd89c9fd0127db3c7eaf943e6

commit 9867841a4767347cd89c9fd0127db3c7eaf943e6
Author: Arnold D. Robbins <address@hidden>
Date:   Wed Jun 1 11:38:52 2016 -0400

    Disallow negative hex numbers in input data.

diff --git a/ChangeLog b/ChangeLog
index 9c9d87b..7c42d77 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,9 @@
        * nonposix.h (getpgrp): Wrap declaration in ifdef so it doesn't
        mess things up on POSIX systems (like Solaris). Thanks to
        Nelson Beebe for the report.
+       * node.c (is_hex): New function to check for 0x preceded by
+       optional sign.
+       (r_force_number): Use it. Thanks to Mike Brennan for the report.
 
 2016-05-30         Arnold D. Robbins     <address@hidden>
 
diff --git a/node.c b/node.c
index a7c19db..23199c5 100644
--- a/node.c
+++ b/node.c
@@ -38,6 +38,20 @@ NODE *(*str2number)(NODE *) = r_force_number;
 NODE *(*format_val)(const char *, int, NODE *) = r_format_val;
 int (*cmp_numbers)(const NODE *, const NODE *) = cmp_awknums;
 
+/* is_hex --- return true if a string looks like a hex value */
+
+static bool
+is_hex(const char *str)
+{
+       if (*str == '-' || *str == '+')
+               str++;
+
+       if (str[0] == '0' && (str[1] == 'x' || str[1] == 'X'))
+               return true;
+
+       return false;
+}
+
 /* force_number --- force a value to be numeric */
 
 NODE *
@@ -96,8 +110,7 @@ r_force_number(NODE *n)
            || (! do_posix              /* not POSIXLY paranoid and */
                && (is_alpha((unsigned char) *cp)       /* letter, or */
                                        /* CANNOT do non-decimal and saw 0x */
-                   || (! do_non_decimal_data && cp[0] == '0'
-                       && (cp[1] == 'x' || cp[1] == 'X'))))) {
+                   || (! do_non_decimal_data && is_hex(cp))))) {
                return n;
        }
 
diff --git a/test/ChangeLog b/test/ChangeLog
index 2e1090c..02f083d 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,8 @@
+2016-06-01         Arnold D. Robbins     <address@hidden>
+
+       * Makefile.am (hex2): New test.
+       * hex2.awk, hex2.in, hex2.ok: New files.
+
 2016-05-30         Arnold D. Robbins     <address@hidden>
 
        * Makefile.am (fsnul1): New test.
diff --git a/test/Makefile.am b/test/Makefile.am
index 92e8f6e..7cd37fd 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -420,6 +420,9 @@ EXTRA_DIST = \
        hello.awk \
        hex.awk \
        hex.ok \
+       hex2.awk \
+       hex2.in \
+       hex2.ok \
        hsprint.awk \
        hsprint.ok \
        icasefs.awk \
@@ -1064,7 +1067,7 @@ BASIC_TESTS = \
        getline getline2 getline3 getline4 getline5 getlnbuf getnr2tb getnr2tm \
        gsubasgn gsubtest gsubtst2 gsubtst3 gsubtst4 gsubtst5 gsubtst6 \
        gsubtst7 gsubtst8 \
-       hex hsprint \
+       hex hex2 hsprint \
        inpref inputred intest intprec iobug1 \
        leaddig leadnl litoct longsub longwrds \
        manglprm math membug1 messages minusstr mmap8k mtchi18n \
diff --git a/test/Makefile.in b/test/Makefile.in
index 34656ec..23f50af 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -677,6 +677,9 @@ EXTRA_DIST = \
        hello.awk \
        hex.awk \
        hex.ok \
+       hex2.awk \
+       hex2.in \
+       hex2.ok \
        hsprint.awk \
        hsprint.ok \
        icasefs.awk \
@@ -1320,7 +1323,7 @@ BASIC_TESTS = \
        getline getline2 getline3 getline4 getline5 getlnbuf getnr2tb getnr2tm \
        gsubasgn gsubtest gsubtst2 gsubtst3 gsubtst4 gsubtst5 gsubtst6 \
        gsubtst7 gsubtst8 \
-       hex hsprint \
+       hex hex2 hsprint \
        inpref inputred intest intprec iobug1 \
        leaddig leadnl litoct longsub longwrds \
        manglprm math membug1 messages minusstr mmap8k mtchi18n \
@@ -3011,6 +3014,11 @@ hex:
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
 
+hex2:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  < 
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
 hsprint:
        @echo $@
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index e5bde1d..c7b125c 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -415,6 +415,11 @@ hex:
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
        @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
 
+hex2:
+       @echo $@
+       @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  < 
"$(srcdir)"/address@hidden >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+       @-$(CMP) "$(srcdir)"/address@hidden _$@ && rm -f _$@
+
 hsprint:
        @echo $@
        @AWKPATH="$(srcdir)" $(AWK) -f address@hidden  >_$@ 2>&1 || echo EXIT 
CODE: $$? >>_$@
diff --git a/test/hex2.awk b/test/hex2.awk
new file mode 100644
index 0000000..49c6203
--- /dev/null
+++ b/test/hex2.awk
@@ -0,0 +1 @@
+{ print $1 + 7}
diff --git a/test/hex2.in b/test/hex2.in
new file mode 100644
index 0000000..60f06f0
--- /dev/null
+++ b/test/hex2.in
@@ -0,0 +1,2 @@
+0x4
+-0x4
diff --git a/test/hex2.ok b/test/hex2.ok
new file mode 100644
index 0000000..49019db
--- /dev/null
+++ b/test/hex2.ok
@@ -0,0 +1,2 @@
+7
+7

http://git.sv.gnu.org/cgit/gawk.git/commit/?id=88c6afdf1c83a7ea51225fbb173d910533c51bb0

commit 88c6afdf1c83a7ea51225fbb173d910533c51bb0
Author: Arnold D. Robbins <address@hidden>
Date:   Wed Jun 1 11:28:15 2016 -0400

    Keep nonposix.h from bothering things on POSIX systems.

diff --git a/ChangeLog b/ChangeLog
index 3e2d8d2..9c9d87b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2016-06-01         Arnold D. Robbins     <address@hidden>
+
+       * nonposix.h (getpgrp): Wrap declaration in ifdef so it doesn't
+       mess things up on POSIX systems (like Solaris). Thanks to
+       Nelson Beebe for the report.
+
 2016-05-30         Arnold D. Robbins     <address@hidden>
 
        * main.c (arg_assign): Fully bracket ifdefs around call
diff --git a/nonposix.h b/nonposix.h
index 3a0510b..3aae512 100644
--- a/nonposix.h
+++ b/nonposix.h
@@ -57,7 +57,9 @@ int unsetenv (const char *);
 int setenv (const char *, const char *, int);
 #endif /* __MINGW32__ */
 
+#if defined(VMS) || defined(__DJGPP__) || defined(__MINGW32__)
 int getpgrp(void);
+#endif
 
 #if defined(__DJGPP__) || defined(__MINGW32__)
 int getppid(void);

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                  |    9 +++++++++
 node.c                     |   17 +++++++++++++++--
 nonposix.h                 |    2 ++
 test/ChangeLog             |    5 +++++
 test/Makefile.am           |    5 ++++-
 test/Makefile.in           |   10 +++++++++-
 test/Maketests             |    5 +++++
 test/hex2.awk              |    1 +
 test/hex2.in               |    2 ++
 test/{regeq.ok => hex2.ok} |    2 +-
 10 files changed, 53 insertions(+), 5 deletions(-)
 create mode 100644 test/hex2.awk
 create mode 100644 test/hex2.in
 copy test/{regeq.ok => hex2.ok} (50%)


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]