about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorAndrew Main <zefram@users.sourceforge.net>2000-07-30 19:18:13 +0000
committerAndrew Main <zefram@users.sourceforge.net>2000-07-30 19:18:13 +0000
commit84b04a8728ec1e618b6feb508a12de460fe13428 (patch)
tree1362c72c67296818ed50d71561c986c935e923cf /Src
parent9743c19d618056b3af1f5efe887a1e8a9944e27b (diff)
downloadzsh-84b04a8728ec1e618b6feb508a12de460fe13428.tar.gz
zsh-84b04a8728ec1e618b6feb508a12de460fe13428.tar.xz
zsh-84b04a8728ec1e618b6feb508a12de460fe13428.zip
12436: Doc/Zsh/invoke.yo, Src/init.c: Make -b behave like
the csh -b, permitting more options to be stacked after it and
take effect.  Make -b take effect depending on SH_OPTION_LETTERS,
consistent with all the other single-letter options, rather than
having a clashing check of emulation type.
Diffstat (limited to 'Src')
-rw-r--r--Src/init.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/Src/init.c b/Src/init.c
index 04ed141dd..d0140a525 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -186,10 +186,10 @@ static int restricted;
 void
 parseargs(char **argv)
 {
+    int optionbreak = 0;
     char **x;
     int action, optno;
     LinkList paramlist;
-    int bourne = (emulation == EMULATE_KSH || emulation == EMULATE_SH);
 
     argzero = *argv++;
     SHIN = 0;
@@ -206,17 +206,15 @@ parseargs(char **argv)
     opts[SINGLECOMMAND] = 0;
 
     /* loop through command line options (begins with "-" or "+") */
-    while (*argv && (**argv == '-' || **argv == '+')) {
+    while (!optionbreak && *argv && (**argv == '-' || **argv == '+')) {
 	char *args = *argv;
 	action = (**argv == '-');
 	if (!argv[0][1])
 	    *argv = "--";
 	while (*++*argv) {
-	    /* The pseudo-option `--' signifies the end of options. *
-	     * `-b' does too, csh-style, unless we're emulating a   *
-	     * Bourne style shell.                                  */
-	    if (**argv == '-' || (!bourne && **argv == 'b')) {
+	    if (**argv == '-') {
 		if(!argv[0][1]) {
+		    /* The pseudo-option `--' signifies the end of options. */
 		    argv++;
 		    goto doneoptions;
 		}
@@ -240,7 +238,11 @@ parseargs(char **argv)
 		goto longoptions;
 	    }
 
-	    if (**argv == 'c') {         /* -c command */
+	    if (unset(SHOPTIONLETTERS) && **argv == 'b') {
+		/* -b ends options at the end of this argument */
+		optionbreak = 1;
+	    } else if (**argv == 'c') {
+		/* -c command */
 		cmd = *argv;
 		opts[INTERACTIVE] &= 1;
 		opts[SHINSTDIN] = 0;
@@ -321,13 +323,11 @@ parseargs(char **argv)
 static void
 printhelp(void)
 {
-    int bourne = (emulation == EMULATE_KSH || emulation == EMULATE_SH);
-
     printf("Usage: %s [<options>] [<argument> ...]\n", argzero);
     printf("\nSpecial options:\n");
     printf("  --help     show this message, then exit\n");
     printf("  --version  show zsh version number, then exit\n");
-    if(!bourne)
+    if(unset(SHOPTIONLETTERS))
 	printf("  -b         end option processing, like --\n");
     printf("  -c         take first argument as a command to execute\n");
     printf("  -o OPTION  set an option by name (see below)\n");