zsh-workers
 help / color / mirror / code / Atom feed
* a way to get the value of the -c option
@ 2015-12-03 11:54 Vincent Lefevre
  2015-12-03 12:45 ` Peter Stephenson
  2015-12-03 14:36 ` Nikolay Aleksandrovich Pavlov (ZyX)
  0 siblings, 2 replies; 10+ messages in thread
From: Vincent Lefevre @ 2015-12-03 11:54 UTC (permalink / raw)
  To: zsh-workers

zsh should provide a way to get the value of the -c option. Under
Linux, one can look at /proc/$$/cmdline, but I think that it would
be better to get this information in an OS-independent way.

This would be useful for .zshenv to know the context, for instance, as
a user of OpenSSH, to know whether this is a shell used for ~/.ssh/rc
(the -c value is '/bin/sh .ssh/rc' in this case). When $DISPLAY is
set, I set up a part of my X11 environment from .zshenv, and this
includes an execution of xdpyinfo, but before the ~/.ssh/rc script is
executed, the xauth authorization hasn't been added yet, so that I get
an annoying error message. So, the idea is to disable this set up for
this -c value.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: a way to get the value of the -c option
  2015-12-03 11:54 a way to get the value of the -c option Vincent Lefevre
@ 2015-12-03 12:45 ` Peter Stephenson
  2015-12-03 13:36   ` Vincent Lefevre
  2015-12-03 13:49   ` Stephane Chazelas
  2015-12-03 14:36 ` Nikolay Aleksandrovich Pavlov (ZyX)
  1 sibling, 2 replies; 10+ messages in thread
From: Peter Stephenson @ 2015-12-03 12:45 UTC (permalink / raw)
  To: zsh-workers

On Thu, 3 Dec 2015 12:54:49 +0100
Vincent Lefevre <vincent@vinc17.net> wrote:
> zsh should provide a way to get the value of the -c option. Under
> Linux, one can look at /proc/$$/cmdline, but I think that it would
> be better to get this information in an OS-independent way.

This would be easy to do like this, for example, which has the
benefit of being trivial.

It's already possible to detect the shell was started like this
with zsh_eval_context[1], so another possibility might be to
combine it with a more generic way of getting top-level values.

pws

diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo
index 21bb874..8ef5485 100644
--- a/Doc/Zsh/params.yo
+++ b/Doc/Zsh/params.yo
@@ -933,6 +933,11 @@ tt(zsh/zutil) module.
 )
 enditem()
 )
