zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: printf --
@ 2002-09-16 11:44 Oliver Kiddle
  0 siblings, 0 replies; only message in thread
From: Oliver Kiddle @ 2002-09-16 11:44 UTC (permalink / raw)
  To: Zsh workers

Reluctantly, I here add removal of an inital `--' to printf to satisfy
POSIX.

Except for cd, command (which we knew anyway) and possibly ulimit, I
think we have it right for other standard commands. I'm not sure in the
case of fg, bg and wait. If my understanding of the POSIX standard is
correct, the builtins which should not ignore an initial `--' are:
break, dot, eval, shift, exec, exit, return, test/[ and continue. Zsh
gets all these right. Also, having noticed that `ARGV0=whatever exec
command' is clever enough to change the command name for the command
and not for exec, I don't think we should follow bash and ksh93 in
giving exec arguments. Though zsh can't easily do the -c functionality
which passes an empty environment.

--- Src/builtin.c	2002-08-28 08:22:23.000000000 +0100
+++ Src/builtin.c	2002-09-15 18:52:11.000000000 +0100
@@ -3024,9 +3024,15 @@
     zulong zulongval;
     char *stringval;
     
-    if (func == BIN_PRINTF)
+    if (func == BIN_PRINTF) {
+	if (!strcmp(*args, "--")) {
+	  if (!*++args) {
+	    zwarnnam(name, "not enough arguments", NULL, 0);
+	    return 1;
+          }
+	}
 	fmt = *args++;
-    else if (OPT_HASARG(ops,'f'))
+    } else if (OPT_HASARG(ops,'f'))
 	fmt = OPT_ARG(ops,'f');
     if (fmt)
 	fmt = getkeystring(fmt, &flen, OPT_ISSET(ops,'b') ? 2 : 0, &nnl);

This e-mail and any attachment is for authorised use by the intended recipient(s) only.  It may contain proprietary material, confidential information and/or be subject to legal privilege.  It should not be copied, disclosed to, retained or used by, any other party.  If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender.  Thank you.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-09-16 11:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-09-16 11:44 PATCH: printf -- Oliver Kiddle

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).