summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2015-03-27 06:06:04 +0300
committerArnold D. Robbins <arnold@skeeve.com>2015-03-27 06:06:04 +0300
commitbc1c92f4a9365f799c9c7a78b41a4eb1c40326b7 (patch)
treeb14bd67f533d7cc508241179de1283391fb0971c
parent6522e5b623e083565229dc742336219a0dda1344 (diff)
parent7377dd1648a06b68f45c55fd54e07e6bcf29e66c (diff)
downloadgawk-bc1c92f4a9365f799c9c7a78b41a4eb1c40326b7.tar.gz
Merge branch 'master' into select
-rw-r--r--ChangeLog5
-rw-r--r--interpret.h19
-rw-r--r--test/ChangeLog6
-rw-r--r--test/Makefile.am4
-rw-r--r--test/Makefile.in9
-rw-r--r--test/Maketests5
-rw-r--r--test/exitval3.awk2
-rw-r--r--test/exitval3.ok1
8 files changed, 40 insertions, 11 deletions
diff --git a/ChangeLog b/ChangeLog
index 468875fb..ae1a846a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-03-24 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * interpret.h (r_interpret): When Op_K_exit has an argument of
+ Nnull_string, do not update exit_val, since no value was supplied.
+
2015-03-24 Arnold D. Robbins <arnold@skeeve.com>
* awk.h, gawkapi.c, io.c: Minor code reformatting.
diff --git a/interpret.h b/interpret.h
index 3a9cab37..dee53957 100644
--- a/interpret.h
+++ b/interpret.h
@@ -1313,17 +1313,18 @@ match_re:
fatal(_("`exit' cannot be called in the current context"));
exiting = true;
- t1 = POP_NUMBER();
- exit_val = (int) get_number_si(t1);
- DEREF(t1);
+ if ((t1 = POP_NUMBER()) != Nnull_string) {
+ exit_val = (int) get_number_si(t1);
#ifdef VMS
- if (exit_val == 0)
- exit_val = EXIT_SUCCESS;
- else if (exit_val == 1)
- exit_val = EXIT_FAILURE;
- /* else
- just pass anything else on through */
+ if (exit_val == 0)
+ exit_val = EXIT_SUCCESS;
+ else if (exit_val == 1)
+ exit_val = EXIT_FAILURE;
+ /* else
+ just pass anything else on through */
#endif
+ }
+ DEREF(t1);
if (currule == BEGINFILE || currule == ENDFILE) {
diff --git a/test/ChangeLog b/test/ChangeLog
index 69b5b60d..106a88d5 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,9 @@
+2015-03-24 Andrew J. Schorr <aschorr@telemetry-investments.com>
+
+ * Makefile.am (EXTRA_DIST): Add exitval3.awk and exitval3.ok.
+ (BASIC_TESTS): Add new test exitval3.
+ * exitval3.awk, exitval3.ok: New files.
+
2015-03-17 Andrew J. Schorr <aschorr@telemetry-investments.com>
* inplace1.ok, inplace2.ok, inplace3.ok: Update error message line
diff --git a/test/Makefile.am b/test/Makefile.am
index 2d3e353d..fe06de7a 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -226,6 +226,8 @@ EXTRA_DIST = \
exitval2.awk \
exitval2.ok \
exitval2.w32 \
+ exitval3.awk \
+ exitval3.ok \
fcall_exit.awk \
fcall_exit.ok \
fcall_exit2.awk \
@@ -1020,7 +1022,7 @@ BASIC_TESTS = \
callparam childin clobber closebad clsflnam compare compare2 concat1 concat2 \
concat3 concat4 convfmt \
datanonl defref delargv delarpm2 delarprm delfunc dfamb1 dfastress dynlj \
- eofsplit exit2 exitval1 exitval2 \
+ eofsplit exit2 exitval1 exitval2 exitval3 \
fcall_exit fcall_exit2 fldchg fldchgnf fnamedat fnarray fnarray2 \
fnaryscl fnasgnm fnmisc fordel forref forsimp fsbs fsrs fsspcoln \
fstabplus funsemnl funsmnam funstack \
diff --git a/test/Makefile.in b/test/Makefile.in
index 5a3f5b0d..fa3598a5 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -483,6 +483,8 @@ EXTRA_DIST = \
exitval2.awk \
exitval2.ok \
exitval2.w32 \
+ exitval3.awk \
+ exitval3.ok \
fcall_exit.awk \
fcall_exit.ok \
fcall_exit2.awk \
@@ -1276,7 +1278,7 @@ BASIC_TESTS = \
callparam childin clobber closebad clsflnam compare compare2 concat1 concat2 \
concat3 concat4 convfmt \
datanonl defref delargv delarpm2 delarprm delfunc dfamb1 dfastress dynlj \
- eofsplit exit2 exitval1 exitval2 \
+ eofsplit exit2 exitval1 exitval2 exitval3 \
fcall_exit fcall_exit2 fldchg fldchgnf fnamedat fnarray fnarray2 \
fnaryscl fnasgnm fnmisc fordel forref forsimp fsbs fsrs fsspcoln \
fstabplus funsemnl funsmnam funstack \
@@ -2755,6 +2757,11 @@ exitval2:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+exitval3:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
fcall_exit:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/Maketests b/test/Maketests
index 703e91e1..f3d048ed 100644
--- a/test/Maketests
+++ b/test/Maketests
@@ -230,6 +230,11 @@ exitval2:
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
@-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+exitval3:
+ @echo $@
+ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
+ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@
+
fcall_exit:
@echo $@
@AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@
diff --git a/test/exitval3.awk b/test/exitval3.awk
new file mode 100644
index 00000000..33e8c433
--- /dev/null
+++ b/test/exitval3.awk
@@ -0,0 +1,2 @@
+BEGIN { exit 42 }
+END { exit }
diff --git a/test/exitval3.ok b/test/exitval3.ok
new file mode 100644
index 00000000..20f64b8c
--- /dev/null
+++ b/test/exitval3.ok
@@ -0,0 +1 @@
+EXIT CODE: 42