• check.t: add some FPOSIX regression tests (1 still fails)
• all: remove vi editing mode #if defined(MKSH_SMALL) || defined(MKSH_NOVI) saves 12608 byts on i386 • check.t: add $0 quoting
This commit is contained in:
parent
f280b66d0a
commit
17b7a28ac8
3
Build.sh
3
Build.sh
@ -1,8 +1,9 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# $MirOS: src/bin/mksh/Build.sh,v 1.212 2007/06/10 17:06:07 tg Exp $
|
# $MirOS: src/bin/mksh/Build.sh,v 1.213 2007/06/15 21:55:18 tg Exp $
|
||||||
#-
|
#-
|
||||||
# Environment used: CC CFLAGS CPPFLAGS LDFLAGS LIBS NOWARN NROFF TARGET_OS
|
# Environment used: CC CFLAGS CPPFLAGS LDFLAGS LIBS NOWARN NROFF TARGET_OS
|
||||||
# CPPFLAGS recognised: MKSH_SMALL MKSH_ASSUME_UTF8 MKSH_NEED_MKNOD MKSH_NOPWNAM
|
# CPPFLAGS recognised: MKSH_SMALL MKSH_ASSUME_UTF8 MKSH_NEED_MKNOD MKSH_NOPWNAM
|
||||||
|
# MKSH_NOVI
|
||||||
|
|
||||||
v()
|
v()
|
||||||
{
|
{
|
||||||
|
60
check.t
60
check.t
@ -1,4 +1,4 @@
|
|||||||
# $MirOS: src/bin/mksh/check.t,v 1.112 2007/06/09 22:02:04 tg Exp $
|
# $MirOS: src/bin/mksh/check.t,v 1.113 2007/06/15 21:55:18 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/06/09
|
@(#)MIRBSD KSH R29 2007/06/15
|
||||||
description:
|
description:
|
||||||
Check version of shell.
|
Check version of shell.
|
||||||
category: pdksh
|
category: pdksh
|
||||||
@ -3901,12 +3901,12 @@ stdin:
|
|||||||
print got ${#anzahl[*]} files
|
print got ${#anzahl[*]} files
|
||||||
chmod +x foo/*
|
chmod +x foo/*
|
||||||
export PATH=$(pwd)/foo:$PATH
|
export PATH=$(pwd)/foo:$PATH
|
||||||
$0 -c 'fnord'
|
"$0" -c 'fnord'
|
||||||
$0 -c 'fnord; fnord; fnord; fnord'
|
"$0" -c 'fnord; fnord; fnord; fnord'
|
||||||
$0 foo/bar
|
"$0" foo/bar
|
||||||
$0 <foo/bar
|
"$0" <foo/bar
|
||||||
$0 foo/zoo
|
"$0" foo/zoo
|
||||||
$0 -c 'print : $(fnord)'
|
"$0" -c 'print : $(fnord)'
|
||||||
rm -rf foo
|
rm -rf foo
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
got 4 files
|
got 4 files
|
||||||
@ -3957,9 +3957,49 @@ description:
|
|||||||
Reading the UTF-8 BOM should enable the utf8-hack flag
|
Reading the UTF-8 BOM should enable the utf8-hack flag
|
||||||
category: pdksh,!dutf
|
category: pdksh,!dutf
|
||||||
stdin:
|
stdin:
|
||||||
$0 -c ':; x=$(set +o); if [[ $x = *utf8* ]]; then print on; else print off; fi'
|
"$0" -c ':; x=$(set +o); if [[ $x = *utf8* ]]; then print on; else print off; fi'
|
||||||
$0 -c ':; x=$(set +o); if [[ $x = *utf8* ]]; then print on; else print off; fi'
|
"$0" -c ':; x=$(set +o); if [[ $x = *utf8* ]]; then print on; else print off; fi'
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
off
|
off
|
||||||
on
|
on
|
||||||
---
|
---
|
||||||
|
name: aliases-1
|
||||||
|
description:
|
||||||
|
Check if built-in shell aliases are okay
|
||||||
|
category: pdksh
|
||||||
|
stdin:
|
||||||
|
alias
|
||||||
|
typeset -f
|
||||||
|
expected-stdout:
|
||||||
|
autoload='typeset -fu'
|
||||||
|
functions='typeset -f'
|
||||||
|
hash='alias -t'
|
||||||
|
history='fc -l'
|
||||||
|
integer='typeset -i'
|
||||||
|
local=typeset
|
||||||
|
login='exec login'
|
||||||
|
nohup='nohup '
|
||||||
|
r='fc -e -'
|
||||||
|
stop='kill -STOP'
|
||||||
|
suspend='kill -STOP $$'
|
||||||
|
type='whence -v'
|
||||||
|
---
|
||||||
|
name: aliases-2
|
||||||
|
description:
|
||||||
|
Check if “set -o posix” disables built-in aliases
|
||||||
|
category: pdksh
|
||||||
|
arguments: !-o!posix!
|
||||||
|
stdin:
|
||||||
|
alias
|
||||||
|
typeset -f
|
||||||
|
---
|
||||||
|
name: aliases-3
|
||||||
|
description:
|
||||||
|
Check if running as sh disables built-in aliases
|
||||||
|
category: pdksh,!smksh
|
||||||
|
arguments: !-o!posix!
|
||||||
|
stdin:
|
||||||
|
cp "$0" sh
|
||||||
|
./sh -c 'alias; typeset -f'
|
||||||
|
rm -f sh
|
||||||
|
---
|
||||||
|
8
lex.c
8
lex.c
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.33 2007/06/04 19:25:45 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.34 2007/06/15 21:55:19 tg Exp $");
|
||||||
|
|
||||||
/* Structure to keep track of the lexing state and the various pieces of info
|
/* Structure to keep track of the lexing state and the various pieces of info
|
||||||
* needed for each particular state. */
|
* needed for each particular state. */
|
||||||
@ -969,7 +969,11 @@ getsc_line(Source *s)
|
|||||||
ksh_tmout_state = TMOUT_READING;
|
ksh_tmout_state = TMOUT_READING;
|
||||||
alarm(ksh_tmout);
|
alarm(ksh_tmout);
|
||||||
}
|
}
|
||||||
if (have_tty && (Flag(FVI) || Flag(FEMACS) || Flag(FGMACS))) {
|
if (have_tty && (
|
||||||
|
#ifndef MKSH_NOVI
|
||||||
|
Flag(FVI) ||
|
||||||
|
#endif
|
||||||
|
Flag(FEMACS) || Flag(FGMACS))) {
|
||||||
int nread;
|
int nread;
|
||||||
|
|
||||||
nread = x_read(xp, LINE);
|
nread = x_read(xp, LINE);
|
||||||
|
22
main.c
22
main.c
@ -13,7 +13,7 @@
|
|||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.77 2007/06/15 20:52:19 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.78 2007/06/15 21:55:19 tg Exp $");
|
||||||
|
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ main(int argc, const char *argv[])
|
|||||||
size_t k;
|
size_t k;
|
||||||
char *cp;
|
char *cp;
|
||||||
#endif
|
#endif
|
||||||
#if HAVE_SETLOCALE_CTYPE
|
#if !defined(MKSH_SMALL) || HAVE_SETLOCALE_CTYPE
|
||||||
const char *cc;
|
const char *cc;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -165,6 +165,22 @@ 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
|
||||||
|
cc = kshname;
|
||||||
|
if (*cc == '-')
|
||||||
|
++cc;
|
||||||
|
i = 0;
|
||||||
|
while (cc[i] != '\0')
|
||||||
|
if (cc[i] == '/') {
|
||||||
|
cc += i + 1;
|
||||||
|
i = 0;
|
||||||
|
} else
|
||||||
|
++i;
|
||||||
|
if ((cc[0] == 's' || cc[0] == 'S') &&
|
||||||
|
(cc[1] == 'h' || cc[1] == 'H'))
|
||||||
|
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
|
||||||
* (at&t ksh does not have a nohup option - it always sends
|
* (at&t ksh does not have a nohup option - it always sends
|
||||||
@ -181,7 +197,9 @@ main(int argc, const char *argv[])
|
|||||||
* by the environment or the user. Also, we want tab completion
|
* by the environment or the user. Also, we want tab completion
|
||||||
* on in vi by default. */
|
* on in vi by default. */
|
||||||
change_flag(FEMACS, OF_SPECIAL, 1);
|
change_flag(FEMACS, OF_SPECIAL, 1);
|
||||||
|
#ifndef MKSH_NOVI
|
||||||
Flag(FVITABCOMPLETE) = 1;
|
Flag(FVITABCOMPLETE) = 1;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* import environment */
|
/* import environment */
|
||||||
if (environ != NULL)
|
if (environ != NULL)
|
||||||
|
15
misc.c
15
misc.c
@ -6,7 +6,7 @@
|
|||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.57 2007/06/06 23:28:16 tg Exp $\t"
|
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.58 2007/06/15 21:55:19 tg Exp $\t"
|
||||||
MKSH_SH_H_ID);
|
MKSH_SH_H_ID);
|
||||||
|
|
||||||
#undef USE_CHVT
|
#undef USE_CHVT
|
||||||
@ -131,10 +131,12 @@ const struct option options[] = {
|
|||||||
{ "trackall", 'h', OF_ANY },
|
{ "trackall", 'h', OF_ANY },
|
||||||
{ "utf8-hack", 'U', OF_ANY }, /* non-standard */
|
{ "utf8-hack", 'U', OF_ANY }, /* non-standard */
|
||||||
{ "verbose", 'v', OF_ANY },
|
{ "verbose", 'v', OF_ANY },
|
||||||
|
#ifndef MKSH_NOVI
|
||||||
{ "vi", 0, OF_ANY },
|
{ "vi", 0, OF_ANY },
|
||||||
{ "viraw", 0, OF_ANY }, /* no effect */
|
{ "viraw", 0, OF_ANY }, /* no effect */
|
||||||
{ "vi-tabcomplete", 0, OF_ANY }, /* non-standard */
|
{ "vi-tabcomplete", 0, OF_ANY }, /* non-standard */
|
||||||
{ "vi-esccomplete", 0, OF_ANY }, /* non-standard */
|
{ "vi-esccomplete", 0, OF_ANY }, /* non-standard */
|
||||||
|
#endif
|
||||||
{ "xtrace", 'x', OF_ANY },
|
{ "xtrace", 'x', OF_ANY },
|
||||||
/* Anonymous flags: used internally by shell only
|
/* Anonymous flags: used internally by shell only
|
||||||
* (not visible to user)
|
* (not visible to user)
|
||||||
@ -235,8 +237,15 @@ change_flag(enum sh_flag f,
|
|||||||
if (f == FMONITOR) {
|
if (f == FMONITOR) {
|
||||||
if (what != OF_CMDLINE && newval != oldval)
|
if (what != OF_CMDLINE && newval != oldval)
|
||||||
j_change();
|
j_change();
|
||||||
} else if ((f == FVI || f == FEMACS || f == FGMACS) && newval) {
|
} else if ((
|
||||||
Flag(FVI) = Flag(FEMACS) = Flag(FGMACS) = 0;
|
#ifndef MKSH_NOVI
|
||||||
|
f == FVI ||
|
||||||
|
#endif
|
||||||
|
f == FEMACS || f == FGMACS) && newval) {
|
||||||
|
#ifndef MKSH_NOVI
|
||||||
|
Flag(FVI) =
|
||||||
|
#endif
|
||||||
|
Flag(FEMACS) = Flag(FGMACS) = 0;
|
||||||
Flag(f) = newval;
|
Flag(f) = newval;
|
||||||
} else if (f == FPRIVILEGED && oldval && !newval) {
|
} else if (f == FPRIVILEGED && oldval && !newval) {
|
||||||
/* Turning off -p? */
|
/* Turning off -p? */
|
||||||
|
10
sh.h
10
sh.h
@ -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.146 2007/06/09 22:02:04 tg 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/09"
|
#define MKSH_VERSION "R29 2007/06/15"
|
||||||
|
|
||||||
#if HAVE_SYS_PARAM_H
|
#if HAVE_SYS_PARAM_H
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
@ -305,6 +305,10 @@ char *ucstrstr(char *, const char *);
|
|||||||
#define stristr(b,l) ((const char *)strcasestr((b), (l)))
|
#define stristr(b,l) ((const char *)strcasestr((b), (l)))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(MKSH_SMALL) && !defined(MKSH_NOVI)
|
||||||
|
#define MKSH_NOVI
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Area-based allocation built on malloc/free
|
* Area-based allocation built on malloc/free
|
||||||
*/
|
*/
|
||||||
@ -409,10 +413,12 @@ enum sh_flag {
|
|||||||
FTRACKALL, /* -h: create tracked aliases for all commands */
|
FTRACKALL, /* -h: create tracked aliases for all commands */
|
||||||
FUTFHACK, /* -U: utf-8 hack for command line editing */
|
FUTFHACK, /* -U: utf-8 hack for command line editing */
|
||||||
FVERBOSE, /* -v: echo input */
|
FVERBOSE, /* -v: echo input */
|
||||||
|
#ifndef MKSH_NOVI
|
||||||
FVI, /* vi command editing */
|
FVI, /* vi command editing */
|
||||||
FVIRAW, /* always read in raw mode (ignored) */
|
FVIRAW, /* always read in raw mode (ignored) */
|
||||||
FVITABCOMPLETE, /* enable tab as file name completion char */
|
FVITABCOMPLETE, /* enable tab as file name completion char */
|
||||||
FVIESCCOMPLETE, /* enable ESC as file name completion in command mode */
|
FVIESCCOMPLETE, /* enable ESC as file name completion in command mode */
|
||||||
|
#endif
|
||||||
FXTRACE, /* -x: execution trace */
|
FXTRACE, /* -x: execution trace */
|
||||||
FTALKING_I, /* (internal): initial shell was interactive */
|
FTALKING_I, /* (internal): initial shell was interactive */
|
||||||
FNFLAGS /* (place holder: how many flags are there) */
|
FNFLAGS /* (place holder: how many flags are there) */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user