aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog13
-rw-r--r--builtin.c9
2 files changed, 17 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index a1f59dab..887f8570 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,9 +1,14 @@
2013-02-06 Arnold D. Robbins <arnold@skeeve.com>
+ * builtin.c (printf_common): Move nargs > 0 check into assert.
+ (do_sprintf): Add nargs check and fatal message to here.
+
+2013-02-04 Arnold D. Robbins <arnold@skeeve.com>
+
* main.c (main): Remove undocumented -m option which was for
compatibility with BWK awk. His awk dropped it back in 2007.
-2013-02-04 Arnold D. Robbins <arnold@skeeve.com>
+2013-01-31 Arnold D. Robbins <arnold@skeeve.com>
* regcomp.c, regex.c, regex_internal.c, regexec.c: Update
copyright years to sync with GLIBC.
@@ -16,19 +21,25 @@
(clean_state_log_if_needed): Likewise.
(get_subexp): Likewise.`
+<<<<<<< HEAD
2013-02-03 Arnold D. Robbins <arnold@skeeve.com>
* configure.ac: Add Automake test for cross compiling.
+=======
+>>>>>>> gawk-4.0-stable
2013-01-31 Arnold D. Robbins <arnold@skeeve.com>
* dfa.c: Include "dfa.h" which includes regex.h after limits.h
so that RE_DUP_MAX gets the correct value. Especially needed on
OpenVMS. Thanks to Anders Wallin.
+<<<<<<< HEAD
* main.c (version): Print out API version numbers if DYNAMIC.
Helpful also for knowing if to run the shlib tests.
* configure: Regenerated after change in m4/readline.m4.
+=======
+>>>>>>> gawk-4.0-stable
2013-01-31 Arnold D. Robbins <arnold@skeeve.com>
diff --git a/builtin.c b/builtin.c
index 2db769dc..73272126 100644
--- a/builtin.c
+++ b/builtin.c
@@ -1582,10 +1582,7 @@ printf_common(int nargs)
int i;
NODE *r, *tmp;
- if (nargs == 0)
- fatal(_("[s]printf called with no arguments"));
-
- assert(nargs <= max_args);
+ assert(nargs > 0 && nargs <= max_args);
for (i = 1; i <= nargs; i++) {
tmp = args_array[nargs - i] = POP();
if (tmp->type == Node_var_array) {
@@ -1608,6 +1605,10 @@ NODE *
do_sprintf(int nargs)
{
NODE *r;
+
+ if (nargs == 0)
+ fatal(_("sprintf: no arguments"));
+
r = printf_common(nargs);
if (r == NULL)
gawk_exit(EXIT_FATAL);