about summary refs log tree commit diff
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
parent770d437504dccda11a883da28d35adc09862f17d (diff)
downloadzsh-49bfbc12483602937380658d67acd6c009d39159.tar.gz
zsh-49bfbc12483602937380658d67acd6c009d39159.tar.xz
zsh-49bfbc12483602937380658d67acd6c009d39159.zip
17678: ignore initial `--' argument to printf to satisfy POSIX
-rw-r--r--ChangeLog5
-rw-r--r--Src/builtin.c10
2 files changed, 11 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 009fecc55..ae372dfab 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,9 @@
 2002-09-16  Oliver Kiddle  <opk@zsh.org>
 
-	* Completion/Zsh/Command/_typeset, Doc/Zsh/builtins.yo:
+	* 17678: Src/builtin.c: ignore initial `--' argument to printf
+	to satisfy POSIX.
+
+	* 17682: Completion/Zsh/Command/_typeset, Doc/Zsh/builtins.yo:
 	add support for -H and -p options to completion
 
 	* 17542 (Thomas Stromberg <thomas@stromberg.org>):
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');