summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorOliver Kiddle <opk@users.sourceforge.net>2002-09-16 18:24:47 +0000
committerOliver Kiddle <opk@users.sourceforge.net>2002-09-16 18:24:47 +0000
commit49bfbc12483602937380658d67acd6c009d39159 (patch)
treecf2282ca6fe16d5e808295c2d9df3a3342f3a19f /Src
parent770d437504dccda11a883da28d35adc09862f17d (diff)
downloadzsh-49bfbc12483602937380658d67acd6c009d39159.tar.gz
zsh-49bfbc12483602937380658d67acd6c009d39159.tar.xz
zsh-49bfbc12483602937380658d67acd6c009d39159.zip
17678: ignore initial `--' argument to printf to satisfy POSIX
Diffstat (limited to 'Src')
-rw-r--r--Src/builtin.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index c3951c77f..36b780e8c 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -3019,9 +3019,13 @@ bin_print(char *name, char **args, Options ops, int func)
     zulong zulongval;
     char *stringval;
     
-    if (func == BIN_PRINTF)
-	fmt = *args++;
-    else if (func == BIN_ECHO && isset(BSDECHO))
+    if (func == BIN_PRINTF) {
+        if (!strcmp(*args, "--") && !*++args) {
+            zwarnnam(name, "not enough arguments", NULL, 0);
+	    return 1;
+        }
+  	fmt = *args++;
+    } else if (func == BIN_ECHO && isset(BSDECHO))
 	ops->ind['E'] = 1;
     else if (OPT_HASARG(ops,'f'))
 	fmt = OPT_ARG(ops,'f');