summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
Diffstat (limited to 'Src')
-rw-r--r--Src/init.c13
-rw-r--r--Src/params.c6
2 files changed, 10 insertions, 9 deletions
diff --git a/Src/init.c b/Src/init.c
index 4097327ee..20a07eb0a 100644
--- a/Src/init.c
+++ b/Src/init.c
@@ -802,7 +802,7 @@ init_term(void)
 
 /**/
 void
-setupvals(char *cmd)
+setupvals(char *cmd, char *runscript, char *zsh_name)
 {
 #ifdef USE_GETPWUID
     struct passwd *pswd;
@@ -1089,6 +1089,9 @@ setupvals(char *cmd)
 
     if (cmd)
 	setsparam("ZSH_EXECUTION_STRING", ztrdup(cmd));
+    if (runscript)
+        setsparam("ZSH_SCRIPT", ztrdup(runscript));
+    setsparam("ZSH_NAME", ztrdup(zsh_name)); /* NOTE: already metafied early in zsh_main() */
 }
 
 /*
@@ -1270,7 +1273,7 @@ run_init_scripts(void)
 
 /**/
 void
-init_misc(char *cmd)
+init_misc(char *cmd, char *zsh_name)
 {
 #ifndef RESTRICTED_R
     if ( restricted )
@@ -1606,7 +1609,7 @@ mod_export int use_exit_printed;
 mod_export int
 zsh_main(UNUSED(int argc), char **argv)
 {
-    char **t, *runscript = NULL;
+    char **t, *runscript = NULL, *zsh_name;
     char *cmd;			/* argument to -c */
     int t0;
 #ifdef USE_LOCALE
@@ -1660,14 +1663,14 @@ zsh_main(UNUSED(int argc), char **argv)
 
     SHTTY = -1;
     init_io(cmd);
-    setupvals(cmd);
+    setupvals(cmd, runscript, zsh_name);
 
     init_signals();
     init_bltinmods();
     init_builtins();
     run_init_scripts();
     setupshin(runscript);
-    init_misc(cmd);
+    init_misc(cmd, zsh_name);
 
     for (;;) {
 	/*
diff --git a/Src/params.c b/Src/params.c
index 7c5f79fff..c6172e018 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -80,8 +80,7 @@ char *argzero,		/* $0           */
      *rprompt,		/* $RPROMPT     */
      *rprompt2,		/* $RPROMPT2    */
      *sprompt,		/* $SPROMPT     */
-     *wordchars,	/* $WORDCHARS   */
-     *zsh_name;		/* $ZSH_NAME    */
+     *wordchars;	/* $WORDCHARS   */
 /**/
 mod_export
 char *ifs,		/* $IFS         */
@@ -812,8 +811,7 @@ createparamtable(void)
     setsparam("OSTYPE", ztrdup_metafy(OSTYPE));
     setsparam("TTY", ztrdup_metafy(ttystrname));
     setsparam("VENDOR", ztrdup_metafy(VENDOR));
-    setsparam("ZSH_NAME", ztrdup_metafy(zsh_name));
-    setsparam("ZSH_SCRIPT", ztrdup(posixzero));
+    setsparam("ZSH_ARGZERO", ztrdup(posixzero));
     setsparam("ZSH_VERSION", ztrdup_metafy(ZSH_VERSION));
     setsparam("ZSH_PATCHLEVEL", ztrdup_metafy(ZSH_PATCHLEVEL));
     setaparam("signals", sigptr = zalloc((SIGCOUNT+4) * sizeof(char *)));