aboutsummaryrefslogtreecommitdiffstats
path: root/builtin.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin.c')
-rw-r--r--builtin.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/builtin.c b/builtin.c
index db51dbdc..62b6b2f3 100644
--- a/builtin.c
+++ b/builtin.c
@@ -1392,10 +1392,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) {
@@ -1418,6 +1415,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);