zsh-workers
 help / color / mirror / code / Atom feed
* Wrong emulation mode if exec'd by su
@ 1998-06-15 13:58 Martin Aumueller
  1998-06-15 14:28 ` Zefram
  0 siblings, 1 reply; 4+ messages in thread
From: Martin Aumueller @ 1998-06-15 13:58 UTC (permalink / raw)
  To: zsh-workers; +Cc: aumuelle

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);
 }


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

end of thread, other threads:[~1998-06-16  6:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1998-06-15 13:58 Wrong emulation mode if exec'd by su Martin Aumueller
1998-06-15 14:28 ` Zefram
1998-06-15 15:52   ` Bart Schaefer
1998-06-16  6:14     ` Bart Schaefer

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