+vindex(ZSH_CMD_ARG)
+item(tt(ZSH_CMD_ARG))(
+If the shell was started with the option tt(-c), this contains
+the argument passed to the option.  Otherwise it is not set.
+)
 vindex(ZSH_NAME)
 item(tt(ZSH_NAME))(
 Expands to the basename of the command used to invoke this instance
diff --git a/Src/init.c b/Src/init.c
index dcce1d7..25c39b5 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -1280,6 +1280,7 @@ init_misc(void)
 	    fclose(bshin);
 	SHIN = movefd(open("/dev/null", O_RDONLY | O_NOCTTY));
 	bshin = fdopen(SHIN, "r");
+	setsparam("ZSH_CMD_ARG", ztrdup(cmd));
 	execstring(cmd, 0, 1, "cmdarg");
 	stopmsg = 1;
 	zexit(lastval, 0);


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: a way to get the value of the -c option
  2015-12-03 12:45 ` Peter Stephenson
@ 2015-12-03 13:36   ` Vincent Lefevre
  2015-12-03 14:01     ` Peter Stephenson
  2015-12-03 13:49   ` Stephane Chazelas
  1 sibling, 1 reply; 10+ messages in thread
From: Vincent Lefevre @ 2015-12-03 13:36 UTC (permalink / raw)
  To: zsh-workers

On 2015-12-03 12:45:54 +0000, Peter Stephenson wrote:
> diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo
> index 21bb874..8ef5485 100644
> --- a/Doc/Zsh/params.yo
> +++ b/Doc/Zsh/params.yo
> @@ -933,6 +933,11 @@ tt(zsh/zutil) module.
>  )
>  enditem()
>  )
> +vindex(ZSH_CMD_ARG)
> +item(tt(ZSH_CMD_ARG))(
> +If the shell was started with the option tt(-c), this contains
> +the argument passed to the option.  Otherwise it is not set.
> +)
>  vindex(ZSH_NAME)
>  item(tt(ZSH_NAME))(
>  Expands to the basename of the command used to invoke this instance
> diff --git a/Src/init.c b/Src/init.c
> index dcce1d7..25c39b5 100644
> --- a/Src/init.c
> +++ b/Src/init.c
> @@ -1280,6 +1280,7 @@ init_misc(void)
>  	    fclose(bshin);
>  	SHIN = movefd(open("/dev/null", O_RDONLY | O_NOCTTY));
>  	bshin = fdopen(SHIN, "r");
> +	setsparam("ZSH_CMD_ARG", ztrdup(cmd));
>  	execstring(cmd, 0, 1, "cmdarg");
>  	stopmsg = 1;
>  	zexit(lastval, 0);

This doesn't work. The reason is:

/* Miscellaneous initializations that happen after init scripts are run */
                                             ^^^^^

while I need it for the .zshenv init script.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: a way to get the value of the -c option
  2015-12-03 12:45 ` Peter Stephenson
  2015-12-03 13:36   ` Vincent Lefevre
@ 2015-12-03 13:49   ` Stephane Chazelas
  2015-12-03 17:01     ` Peter Stephenson
  1 sibling, 1 reply; 10+ messages in thread
From: Stephane Chazelas @ 2015-12-03 13:49 UTC (permalink / raw)
  To: zsh-workers

2015-12-03 12:45:54 +0000, Peter Stephenson:
> On Thu, 3 Dec 2015 12:54:49 +0100
> Vincent Lefevre <vincent@vinc17.net> wrote:
> > zsh should provide a way to get the value of the -c option. Under
> > Linux, one can look at /proc/$$/cmdline, but I think that it would
> > be better to get this information in an OS-independent way.
[...]
> +vindex(ZSH_CMD_ARG)
> +item(tt(ZSH_CMD_ARG))(
> +If the shell was started with the option tt(-c), this contains
> +the argument passed to the option.  Otherwise it is not set.
[...]

Note that bash calls it $BASH_EXECUTION_STRING

It could be useful to have zsh's equivalent being
$ZSH_EXECUTION_STRING.

Note that bash doesn't clear it from the environment and doesn't
unexport it:

$ echo set | env BASH_EXECUTION_STRING=zzz  bash -s | grep zzz
BASH_EXECUTION_STRING=zzz

$ BASH_EXECUTION_STRING=zzz bash -c 'echo $BASH_EXECUTION_STRING; echo set | bash' | grep EXE
echo $BASH_EXECUTION_STRING; echo set | bash
BASH_EXECUTION_STRING='echo $BASH_EXECUTION_STRING; echo set | bash'

Now, if *you* export it to the environment, you're the one to
blame. In the case of bash, it's also affected by the -a
option:

$ bash -ac env | grep BASH
BASH=/bin/bash
BASH_EXECUTION_STRING=env
BASH_VERSION=4.3.11(1)-release

env -i zsh -ac env

shows a lot of variables as well. The intent with "-a" is that
all *newly-declared* (after "set -a" is issued) variables are
automatically exported.  It's arguable whether those internal
variables should also be exported or not when the shell is
called with -a. mksh bash zsh export them, dash ksh93 yash
don't.

Cheers,
-- 
Stephane


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: a way to get the value of the -c option
  2015-12-03 13:36   ` Vincent Lefevre
@ 2015-12-03 14:01     ` Peter Stephenson
  2015-12-03 14:23       ` Peter Stephenson
  2015-12-03 14:39       ` Vincent Lefevre
  0 siblings, 2 replies; 10+ messages in thread
From: Peter Stephenson @ 2015-12-03 14:01 UTC (permalink / raw)
  To: zsh-workers

On Thu, 3 Dec 2015 14:36:26 +0100
Vincent Lefevre <vincent@vinc17.net> wrote:
> This doesn't work. The reason is:
> 
> /* Miscellaneous initializations that happen after init scripts are run */
>                                              ^^^^^
> 
> while I need it for the .zshenv init script.

So you probably need something like this.

diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo
index 21bb874..8ef5485 100644
--- a/Doc/Zsh/params.yo
+++ b/Doc/Zsh/params.yo
@@ -933,6 +933,11 @@ tt(zsh/zutil) module.
 )
 enditem()
 )
