• make the "if called as sh, set FPOSIX" not !SMALL-only

• bump to R30-gamma, feature freeze
This commit is contained in:
tg 2007-07-17 13:56:51 +00:00
parent 823f5c2a17
commit 56a8da33cf
3 changed files with 13 additions and 24 deletions

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.125 2007/07/06 11:54:34 tg Exp $ # $MirOS: src/bin/mksh/check.t,v 1.126 2007/07/17 13:56:50 tg Exp $
# $OpenBSD: bksl-nl.t,v 1.2 2001/01/28 23:04:56 niklas 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: 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 $ # $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 # http://www.research.att.com/~gsf/public/ifs.sh
expected-stdout: expected-stdout:
@(#)MIRBSD KSH R29 2007/07/05 @(#)MIRBSD KSH R30 2007/07/17
description: description:
Check version of shell. Check version of shell.
category: pdksh category: pdksh
@ -4004,7 +4004,7 @@ expected-stdout:
name: aliases-3 name: aliases-3
description: description:
Check if running as sh disables built-in aliases (except a few) Check if running as sh disables built-in aliases (except a few)
category: pdksh,!smksh category: pdksh
arguments: !-o!posix! arguments: !-o!posix!
stdin: stdin:
cp "$0" sh cp "$0" sh

27
main.c
View File

@ -13,7 +13,7 @@
#include <locale.h> #include <locale.h>
#endif #endif
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.82 2007/07/01 21:10:29 tg Exp $"); __RCSID("$MirOS: src/bin/mksh/main.c,v 1.83 2007/07/17 13:56:51 tg Exp $");
extern char **environ; extern char **environ;
@ -63,12 +63,11 @@ static int initio_done;
int int
main(int argc, const char *argv[]) main(int argc, const char *argv[])
{ {
int i; int argi, i;
int argi;
Source *s; Source *s;
struct block *l; struct block *l;
int restricted, errexit; int restricted, errexit;
const char **wp; const char **wp, *cc;
struct env env; struct env env;
pid_t ppid; pid_t ppid;
struct tbl *vp; struct tbl *vp;
@ -77,9 +76,6 @@ main(int argc, const char *argv[])
size_t k; size_t k;
char *cp; char *cp;
#endif #endif
#if !defined(MKSH_SMALL) || HAVE_SETLOCALE_CTYPE
const char *cc;
#endif
/* make sure argv[] is sane */ /* make sure argv[] is sane */
if (!*argv) { if (!*argv) {
@ -162,21 +158,14 @@ main(int argc, const char *argv[])
/* setstr can't fail here */ /* setstr can't fail here */
setstr(vp, def_path, KSH_RETURN_ERROR); setstr(vp, def_path, KSH_RETURN_ERROR);
#ifndef MKSH_SMALL /* Set FPOSIX if we're called as -sh or /bin/sh or so */
cc = kshname; cc = kshname;
if (*cc == '-') i = 0; argi = 0;
++cc;
i = 0;
while (cc[i] != '\0') while (cc[i] != '\0')
if (cc[i] == '/') { if ((cc[i++] | 2) == '/')
cc += i + 1; argi = i;
i = 0; if (((cc[argi] | 0x20) == 's') && ((cc[argi + 1] | 0x20) == 'h'))
} else
++i;
if ((cc[0] == 's' || cc[0] == 'S') &&
(cc[1] == 'h' || cc[1] == 'H'))
Flag(FPOSIX) = 1; Flag(FPOSIX) = 1;
#endif
/* Turn on nohup by default for now - will change to off /* Turn on nohup by default for now - will change to off
* by default once people are aware of its existence * by default once people are aware of its existence

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: 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 $ */ /* $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.156 2007/07/06 02:22:57 tg Exp $" #define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.157 2007/07/17 13:56:49 tg Exp $"
#define MKSH_VERSION "R29 2007/07/05" #define MKSH_VERSION "R30 2007/07/17"
#if HAVE_SYS_PARAM_H #if HAVE_SYS_PARAM_H
#include <sys/param.h> #include <sys/param.h>