diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2004-12-18 21:08:45 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2004-12-18 21:08:45 +0000 |
commit | 97d3910b0f0e72055594fae86c7d85bd2952eb8d (patch) | |
tree | ce10f456f78783e454da8b4db674cf9358a38f32 /bin/ksh | |
parent | b228348292c4361c750ae05a5597a15e71c5c5da (diff) |
When invoked as sh set SH_VERSION, not KSH_VERSION like the man page says.
Diffstat (limited to 'bin/ksh')
-rw-r--r-- | bin/ksh/main.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/bin/ksh/main.c b/bin/ksh/main.c index 39443f537ff..00f03fa2006 100644 --- a/bin/ksh/main.c +++ b/bin/ksh/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.30 2004/12/18 21:04:52 millert Exp $ */ +/* $OpenBSD: main.c,v 1.31 2004/12/18 21:08:44 millert Exp $ */ /* * startup, main loop, environments and error handling @@ -27,11 +27,9 @@ static const char initifs[] = "IFS= \t\n"; static const char initsubs[] = "${PS2=> } ${PS3=#? } ${PS4=+ }"; -static const char version_param[] = "KSH_VERSION"; - -static const char *const initcoms [] = { +static const char *initcoms [] = { + "typeset", "-r", "KSH_VERSION", NULL, "typeset", "-x", "SHELL", "PATH", "HOME", NULL, - "typeset", "-r", version_param, NULL, "typeset", "-i", "PPID", NULL, "typeset", "-i", "OPTIND=1", NULL, "eval", "typeset -i RANDOM MAILCHECK=\"${MAILCHECK-600}\" SECONDS=\"${SECONDS-0}\" TMOUT=\"${TMOUT-0}\"", NULL, @@ -63,6 +61,8 @@ static const char *const initcoms [] = { NULL }; +#define version_param (initcoms[2]) + int main(int argc, char *argv[]) { @@ -172,8 +172,10 @@ main(int argc, char *argv[]) /* Check to see if we're /bin/sh. */ if (!strcmp(&kshname[strlen(kshname) - 3], "/sh") - || !strcmp(kshname, "sh") || !strcmp(kshname, "-sh")) + || !strcmp(kshname, "sh") || !strcmp(kshname, "-sh")) { Flag(FSH) = 1; + version_param = "SH_VERSION"; + } /* Set edit mode to emacs by default, may be overridden * by the environment or the user. Also, we want tab completion |