Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Wrong emulation mode if exec'd by su
- X-seq: zsh-workers 4120
- From: Martin Aumueller <aumuelle@xxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxxx
- Subject: Wrong emulation mode if exec'd by su
- Date: Mon, 15 Jun 1998 15:58:41 +0200 (MET DST)
- Cc: aumuelle@xxxxxxxxxxxxxxxxxxxxx
- Reply-to: aumuelle@xxxxxxxxxxxxxxxxxx
Hi!
I have a problem with zsh-3.1.4: If I su - to an account the zsh sees
"su" as executable name -- starting with 's' -- and thus switches to
Bourne shell emulation mode, not the behaviour desired by me. I have
solved this problem by testing the full executable names against "sh",
"csh" and "ksh" with strcmp and now it works as I expect it.
However, in the patch below I didn't take into account the case
starting with 'b', don't know what that should be, but besides this,
it should do.
Bye, Martin
diff -r -u zsh-3.1.4/Src/options.c zsh-3.1.4-patched/Src/options.c
--- zsh-3.1.4/Src/options.c Wed Apr 29 23:42:50 1998
+++ zsh-3.1.4-patched/Src/options.c Sun Jun 14 13:20:32 1998
@@ -432,6 +432,7 @@
void
emulate(const char *zsh_name, int fully)
{
+#if 0
char ch = *zsh_name;
if (ch == 'r')
@@ -442,10 +443,25 @@
emulation = EMULATE_CSH;
else if (ch == 'k')
emulation = EMULATE_KSH;
- else if (ch == 's' || ch == 'b')
+ else if (ch == 's' || ch == 'b')
emulation = EMULATE_SH;
else
emulation = EMULATE_ZSH;
+#else
+ const char *name = zsh_name;
+
+ if (*name == 'r')
+ name++;
+
+ if (!strcmp(name,"csh"))
+ emulation = EMULATE_CSH;
+ else if (!strcmp(name,"ksh"))
+ emulation = EMULATE_KSH;
+ else if (!strcmp(name,"sh"))
+ emulation = EMULATE_SH;
+ else
+ emulation = EMULATE_ZSH;
+#endif
scanhashtable(optiontab, 0, 0, 0, setemulate, fully);
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author