about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2007-12-12 13:46:35 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2007-12-12 13:46:35 +0000
commit765f73823ec2aca73bc64db25d28d28df8d13e04 (patch)
treeff054ac2057ec4b9e05b088dbe582decfa5110ad
parent2214e05722e017acda5779db4a48d801d19a9189 (diff)
downloadzsh-765f73823ec2aca73bc64db25d28d28df8d13e04.tar.gz
zsh-765f73823ec2aca73bc64db25d28d28df8d13e04.tar.xz
zsh-765f73823ec2aca73bc64db25d28d28df8d13e04.zip
users/12305: option output not well documented
-c and SHIN_STDIN inconsistent with manual
-rw-r--r--ChangeLog6
-rw-r--r--Doc/Zsh/builtins.yo22
-rw-r--r--Src/init.c3
-rw-r--r--Test/A01grammar.ztst2
4 files changed, 27 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index 52393d571..b33d2f3a3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2007-12-12  Peter Stephenson  <pws@csr.com>
+
+	* users/12305: Doc/Zsh/builtins.yo, Src/init.c,
+	Test/A01grammar.ztst: option output wasn't well described;
+	"-c" is documented not to set SHIN_STDIN, so don't.
+
 2007-12-11  Clint Adams  <clint@zsh.org>
 
 	* unposted: Completion/Debian/Command/.distfiles: update.
diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo
index acdb83d92..204b29cf7 100644
--- a/Doc/Zsh/builtins.yo
+++ b/Doc/Zsh/builtins.yo
@@ -1137,7 +1137,8 @@ sort arguments in descending order.  For the meaning of the other flags, see
 ifzman(zmanref(zshoptions))\
 ifnzman(noderef(Options))\
 .  Flags may be specified by name using the tt(-o) option. If no option
-name is supplied with tt(-o), the current option states are printed.
+name is supplied with tt(-o), the current option states are printed:  see
+the description of tt(setopt) below for more information on the format.
 With tt(PLUS()o) they are printed in a form that can be used as input
 to the shell.
 
@@ -1180,8 +1181,23 @@ cindex(options, setting)
 item(tt(setopt) [ {tt(PLUS())|tt(-)}var(options) | \
 {tt(PLUS())|tt(-)}tt(o) var(option_name) ] [ var(name) ... ])(
 Set the options for the shell.  All options specified either
-with flags or by name are set.  If no arguments are supplied,
-the names of all options currently set are printed.
+with flags or by name are set.
+
+If no arguments are supplied, the names of all options currently set are
+printed.  The form is chosen so as to minimize the differences from the
+default options for the current emulation (the default emulation being
+native tt(zsh), shown as tt(<Z>) in
+ifzman(zmanref(zshoptions))\
+ifnzman(noderef(Description of Options))).
+Options that are on by default for the emulation are
+shown with the prefix tt(no) only if they are off, while other options are
+shown without the prefix tt(no) and only if they are on.  In addition to
+options changed from the default state by the user, any options activated
+automatically by the shell (for example, tt(SHIN_STDIN) or tt(INTERACTIVE))
+will be shown in the list.  The format is further modified by the option
+tt(KSH_OPTION_PRINT), however the rationale for choosing options with
+or without the tt(no) prefix remains the same in this case.
+
 If the tt(-m) flag is given the arguments are taken as patterns
 (which should be quoted to protect them from filename expansion), and all
 options with names matching these patterns are set.
diff --git a/Src/init.c b/Src/init.c
index bd582ad2b..a653de7de 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -272,7 +272,6 @@ parseargs(char **argv)
 		/* -c command */
 		cmd = *argv;
 		opts[INTERACTIVE] &= 1;
-		opts[SHINSTDIN] = 0;
 		scriptname = ztrdup("zsh");
 	    } else if (**argv == 'o') {
 		if (!*++*argv)
@@ -334,7 +333,7 @@ parseargs(char **argv)
 	}
 	while (*argv)
 	    zaddlinknode(paramlist, ztrdup(*argv++));
-    } else
+    } else if (!cmd)
 	opts[SHINSTDIN] = 1;
     if(isset(SINGLECOMMAND))
 	opts[INTERACTIVE] &= 1;
diff --git a/Test/A01grammar.ztst b/Test/A01grammar.ztst
index 41cbe6d8b..93a1ecb8c 100644
--- a/Test/A01grammar.ztst
+++ b/Test/A01grammar.ztst
@@ -490,7 +490,7 @@
 
   $ZTST_testdir/../Src/zsh -f -c "'"
 1:Parse error on inline command causes non-zero exit status
-?zsh: unmatched '
+?zsh:1: unmatched '
 
   $ZTST_testdir/../Src/zsh -f NonExistentScript
 127q:Non-existent script causes exit status 127