+vindex(ZSH_CMD_ARG)
+item(tt(ZSH_CMD_ARG))(
+If the shell was started with the option tt(-c), this contains
+the argument passed to the option.  Otherwise it is not set.
+)
 vindex(ZSH_NAME)
 item(tt(ZSH_NAME))(
 Expands to the basename of the command used to invoke this instance
diff --git a/Src/init.c b/Src/init.c
index dcce1d7..ad8a68b 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -1086,6 +1086,9 @@ setupvals(void)
 
     /* Colour sequences for outputting colours in prompts and zle */
     set_default_colour_sequences();
+
+    if (cmd)
+	setsparam("ZSH_CMD_ARG", ztrdup(cmd));
 }
 
 /*


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: a way to get the value of the -c option
  2015-12-03 14:01     ` Peter Stephenson
@ 2015-12-03 14:23       ` Peter Stephenson
  2015-12-03 14:40         ` Peter Stephenson
  2015-12-03 14:39       ` Vincent Lefevre
  1 sibling, 1 reply; 10+ messages in thread
From: Peter Stephenson @ 2015-12-03 14:23 UTC (permalink / raw)
  To: zsh-workers

...and how about getting rid of that unsightly static "cmd" at the same
time?

I'm wondering about that "restricted", too (defined just below).  It's
only there as a flag between option parsing and init_misc() where the
option is actually set.  This raises the question of what should we do
when when parseopts is called from emulate and any "restricted" setting
currently disappears into the ether.  That can't be right, can it?  Do
we honour it, or we do we print an error?

pws

diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo
index 21bb874..8ef5485 100644
--- a/Doc/Zsh/params.yo
+++ b/Doc/Zsh/params.yo
@@ -933,6 +933,11 @@ tt(zsh/zutil) module.
 )
 enditem()
 )
+vindex(ZSH_CMD_ARG)
+item(tt(ZSH_CMD_ARG))(
+If the shell was started with the option tt(-c), this contains
+the argument passed to the option.  Otherwise it is not set.
+)
 vindex(ZSH_NAME)
 item(tt(ZSH_NAME))(
 Expands to the basename of the command used to invoke this instance
diff --git a/Src/init.c b/Src/init.c
index dcce1d7..65b7777 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -240,13 +240,11 @@ loop(int toplevel, int justonce)
     return LOOP_OK;
 }
 
-/* Shared among parseargs(), parseopts(), init_io(), and init_misc() */
-static char *cmd;
 static int restricted;
 
 /**/
 static void
