Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: zsh/newuser shouldn't run in emulation



I've added an explicit test to zsh/newuser that it shouldn't run when
emulating another shell.  Actually, this was already covered for sh and
ksh because they take a different branch during initialisation, but I'd
prefer it to be explicit within the module.

Index: Doc/Zsh/mod_newuser.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/mod_newuser.yo,v
retrieving revision 1.1
diff -u -r1.1 mod_newuser.yo
--- Doc/Zsh/mod_newuser.yo	20 Jul 2005 16:08:22 -0000	1.1
+++ Doc/Zsh/mod_newuser.yo	9 Dec 2005 12:25:05 -0000
@@ -12,7 +12,9 @@
 On loading, the module tests if any of the start-up files tt(.zshenv),
 tt(.zprofile), tt(.zshrc) or tt(.zlogin) exist in the directory given by
 the environment variable tt(ZDOTDIR), or the user's home directory if that
-is not set.
+is not set.  The test is not performed and the module halts processing if
+the shell was in an emulation mode (i.e. had been invoked as some other
+shell than zsh).
 
 If none of the start-up files were found, the module then looks for the
 file tt(newuser) first in a sitewide directory, usually the parent
Index: Src/options.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/options.c,v
retrieving revision 1.24
diff -u -r1.24 options.c
--- Src/options.c	8 Aug 2005 16:49:10 -0000	1.24
+++ Src/options.c	9 Dec 2005 12:25:07 -0000
@@ -33,7 +33,7 @@
 /* current emulation (used to decide which set of option letters is used) */
 
 /**/
-int emulation;
+mod_export int emulation;
  
 /* the options; e.g. if opts[SHGLOB] != 0, SH_GLOB is turned on */
  
Index: Src/Modules/newuser.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/newuser.c,v
retrieving revision 1.1
diff -u -r1.1 newuser.c
--- Src/Modules/newuser.c	20 Jul 2005 16:08:23 -0000	1.1
+++ Src/Modules/newuser.c	9 Dec 2005 12:25:07 -0000
@@ -64,6 +64,9 @@
 	0 };
     const char **sp;
 
+    if (emulation != EMULATE_ZSH)
+	return;
+
     if (!dotdir)
 	dotdir = home;
 
-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


This message has been scanned for viruses by BlackSpider MailControl - www.blackspider.com



Messages sorted by: Reverse Date, Date, Thread, Author