zsh-users
 help / color / mirror / code / Atom feed
From: "Bart Schaefer" <schaefer@brasslantern.com>
To: zsh-users@math.gatech.edu
Subject: Re: /usr/bin/script annoyance
Date: Wed, 16 Sep 1998 10:40:21 -0700	[thread overview]
Message-ID: <980916104021.ZM993@candle.brasslantern.com> (raw)
In-Reply-To: <199809161653.MAA06850@mailhost2.squonk.net>

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


      parent reply	other threads:[~1998-09-16 17:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-09-15 18:47 Simple way to get parent process name? Ken Lareau
1998-09-15 20:13 ` Dan Nelson
1998-09-16 13:09   ` Ken Lareau
1998-09-16 16:08     ` /usr/bin/script annoyance Dan Nelson
1998-09-16 16:31       ` Ken Lareau
1998-09-16 16:41         ` Dan Nelson
1998-09-16 16:53           ` Ken Lareau
1998-09-16 17:13             ` Ken Lareau
1998-09-16 17:40             ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=980916104021.ZM993@candle.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@math.gatech.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).