-parseargs(char **argv, char **runscript)
+parseargs(char **argv, char **runscript, char **cmdptr)
 {
     char **x;
     LinkList paramlist;
@@ -272,7 +270,7 @@ parseargs(char **argv, char **runscript)
     opts[SHINSTDIN] = 0;
     opts[SINGLECOMMAND] = 0;
 
-    if (parseopts(NULL, &argv, opts, &cmd, NULL))
+    if (parseopts(NULL, &argv, opts, cmdptr, NULL))
 	exit(1);
 
     /*
@@ -290,7 +288,7 @@ parseargs(char **argv, char **runscript)
     if (*argv) {
 	if (unset(SHINSTDIN)) {
 	    posixzero = *argv;
-	    if (cmd)
+	    if (*cmdptr)
 		argzero = *argv;
 	    else
 		*runscript = *argv;
@@ -299,7 +297,7 @@ parseargs(char **argv, char **runscript)
 	}
 	while (*argv)
 	    zaddlinknode(paramlist, ztrdup(*argv++));
-    } else if (!cmd)
+    } else if (!*cmdptr)
 	opts[SHINSTDIN] = 1;
     if(isset(SINGLECOMMAND))
 	opts[INTERACTIVE] &= 1;
@@ -497,7 +495,7 @@ printhelp(void)
 
 /**/
 mod_export void
-init_io(void)
+init_io(char *cmd)
 {
     static char outbuf[BUFSIZ], errbuf[BUFSIZ];
 
@@ -802,7 +800,7 @@ init_term(void)
 
 /**/
 void
-setupvals(void)
+setupvals(char *cmd)
 {
 #ifdef USE_GETPWUID
     struct passwd *pswd;
@@ -1086,6 +1084,9 @@ setupvals(void)
 
     /* Colour sequences for outputting colours in prompts and zle */
     set_default_colour_sequences();
+
+    if (cmd)
+	setsparam("ZSH_CMD_ARG", ztrdup(cmd));
 }
 
 /*
@@ -1267,7 +1268,7 @@ run_init_scripts(void)
 
 /**/
 void
-init_misc(void)
+init_misc(char *cmd)
 {
 #ifndef RESTRICTED_R
     if ( restricted )
@@ -1604,6 +1605,7 @@ mod_export int
 zsh_main(UNUSED(int argc), char **argv)
 {
     char **t, *runscript = NULL;
+    char *cmd;			/* argument to -c */
     int t0;
 #ifdef USE_LOCALE
     setlocale(LC_ALL, "");
@@ -1652,18 +1654,18 @@ zsh_main(UNUSED(int argc), char **argv)
     opts[LOGINSHELL] = (**argv == '-');
     opts[PRIVILEGED] = (getuid() != geteuid() || getgid() != getegid());
     /* sets ZLE, INTERACTIVE, SHINSTDIN and SINGLECOMMAND */
-    parseargs(argv, &runscript);
+    parseargs(argv, &runscript, &cmd);
 
     SHTTY = -1;
-    init_io();
-    setupvals();
+    init_io(cmd);
+    setupvals(cmd);
 
     init_signals();
     init_bltinmods();
     init_builtins();
     run_init_scripts();
     setupshin(runscript);
-    init_misc();
+    init_misc(cmd);
 
     for (;;) {
 	/*


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: a way to get the value of the -c option
  2015-12-03 11:54 a way to get the value of the -c option Vincent Lefevre
  2015-12-03 12:45 ` Peter Stephenson
@ 2015-12-03 14:36 ` Nikolay Aleksandrovich Pavlov (ZyX)
  1 sibling, 0 replies; 10+ messages in thread
From: Nikolay Aleksandrovich Pavlov (ZyX) @ 2015-12-03 14:36 UTC (permalink / raw)
  To: Vincent Lefevre, zsh-workers

03.12.2015, 14:55, "Vincent Lefevre" <vincent@vinc17.net>:
> zsh should provide a way to get the value of the -c option. Under
> Linux, one can look at /proc/$$/cmdline, but I think that it would
> be better to get this information in an OS-independent way.
>
> This would be useful for .zshenv to know the context, for instance, as
> a user of OpenSSH, to know whether this is a shell used for ~/.ssh/rc
> (the -c value is '/bin/sh .ssh/rc' in this case). When $DISPLAY is
> set, I set up a part of my X11 environment from .zshenv, and this
> includes an execution of xdpyinfo, but before the ~/.ssh/rc script is
> executed, the xauth authorization hasn't been added yet, so that I get
> an annoying error message. So, the idea is to disable this set up for
> this -c value.

This is good idea: I personally have a few `exec` calls in my zshrc (basically they do two things: launch shell in dtach if it is not already in tmux/dtach/screen and use `hilite` program if it was not already used), but by doing this I loose the possibility to use `zsh -ic`. Presence of the variable which contains `-c` argument will fix this problem.

>
> --
> Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: a way to get the value of the -c option
  2015-12-03 14:01     ` Peter Stephenson
  2015-12-03 14:23       ` Peter Stephenson
@ 2015-12-03 14:39       ` Vincent Lefevre
  1 sibling, 0 replies; 10+ messages in thread
From: Vincent Lefevre @ 2015-12-03 14:39 UTC (permalink / raw)
  To: zsh-workers

On 2015-12-03 14:01:18 +0000, Peter Stephenson wrote:
> diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo
> index 21bb874..8ef5485 100644
> --- a/Doc/Zsh/params.yo
> +++ b/Doc/Zsh/params.yo
> @@ -933,6 +933,11 @@ tt(zsh/zutil) module.
>  )
>  enditem()
>  )
> +vindex(ZSH_CMD_ARG)
> +item(tt(ZSH_CMD_ARG))(
> +If the shell was started with the option tt(-c), this contains
> +the argument passed to the option.  Otherwise it is not set.
> +)
>  vindex(ZSH_NAME)
>  item(tt(ZSH_NAME))(
>  Expands to the basename of the command used to invoke this instance
> diff --git a/Src/init.c b/Src/init.c
> index dcce1d7..ad8a68b 100644
> --- a/Src/init.c
> +++ b/Src/init.c
> @@ -1086,6 +1086,9 @@ setupvals(void)
>  
>      /* Colour sequences for outputting colours in prompts and zle */
>      set_default_colour_sequences();
> +
> +    if (cmd)
> +	setsparam("ZSH_CMD_ARG", ztrdup(cmd));
>  }
>  
>  /*

Thanks! This patch works fine.

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <https://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: a way to get the value of the -c option
  2015-12-03 14:23       ` Peter Stephenson
@ 2015-12-03 14:40         ` Peter Stephenson
  0 siblings, 0 replies; 10+ messages in thread
From: Peter Stephenson @ 2015-12-03 14:40 UTC (permalink / raw)
  To: zsh-workers

On Thu, 3 Dec 2015 14:23:55 +0000
Peter Stephenson <p.stephenson@samsung.com> wrote:
> I'm wondering about that "restricted", too (defined just below).  It's
> only there as a flag between option parsing and init_misc() where the
> option is actually set.  This raises the question of what should we do
> when when parseopts is called from emulate and any "restricted" setting
> currently disappears into the ether.  That can't be right, can it?  Do
> we honour it, or we do we print an error?

Ah, wait, it's deliberate --- the test for !nam after the test for
restricted means it doesn't get passed on, and instead we drop through
to normal option setting, which already handles attempts to change this.
It's just a bit obscure.

I might turn the static into an argument, pass a pointer here, and test
for the pointer, rather than !nam, and then I might know what's going
on...

		} else if (optno == RESTRICTED && !nam) {
		    restricted = action;
...
		} else {
		    if (dosetopt(optno, action, !nam, new_opts) && nam) {
			WARN_OPTION("can't change option: %s", *argv);

pws


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: a way to get the value of the -c option
  2015-12-03 13:49   ` Stephane Chazelas
@ 2015-12-03 17:01     ` Peter Stephenson
  0 siblings, 0 replies; 10+ messages in thread
From: Peter Stephenson @ 2015-12-03 17:01 UTC (permalink / raw)
  To: zsh-workers

On Thu, 03 Dec 2015 13:49:29 +0000
Stephane Chazelas <stephane.chazelas@gmail.com> wrote:
> Note that bash calls it $BASH_EXECUTION_STRING
> 
> It could be useful to have zsh's equivalent being
> $ZSH_EXECUTION_STRING.

Strikes me as a bit wordy and non-specific, but it would probably help
to be similar...

pws

diff --git a/Doc/Zsh/params.yo b/Doc/Zsh/params.yo
index 21bb874..6722092 100644
--- a/Doc/Zsh/params.yo
+++ b/Doc/Zsh/params.yo
@@ -933,6 +933,11 @@ tt(zsh/zutil) module.
 )
 enditem()
 )
+vindex(ZSH_EXECUTION_STRING)
+item(tt(ZSH_EXECUTION_STRING))(
+If the shell was started with the option tt(-c), this contains
+the argument passed to the option.  Otherwise it is not set.
+)
 vindex(ZSH_NAME)
 item(tt(ZSH_NAME))(
 Expands to the basename of the command used to invoke this instance
diff --git a/Src/init.c b/Src/init.c
index dcce1d7..7894893 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -240,13 +240,11 @@ loop(int toplevel, int justonce)
     return LOOP_OK;
 }
 
-/* Shared among parseargs(), parseopts(), init_io(), and init_misc() */
-static char *cmd;
 static int restricted;
 
 /**/
 static void
-parseargs(char **argv, char **runscript)
+parseargs(char **argv, char **runscript, char **cmdptr)
 {
     char **x;
     LinkList paramlist;
@@ -272,7 +270,7 @@ parseargs(char **argv, char **runscript)
     opts[SHINSTDIN] = 0;
     opts[SINGLECOMMAND] = 0;
 
-    if (parseopts(NULL, &argv, opts, &cmd, NULL))
+    if (parseopts(NULL, &argv, opts, cmdptr, NULL))
 	exit(1);
 
     /*
@@ -290,7 +288,7 @@ parseargs(char **argv, char **runscript)
     if (*argv) {
 	if (unset(SHINSTDIN)) {
 	    posixzero = *argv;
-	    if (cmd)
+	    if (*cmdptr)
 		argzero = *argv;
 	    else
 		*runscript = *argv;
@@ -299,7 +297,7 @@ parseargs(char **argv, char **runscript)
 	}
 	while (*argv)
 	    zaddlinknode(paramlist, ztrdup(*argv++));
-    } else if (!cmd)
+    } else if (!*cmdptr)
 	opts[SHINSTDIN] = 1;
     if(isset(SINGLECOMMAND))
 	opts[INTERACTIVE] &= 1;
@@ -497,7 +495,7 @@ printhelp(void)
 
 /**/
 mod_export void
-init_io(void)
+init_io(char *cmd)
 {
     static char outbuf[BUFSIZ], errbuf[BUFSIZ];
 
@@ -802,7 +800,7 @@ init_term(void)
 
 /**/
 void
-setupvals(void)
+setupvals(char *cmd)
 {
 #ifdef USE_GETPWUID
     struct passwd *pswd;
@@ -1086,6 +1084,9 @@ setupvals(void)
 
     /* Colour sequences for outputting colours in prompts and zle */
     set_default_colour_sequences();
+
+    if (cmd)
+	setsparam("ZSH_EXECUTION_STRING", ztrdup(cmd));
 }
 
 /*
@@ -1267,7 +1268,7 @@ run_init_scripts(void)
 
 /**/
 void
-init_misc(void)
+init_misc(char *cmd)
 {
 #ifndef RESTRICTED_R
     if ( restricted )
@@ -1604,6 +1605,7 @@ mod_export int
 zsh_main(UNUSED(int argc), char **argv)
 {
     char **t, *runscript = NULL;
+    char *cmd;			/* argument to -c */
     int t0;
 #ifdef USE_LOCALE
     setlocale(LC_ALL, "");
@@ -1652,18 +1654,18 @@ zsh_main(UNUSED(int argc), char **argv)
     opts[LOGINSHELL] = (**argv == '-');
     opts[PRIVILEGED] = (getuid() != geteuid() || getgid() != getegid());
     /* sets ZLE, INTERACTIVE, SHINSTDIN and SINGLECOMMAND */
-    parseargs(argv, &runscript);
+    parseargs(argv, &runscript, &cmd);
 
     SHTTY = -1;
-    init_io();
-    setupvals();
+    init_io(cmd);
+    setupvals(cmd);
 
     init_signals();
     init_bltinmods();
     init_builtins();
     run_init_scripts();
     setupshin(runscript);
-    init_misc();
+    init_misc(cmd);
 
     for (;;) {
 	/*


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-12-03 17:01 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-03 11:54 a way to get the value of the -c option Vincent Lefevre
2015-12-03 12:45 ` Peter Stephenson
2015-12-03 13:36   ` Vincent Lefevre
2015-12-03 14:01     ` Peter Stephenson
2015-12-03 14:23       ` Peter Stephenson
2015-12-03 14:40         ` Peter Stephenson
2015-12-03 14:39       ` Vincent Lefevre
2015-12-03 13:49   ` Stephane Chazelas
2015-12-03 17:01     ` Peter Stephenson
2015-12-03 14:36 ` Nikolay Aleksandrovich Pavlov (ZyX)

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).