optimise away

This commit is contained in:
tg 2004-12-18 19:02:29 +00:00
parent 4c4a9323f8
commit 245d3ed291
3 changed files with 7 additions and 26 deletions

View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/conf-end.h,v 2.3 2004/12/18 18:58:30 tg Exp $ */ /** $MirBSD: src/bin/ksh/conf-end.h,v 2.4 2004/12/18 19:02:29 tg Exp $ */
/* $OpenBSD: conf-end.h,v 1.2 1996/08/25 12:37:58 downsj Exp $ */ /* $OpenBSD: conf-end.h,v 1.2 1996/08/25 12:37:58 downsj Exp $ */
#ifndef CONF_END_H #ifndef CONF_END_H
@ -22,9 +22,6 @@
/* Include complex history? */ /* Include complex history? */
#define COMPLEX_HISTORY #define COMPLEX_HISTORY
/* Strict POSIX behaviour? */
#undef POSIXLY_CORRECT
/* Specify default $ENV? */ /* Specify default $ENV? */
/* #undef DEFAULT_ENV */ /* #undef DEFAULT_ENV */

View File

@ -1,4 +1,4 @@
.\" $MirBSD: src/bin/ksh/ksh.1tbl,v 2.6 2004/12/18 18:39:10 tg Exp $ .\" $MirBSD: src/bin/ksh/ksh.1tbl,v 2.7 2004/12/18 19:02:29 tg Exp $
.\" $OpenBSD: ksh.1tbl,v 1.79 2004/12/04 07:05:13 jaredy Exp $ .\" $OpenBSD: ksh.1tbl,v 1.79 2004/12/04 07:05:13 jaredy Exp $
.\" $OpenBSD: sh.1tbl,v 1.53 2004/12/10 01:56:56 jaredy Exp $ .\" $OpenBSD: sh.1tbl,v 1.53 2004/12/10 01:56:56 jaredy Exp $
.\" .\"
@ -2378,9 +2378,7 @@ The
option is set automatically when the shell starts up if the environment option is set automatically when the shell starts up if the environment
contains the contains the
.Dv POSIXLY_CORRECT .Dv POSIXLY_CORRECT
parameter. (The shell can also be compiled so that it is in parameter.
.Tn POSIX
mode by default; however, this is usually not desirable).
.Pp .Pp
The following is a list of things that are affected by the state of the The following is a list of things that are affected by the state of the
.Ic posix .Ic posix

22
main.c
View File

@ -1,4 +1,4 @@
/** $MirBSD: src/bin/ksh/main.c,v 2.7 2004/12/18 18:58:30 tg Exp $ */ /** $MirBSD: src/bin/ksh/main.c,v 2.8 2004/12/18 19:02:29 tg Exp $ */
/* $OpenBSD: main.c,v 1.28 2004/08/23 14:56:32 millert Exp $ */ /* $OpenBSD: main.c,v 1.28 2004/08/23 14:56:32 millert Exp $ */
/* /*
@ -15,11 +15,7 @@
* shell version * shell version
*/ */
__RCSID("$MirBSD: src/bin/ksh/main.c,v 2.7 2004/12/18 18:58:30 tg Exp $"); __RCSID("$MirBSD: src/bin/ksh/main.c,v 2.8 2004/12/18 19:02:29 tg Exp $");
static const char version_param[] =
"KSH_VERSION"
;
const char ksh_version[] = const char ksh_version[] =
"@(#)PD KSH v5.2.14 MirOS R20 in " "@(#)PD KSH v5.2.14 MirOS R20 in "
@ -52,7 +48,7 @@ static const char initsubs[] = "${PS2=> } ${PS3=#? } ${PS4=+ }";
static const char *const initcoms [] = { static const char *const initcoms [] = {
"typeset", "-x", "SHELL", "PATH", "HOME", NULL, "typeset", "-x", "SHELL", "PATH", "HOME", NULL,
"typeset", "-r", version_param, NULL, "typeset", "-r", "KSH_VERSION", NULL,
"typeset", "-i", "PPID", NULL, "typeset", "-i", "PPID", NULL,
"typeset", "-i", "OPTIND=1", NULL, "typeset", "-i", "OPTIND=1", NULL,
"eval", "typeset -i RANDOM SECONDS=\"${SECONDS-0}\" TMOUT=\"${TMOUT-0}\"", NULL, "eval", "typeset -i RANDOM SECONDS=\"${SECONDS-0}\" TMOUT=\"${TMOUT-0}\"", NULL,
@ -195,16 +191,6 @@ main(int argc, char *argv[])
Flag(FBRACEEXPAND) = 1; Flag(FBRACEEXPAND) = 1;
#endif /* BRACE_EXPAND */ #endif /* BRACE_EXPAND */
/* set posix flag just before environment so that it will have
* exactly the same effect as the POSIXLY_CORRECT environment
* variable. If this needs to be done sooner to ensure correct posix
* operation, an initial scan of the environment will also have
* done sooner.
*/
#ifdef POSIXLY_CORRECT
change_flag(FPOSIX, OF_SPECIAL, 1);
#endif /* POSIXLY_CORRECT */
/* Check to see if we're /bin/sh. */ /* Check to see if we're /bin/sh. */
if (!strcmp(&kshname[strlen(kshname) - 3], "/sh") if (!strcmp(&kshname[strlen(kshname) - 3], "/sh")
|| !strcmp(kshname, "sh") || !strcmp(kshname, "-sh")) || !strcmp(kshname, "sh") || !strcmp(kshname, "-sh"))
@ -260,7 +246,7 @@ main(int argc, char *argv[])
^ ((long) (time(NULL) * kshpid * ppid)) ); ^ ((long) (time(NULL) * kshpid * ppid)) );
setint(global("RANDOM"), rnd_get()); setint(global("RANDOM"), rnd_get());
/* setstr can't fail here */ /* setstr can't fail here */
setstr(global(version_param), ksh_version, KSH_RETURN_ERROR); setstr(global("KSH_VERSION"), ksh_version, KSH_RETURN_ERROR);
/* execute initialization statements */ /* execute initialization statements */
for (wp = (char**) initcoms; *wp != NULL; wp++) { for (wp = (char**) initcoms; *wp != NULL; wp++) {