re-implement "set -o posix" which doesn't do much ;)
but turns off 'braceexpand' when turned on as side effect, just like oksh/pdksh. document "set -o sh" too.
This commit is contained in:
parent
e62ca90db2
commit
1100be9300
4
check.t
4
check.t
@ -1,4 +1,4 @@
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.53 2006/08/09 20:21:08 tg Exp $
|
||||
# $MirOS: src/bin/mksh/check.t,v 1.54 2006/08/09 20:44:15 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 $
|
||||
@ -3825,5 +3825,5 @@ category: pdksh
|
||||
stdin:
|
||||
echo $KSH_VERSION
|
||||
expected-stdout:
|
||||
@(#)MIRBSD KSH R28 2006/08/08
|
||||
@(#)MIRBSD KSH R28 2006/08/09
|
||||
---
|
||||
|
@ -1,4 +1,4 @@
|
||||
$MirOS: src/bin/mksh/copyright,v 1.13 2006/08/09 20:34:42 tg Exp $
|
||||
$MirOS: src/bin/mksh/copyright,v 1.14 2006/08/09 20:44:15 tg Exp $
|
||||
|
||||
mksh is a collective work under the following licence:
|
||||
|
||||
@ -12,8 +12,8 @@ mksh is a collective work under the following licence:
|
||||
# in all redistributions or reproduced in accompanying documentation
|
||||
# or other materials provided with binary redistributions.
|
||||
#
|
||||
# All advertising materials mentioning features or use of this soft-
|
||||
# ware must display the following acknowledgement:
|
||||
# Advertising materials mentioning features or use of this work must
|
||||
# display the following acknowledgement:
|
||||
# This product includes material provided by Thorsten Glaser.
|
||||
#
|
||||
# Licensor offers the work "AS IS" and WITHOUT WARRANTY of any kind,
|
||||
@ -23,7 +23,7 @@ mksh is a collective work under the following licence:
|
||||
# or other damage, or direct damage except proven a consequence of a
|
||||
# direct error of said person and intended use of this work, loss or
|
||||
# other issues arising in any way out of its use, even if advised of
|
||||
# the possibility of such damage or existence of a nontrivial bug.
|
||||
# the possibility of such damage or existence of a defect.
|
||||
|
||||
Licensor recognises the contributions of the pdksh authors, who have
|
||||
dedicated their work into the Public Domain.
|
||||
|
17
misc.c
17
misc.c
@ -3,7 +3,7 @@
|
||||
|
||||
#include "sh.h"
|
||||
|
||||
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.12 2006/08/01 13:43:28 tg Exp $"
|
||||
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.13 2006/08/09 20:44:15 tg Exp $"
|
||||
"\t" MKSH_SH_H_ID);
|
||||
|
||||
short chtypes[UCHAR_MAX+1]; /* type bits for unsigned char */
|
||||
@ -248,8 +248,8 @@ change_flag(enum sh_flag f,
|
||||
{
|
||||
int oldval;
|
||||
|
||||
/* disabled functionality */
|
||||
if ((f == FPOSIX) || (f == FSH))
|
||||
/* limited pdksh compatibility (FSH stays always off) */
|
||||
if (f == FSH)
|
||||
return;
|
||||
|
||||
oldval = Flag(f);
|
||||
@ -257,18 +257,17 @@ change_flag(enum sh_flag f,
|
||||
if (f == FMONITOR) {
|
||||
if (what != OF_CMDLINE && newval != oldval)
|
||||
j_change();
|
||||
} else if (f == FVI || f == FEMACS || f == FGMACS) {
|
||||
if (newval) {
|
||||
Flag(FVI) = 0;
|
||||
Flag(FEMACS) = Flag(FGMACS) = 0;
|
||||
Flag(f) = newval;
|
||||
}
|
||||
} else if ((f == FVI || f == FEMACS || f == FGMACS) && newval) {
|
||||
Flag(FVI) = Flag(FEMACS) = Flag(FGMACS) = 0;
|
||||
Flag(f) = newval;
|
||||
} else if (f == FPRIVILEGED && oldval && !newval) {
|
||||
/* Turning off -p? */
|
||||
seteuid(ksheuid = kshuid = getuid());
|
||||
setuid(ksheuid);
|
||||
setegid(kshegid = kshgid = getgid());
|
||||
setgid(kshegid);
|
||||
} else if (f == FPOSIX && newval) {
|
||||
Flag(FBRACEEXPAND) = 0;
|
||||
}
|
||||
/* Changing interactive flag? */
|
||||
if (f == FTALKING) {
|
||||
|
13
mksh.1
13
mksh.1
@ -1,8 +1,8 @@
|
||||
.\" $MirOS: src/bin/mksh/mksh.1,v 1.53 2006/08/09 20:27:18 tg Exp $
|
||||
.\" $MirOS: src/bin/mksh/mksh.1,v 1.54 2006/08/09 20:44:15 tg Exp $
|
||||
.\" $OpenBSD: ksh.1,v 1.116 2006/07/26 10:13:25 jmc Exp $
|
||||
.\" $OpenBSD: sh.1tbl,v 1.53 2004/12/10 01:56:56 jaredy Exp $
|
||||
.\"
|
||||
.Dd August 8, 2006
|
||||
.Dd August 9, 2006
|
||||
.Dt MKSH 1
|
||||
.Os MirBSD
|
||||
.Sh NAME
|
||||
@ -3355,10 +3355,19 @@ See the
|
||||
and
|
||||
.Ic pwd
|
||||
commands above for more details.
|
||||
.It Ic posix
|
||||
Enable POSIX mode.
|
||||
Currently, this just turns off
|
||||
.Ic braceexpand
|
||||
mode when turned on, which can be turned back on manually.
|
||||
.It Ic restricted
|
||||
The shell is a restricted shell.
|
||||
This option can only be used when the shell is invoked.
|
||||
See above for a description of what this means.
|
||||
.It Ic sh
|
||||
This flag only exists for
|
||||
.Nm pdksh
|
||||
compatibility and cannot be turned on.
|
||||
.It Ic vi
|
||||
Enable
|
||||
.Xr vi 1 Ns -like
|
||||
|
6
sh.h
6
sh.h
@ -8,7 +8,7 @@
|
||||
/* $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.31 2006/08/02 11:33:37 tg Exp $"
|
||||
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.32 2006/08/09 20:44:16 tg Exp $"
|
||||
|
||||
#include <sys/param.h>
|
||||
|
||||
@ -195,10 +195,10 @@ enum sh_flag {
|
||||
FNOTIFY, /* -b: asynchronous job completion notification */
|
||||
FNOUNSET, /* -u: using an unset var is an error */
|
||||
FPHYSICAL, /* -o physical: don't do logical cds/pwds */
|
||||
FPOSIX, /* -o posix (disabled) */
|
||||
FPOSIX, /* -o posix (try to be more compatible) */
|
||||
FPRIVILEGED, /* -p: use suid_profile */
|
||||
FRESTRICTED, /* -r: restricted shell */
|
||||
FSH, /* -o sh (disabled) */
|
||||
FSH, /* -o sh (dummy, for pdksh compatibility) */
|
||||
FSTDIN, /* -s: (invocation) parse stdin */
|
||||
FTRACKALL, /* -h: create tracked aliases for all commands */
|
||||
FVERBOSE, /* -v: echo input */
|
||||
|
@ -1,3 +1,3 @@
|
||||
/* $MirOS: src/bin/mksh/version.h,v 1.5 2006/08/08 20:17:22 tg Exp $ */
|
||||
/* $MirOS: src/bin/mksh/version.h,v 1.6 2006/08/09 20:44:16 tg Exp $ */
|
||||
|
||||
EXTERN const char MKSH_VERSION[] I__("@(#)MIRBSD KSH R28 2006/08/08");
|
||||
EXTERN const char MKSH_VERSION[] I__("@(#)MIRBSD KSH R28 2006/08/09");
|
||||
|
Loading…
x
Reference in New Issue
Block a user