make sure that “integer” and “local” are defined even in FPOSIX mode, which

is a compromise anyway; these lunox people will have to live with that, too
many existing korn shell alike scripts depend on it even if not on the full
korn shell syntax availability (note: this doesn't mean using these in some
script with #!/bin/sh is ok)
This commit is contained in:
tg 2007-06-17 00:50:09 +00:00
parent 199994fed8
commit e596de4759
4 changed files with 24 additions and 15 deletions

14
check.t
View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.113 2007/06/15 21:55:18 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.114 2007/06/17 00:50:07 tg Exp $
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: history.t,v 1.5 2001/01/28 23:04:56 niklas Exp $
# $OpenBSD: read.t,v 1.3 2003/03/10 03:48:16 david Exp $
@ -7,7 +7,7 @@
# http://www.research.att.com/~gsf/public/ifs.sh
expected-stdout:
@(#)MIRBSD KSH R29 2007/06/15
@(#)MIRBSD KSH R29 2007/06/17
description:
Check version of shell.
category: pdksh
@ -3986,20 +3986,26 @@ expected-stdout:
---
name: aliases-2
description:
Check if set -o posix disables built-in aliases
Check if set -o posix disables built-in aliases (except a few)
category: pdksh
arguments: !-o!posix!
stdin:
alias
typeset -f
expected-stdout:
integer='typeset -i'
local=typeset
---
name: aliases-3
description:
Check if running as sh disables built-in aliases
Check if running as sh disables built-in aliases (except a few)
category: pdksh,!smksh
arguments: !-o!posix!
stdin:
cp "$0" sh
./sh -c 'alias; typeset -f'
rm -f sh
expected-stdout:
integer='typeset -i'
local=typeset
---

7
main.c
View File

@ -13,7 +13,7 @@
#include <locale.h>
#endif
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.79 2007/06/16 15:02:56 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.80 2007/06/17 00:50:07 tg Exp $");
extern char **environ;
@ -34,12 +34,12 @@ static const char *initcoms[] = {
"typeset", "-x", "SHELL", "PATH", "HOME", NULL,
"typeset", "-i", "PPID", "OPTIND=1", NULL,
"eval", "typeset -i RANDOM SECONDS=\"${SECONDS-0}\" TMOUT=\"${TMOUT-0}\"", NULL,
"alias", "integer=typeset -i", "local=typeset", NULL,
NULL
};
static const char *initcoms_korn[] = {
"alias",
/* Standard ksh aliases */
"hash=alias -t", /* not "alias -t --": hash -r needs to work */
"type=whence -v",
"stop=kill -STOP",
@ -47,11 +47,8 @@ static const char *initcoms_korn[] = {
"autoload=typeset -fu",
"functions=typeset -f",
"history=fc -l",
"integer=typeset -i",
"nohup=nohup ",
"local=typeset",
"r=fc -e -",
/* Aliases that are builtin commands in at&t */
"login=exec login",
NULL,
/* this is what at&t ksh seems to track, with the addition of emacs */

14
mksh.1
View File

@ -1,7 +1,7 @@
.\" $MirOS: src/bin/mksh/mksh.1,v 1.86 2007/06/16 15:02:56 tg Exp $
.\" $MirOS: src/bin/mksh/mksh.1,v 1.87 2007/06/17 00:50:08 tg Exp $
.\" $OpenBSD: ksh.1,v 1.120 2007/05/31 20:47:44 otto Exp $
.\"
.Dd June 15, 2007
.Dd June 17, 2007
.Dt MKSH 1
.Os MirBSD
.Sh NAME
@ -811,7 +811,11 @@ expanded is found.
.Pp
The following command aliases are defined automatically by the shell, unless
.Fl o Ic posix
is set:
is set, in which case only
.Dq integer
and
.Dq local
are defined to support existing shell scripts:
.Bd -literal -offset indent
autoload='typeset -fu'
functions='typeset -f'
@ -848,7 +852,9 @@ or
the shell tracks all commands.
This option is set automatically for non-interactive shells.
For interactive shells, only the following commands are
automatically tracked:
automatically tracked, unless
.Fl o Ic posix
is set:
.Xr cat 1 ,
.Xr cc 1 ,
.Xr chmod 1 ,

4
sh.h
View File

@ -8,8 +8,8 @@
/* $OpenBSD: c_test.h,v 1.4 2004/12/20 11:34:26 otto Exp $ */
/* $OpenBSD: tty.h,v 1.5 2004/12/20 11:34:26 otto Exp $ */
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.147 2007/06/15 21:55:20 tg Exp $"
#define MKSH_VERSION "R29 2007/06/15"
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.148 2007/06/17 00:50:09 tg Exp $"
#define MKSH_VERSION "R29 2007/06/17"
#if HAVE_SYS_PARAM_H
#include <sys/param.h>