From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10899 invoked from network); 16 Sep 1998 17:51:12 -0000 Received: from math.gatech.edu (list@130.207.146.50) by ns1.primenet.com.au with SMTP; 16 Sep 1998 17:51:12 -0000 Received: (from list@localhost) by math.gatech.edu (8.9.1/8.9.1) id NAA11969; Wed, 16 Sep 1998 13:41:20 -0400 (EDT) Resent-Date: Wed, 16 Sep 1998 13:37:36 -0400 (EDT) From: "Bart Schaefer" Message-Id: <980916104021.ZM993@candle.brasslantern.com> Date: Wed, 16 Sep 1998 10:40:21 -0700 In-Reply-To: <199809161653.MAA06850@mailhost2.squonk.net> Comments: In reply to Ken Lareau "Re: /usr/bin/script annoyance" (Sep 16, 12:53pm) References: <199809161653.MAA06850@mailhost2.squonk.net> X-Mailer: Z-Mail (4.0b.820 20aug96) To: zsh-users@math.gatech.edu Subject: Re: /usr/bin/script annoyance MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Resent-Message-ID: <"0VfQs.0.Cu2.VT__r"@math> Resent-From: zsh-users@math.gatech.edu X-Mailing-List: archive/latest/1823 X-Loop: zsh-users@math.gatech.edu X-Loop: zsh-workers@math.gatech.edu Precedence: list Resent-Sender: zsh-workers-request@math.gatech.edu On Sep 16, 12:53pm, Ken Lareau wrote: } Subject: Re: /usr/bin/script annoyance } } In message <19980916114138.A23822@emsphone.com>, Dan Nelson writes: } >Zefram's solution to this problem is the shortest: } >> Alternatively, set your SHELL to be the executable of this program: } >> } >> extern char **environ; } >> int main(int argc, char **argv) } >> { } >> if(argc != 0) } >> argv[0] = "zsh"; } >> execve("/usr/local/bin/zsh", argv, environ); } >> _exit(1); } >> } It might be better like this: main(int argc, char **argv, char **envp) { if (argc > 0) argv[0] = (**argv == '-') ? "-zsh" : "zsh"; execve("/usr/local/bin/zsh", argv, envp); _exit(1); } That handles login shells, which Zefram's doesn't. } Of course, this brings up one more question... is this something that } can be fixed eventually in zsh? The only reasonable runtime fix I can think of would be an environment variable to specify the emulation mode, which would take precedence over argv[0]. That would potentially also solve the argv[0]="su" problem for which I posted a patch some months ago. An option to compile out argv[0]-based emulation would be possible, but didn't receive an enthusiastic response the last time it was suggested. -- Bart Schaefer Brass Lantern Enterprises http://www.well.com/user/barts http://www.brasslantern.com