Merge mksh CVS HEAD
This commit is contained in:
commit
7fb9d283c5
41
Build.sh
41
Build.sh
@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.709 2017/03/17 23:47:05 tg Exp $'
|
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.711 2017/04/02 14:14:03 tg Exp $'
|
||||||
#-
|
#-
|
||||||
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||||
# 2011, 2012, 2013, 2014, 2015, 2016, 2017
|
# 2011, 2012, 2013, 2014, 2015, 2016, 2017
|
||||||
@ -495,6 +495,7 @@ check_categories=
|
|||||||
last=
|
last=
|
||||||
tfn=
|
tfn=
|
||||||
legacy=0
|
legacy=0
|
||||||
|
textmode=0
|
||||||
|
|
||||||
for i
|
for i
|
||||||
do
|
do
|
||||||
@ -551,6 +552,12 @@ do
|
|||||||
:-r)
|
:-r)
|
||||||
r=1
|
r=1
|
||||||
;;
|
;;
|
||||||
|
:-T)
|
||||||
|
textmode=1
|
||||||
|
;;
|
||||||
|
:+T)
|
||||||
|
textmode=0
|
||||||
|
;;
|
||||||
:-t)
|
:-t)
|
||||||
last=t
|
last=t
|
||||||
;;
|
;;
|
||||||
@ -594,7 +601,13 @@ if test $legacy = 0; then
|
|||||||
else
|
else
|
||||||
check_categories="$check_categories shell:legacy-yes"
|
check_categories="$check_categories shell:legacy-yes"
|
||||||
add_cppflags -DMKSH_LEGACY_MODE
|
add_cppflags -DMKSH_LEGACY_MODE
|
||||||
HAVE_PERSISTENT_HISTORY=0
|
fi
|
||||||
|
|
||||||
|
if test $textmode = 0; then
|
||||||
|
check_categories="$check_categories shell:textmode-no shell:binmode-yes"
|
||||||
|
else
|
||||||
|
check_categories="$check_categories shell:textmode-yes shell:binmode-no"
|
||||||
|
add_cppflags -DMKSH_WITH_TEXTMODE
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test x"$srcdir" = x"."; then
|
if test x"$srcdir" = x"."; then
|
||||||
@ -858,6 +871,28 @@ OS/2)
|
|||||||
add_cppflags -DMKSH_UNEMPLOYED
|
add_cppflags -DMKSH_UNEMPLOYED
|
||||||
add_cppflags -DMKSH_NOPROSPECTOFWORK
|
add_cppflags -DMKSH_NOPROSPECTOFWORK
|
||||||
add_cppflags -DMKSH_NO_LIMITS
|
add_cppflags -DMKSH_NO_LIMITS
|
||||||
|
add_cppflags -DMKSH_DOSPATH
|
||||||
|
if test $textmode = 0; then
|
||||||
|
x='dis'
|
||||||
|
y='standard OS/2 tools'
|
||||||
|
else
|
||||||
|
x='en'
|
||||||
|
y='standard Unix mksh and other tools'
|
||||||
|
fi
|
||||||
|
echo >&2 "
|
||||||
|
OS/2 Note: mksh can be built with or without 'textmode'.
|
||||||
|
Without 'textmode' it will behave like a standard Unix utility,
|
||||||
|
compatible to mksh on all other platforms, using only ASCII LF
|
||||||
|
(0x0A) as line ending character. This is supported by the mksh
|
||||||
|
upstream developer.
|
||||||
|
With 'textmode', mksh will be modified to behave more like other
|
||||||
|
OS/2 utilities, supporting ASCII CR+LF (0x0D 0x0A) as line ending
|
||||||
|
at the cost of deviation from standard mksh. This is supported by
|
||||||
|
the mksh-os2 porter.
|
||||||
|
|
||||||
|
] You are currently compiling with textmode ${x}abled, introducing
|
||||||
|
] incompatibilities with $y.
|
||||||
|
"
|
||||||
;;
|
;;
|
||||||
OSF1)
|
OSF1)
|
||||||
HAVE_SIG_T=0 # incompatible
|
HAVE_SIG_T=0 # incompatible
|
||||||
@ -2366,7 +2401,7 @@ addsrcs '!' HAVE_STRLCPY strlcpy.c
|
|||||||
addsrcs USE_PRINTF_BUILTIN printf.c
|
addsrcs USE_PRINTF_BUILTIN printf.c
|
||||||
test 1 = "$USE_PRINTF_BUILTIN" && add_cppflags -DMKSH_PRINTF_BUILTIN
|
test 1 = "$USE_PRINTF_BUILTIN" && add_cppflags -DMKSH_PRINTF_BUILTIN
|
||||||
test 1 = "$HAVE_CAN_VERB" && CFLAGS="$CFLAGS -verbose"
|
test 1 = "$HAVE_CAN_VERB" && CFLAGS="$CFLAGS -verbose"
|
||||||
add_cppflags -DMKSH_BUILD_R=541
|
add_cppflags -DMKSH_BUILD_R=549
|
||||||
|
|
||||||
$e $bi$me: Finished configuration testing, now producing output.$ao
|
$e $bi$me: Finished configuration testing, now producing output.$ao
|
||||||
|
|
||||||
|
8
Makefile
8
Makefile
@ -1,7 +1,7 @@
|
|||||||
# $MirOS: src/bin/mksh/Makefile,v 1.155 2016/11/12 00:20:37 tg Exp $
|
# $MirOS: src/bin/mksh/Makefile,v 1.156 2017/04/02 14:14:04 tg Exp $
|
||||||
#-
|
#-
|
||||||
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||||
# 2011, 2012, 2013, 2014, 2015, 2016
|
# 2011, 2012, 2013, 2014, 2015, 2016, 2017
|
||||||
# mirabilos <m@mirbsd.org>
|
# mirabilos <m@mirbsd.org>
|
||||||
#
|
#
|
||||||
# Provided that these terms and disclaimer and all copyright notices
|
# Provided that these terms and disclaimer and all copyright notices
|
||||||
@ -57,7 +57,7 @@ CPPFLAGS+= -DMKSH_ASSUME_UTF8 -DMKSH_DISABLE_DEPRECATED \
|
|||||||
-DHAVE_SETGROUPS=1 -DHAVE_STRERROR=0 -DHAVE_STRSIGNAL=0 \
|
-DHAVE_SETGROUPS=1 -DHAVE_STRERROR=0 -DHAVE_STRSIGNAL=0 \
|
||||||
-DHAVE_STRLCPY=1 -DHAVE_FLOCK_DECL=1 -DHAVE_REVOKE_DECL=1 \
|
-DHAVE_STRLCPY=1 -DHAVE_FLOCK_DECL=1 -DHAVE_REVOKE_DECL=1 \
|
||||||
-DHAVE_SYS_ERRLIST_DECL=1 -DHAVE_SYS_SIGLIST_DECL=1 \
|
-DHAVE_SYS_ERRLIST_DECL=1 -DHAVE_SYS_SIGLIST_DECL=1 \
|
||||||
-DHAVE_PERSISTENT_HISTORY=1 -DMKSH_BUILD_R=541
|
-DHAVE_PERSISTENT_HISTORY=1 -DMKSH_BUILD_R=549
|
||||||
CPPFLAGS+= -D${${PROG:L}_tf:C/(Mir${MAN:E}{0,1}){2}/4/:S/x/mksh_BUILD/:U}
|
CPPFLAGS+= -D${${PROG:L}_tf:C/(Mir${MAN:E}{0,1}){2}/4/:S/x/mksh_BUILD/:U}
|
||||||
CPPFLAGS+= -I.
|
CPPFLAGS+= -I.
|
||||||
COPTS+= -std=c89 -Wall
|
COPTS+= -std=c89 -Wall
|
||||||
@ -100,7 +100,7 @@ regress: ${PROG} check.pl check.t
|
|||||||
echo export FNORD=666 >regress-dir/.mkshrc
|
echo export FNORD=666 >regress-dir/.mkshrc
|
||||||
HOME=$$(realpath regress-dir) perl ${SRCDIR}/check.pl \
|
HOME=$$(realpath regress-dir) perl ${SRCDIR}/check.pl \
|
||||||
-s ${SRCDIR}/check.t -v -p ./${PROG} \
|
-s ${SRCDIR}/check.t -v -p ./${PROG} \
|
||||||
-C shell:legacy-no,int:32,fastbox
|
-C shell:legacy-no,int:32,shell:textmode-no,shell:binmode-yes,fastbox
|
||||||
|
|
||||||
TEST_BUILD_ENV:= TARGET_OS= CPP=
|
TEST_BUILD_ENV:= TARGET_OS= CPP=
|
||||||
TEST_BUILD_ENV+= HAVE_STRING_POOLING=0
|
TEST_BUILD_ENV+= HAVE_STRING_POOLING=0
|
||||||
|
57
check.t
57
check.t
@ -1,4 +1,4 @@
|
|||||||
# $MirOS: src/bin/mksh/check.t,v 1.765 2017/03/22 00:20:39 tg Exp $
|
# $MirOS: src/bin/mksh/check.t,v 1.767 2017/04/02 14:14:04 tg Exp $
|
||||||
# -*- mode: sh -*-
|
# -*- mode: sh -*-
|
||||||
#-
|
#-
|
||||||
# Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
# Copyright © 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||||
@ -30,22 +30,40 @@
|
|||||||
# (2013/12/02 20:39:44) http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/regress/bin/ksh/?sortby=date
|
# (2013/12/02 20:39:44) http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/regress/bin/ksh/?sortby=date
|
||||||
|
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
@(#)MIRBSD KSH R54 2017/03/21
|
@(#)MIRBSD KSH R54 2017/03/25
|
||||||
description:
|
description:
|
||||||
Check version of shell.
|
Check version of shell.
|
||||||
stdin:
|
stdin:
|
||||||
echo $KSH_VERSION
|
echo $KSH_VERSION
|
||||||
name: KSH_VERSION
|
name: KSH_VERSION
|
||||||
category: shell:legacy-no
|
category: !shell:legacy-yes,!shell:textmode-yes
|
||||||
---
|
---
|
||||||
expected-stdout:
|
expected-stdout:
|
||||||
@(#)LEGACY KSH R54 2017/03/21
|
@(#)LEGACY KSH R54 2017/03/25
|
||||||
description:
|
description:
|
||||||
Check version of legacy shell.
|
Check version of legacy shell.
|
||||||
stdin:
|
stdin:
|
||||||
echo $KSH_VERSION
|
echo $KSH_VERSION
|
||||||
name: KSH_VERSION-legacy
|
name: KSH_VERSION-legacy
|
||||||
category: shell:legacy-yes
|
category: !shell:legacy-no,!shell:textmode-yes
|
||||||
|
---
|
||||||
|
expected-stdout:
|
||||||
|
@(#)MIRBSD KSH R54 2017/03/25 +TEXTMODE
|
||||||
|
description:
|
||||||
|
Check version of shell.
|
||||||
|
stdin:
|
||||||
|
echo $KSH_VERSION
|
||||||
|
name: KSH_VERSION-textmode
|
||||||
|
category: !shell:legacy-yes,!shell:textmode-no
|
||||||
|
---
|
||||||
|
expected-stdout:
|
||||||
|
@(#)LEGACY KSH R54 2017/03/25 +TEXTMODE
|
||||||
|
description:
|
||||||
|
Check version of legacy shell.
|
||||||
|
stdin:
|
||||||
|
echo $KSH_VERSION
|
||||||
|
name: KSH_VERSION-legacy-textmode
|
||||||
|
category: !shell:legacy-no,!shell:textmode-no
|
||||||
---
|
---
|
||||||
name: selftest-1
|
name: selftest-1
|
||||||
description:
|
description:
|
||||||
@ -112,7 +130,7 @@ stdin:
|
|||||||
expected-stdout:
|
expected-stdout:
|
||||||
:
|
:
|
||||||
---
|
---
|
||||||
name: selftest-pathsep-os2
|
name: selftest-pathsep-dospath
|
||||||
description:
|
description:
|
||||||
Check that $PATHSEP is set correctly.
|
Check that $PATHSEP is set correctly.
|
||||||
category: os:os2
|
category: os:os2
|
||||||
@ -9423,6 +9441,7 @@ expected-stdout:
|
|||||||
name: print-crlf
|
name: print-crlf
|
||||||
description:
|
description:
|
||||||
Check that CR+LF is shown and read as-is
|
Check that CR+LF is shown and read as-is
|
||||||
|
category: shell:textmode-no
|
||||||
stdin:
|
stdin:
|
||||||
cat >foo <<-'EOF'
|
cat >foo <<-'EOF'
|
||||||
x='bar
|
x='bar
|
||||||
@ -9445,6 +9464,32 @@ expected-stdout:
|
|||||||
{.5}
|
{.5}
|
||||||
{<bar
}
|
{<bar
}
|
||||||
---
|
---
|
||||||
|
name: print-crlf-textmode
|
||||||
|
description:
|
||||||
|
Check that CR+LF is treated as newline
|
||||||
|
category: shell:textmode-yes
|
||||||
|
stdin:
|
||||||
|
cat >foo <<-'EOF'
|
||||||
|
x='bar
|
||||||
|
' #
|
||||||
|
echo .${#x} #
|
||||||
|
if test x"$KSH_VERSION" = x""; then #
|
||||||
|
printf '<%s>' "$x" #
|
||||||
|
else #
|
||||||
|
print -nr -- "<$x>" #
|
||||||
|
fi #
|
||||||
|
EOF
|
||||||
|
echo "[$("$__progname" foo)]"
|
||||||
|
"$__progname" foo | while IFS= read -r line; do
|
||||||
|
print -r -- "{$line}"
|
||||||
|
done
|
||||||
|
expected-stdout:
|
||||||
|
[.4
|
||||||
|
<bar
|
||||||
|
>]
|
||||||
|
{.4}
|
||||||
|
{<bar}
|
||||||
|
---
|
||||||
name: print-lf
|
name: print-lf
|
||||||
description:
|
description:
|
||||||
Check that LF-only is shown and read as-is
|
Check that LF-only is shown and read as-is
|
||||||
|
8
eval.c
8
eval.c
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.198 2017/03/11 22:49:55 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/eval.c,v 1.199 2017/03/26 00:10:23 tg Exp $");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* string expansion
|
* string expansion
|
||||||
@ -1216,7 +1216,7 @@ varsub(Expand *xp, const char *sp, const char *word,
|
|||||||
} else if (ctype(c, C_SUBOP1)) {
|
} else if (ctype(c, C_SUBOP1)) {
|
||||||
slen += 2;
|
slen += 2;
|
||||||
stype |= c;
|
stype |= c;
|
||||||
} else if (ctype(c, C_SUBOP2)) {
|
} else if (ksh_issubop2(c)) {
|
||||||
/* Note: ksh88 allows :%, :%%, etc */
|
/* Note: ksh88 allows :%, :%%, etc */
|
||||||
slen += 2;
|
slen += 2;
|
||||||
stype = c;
|
stype = c;
|
||||||
@ -1324,7 +1324,7 @@ varsub(Expand *xp, const char *sp, const char *word,
|
|||||||
|
|
||||||
c = stype & 0x7F;
|
c = stype & 0x7F;
|
||||||
/* test the compiler's code generator */
|
/* test the compiler's code generator */
|
||||||
if (((stype < 0x100) && (ctype(c, C_SUBOP2) ||
|
if (((stype < 0x100) && (ksh_issubop2(c) ||
|
||||||
(((stype & 0x80) ? *xp->str == '\0' : xp->str == null) &&
|
(((stype & 0x80) ? *xp->str == '\0' : xp->str == null) &&
|
||||||
(state != XARG || (ifs0 || xp->split ?
|
(state != XARG || (ifs0 || xp->split ?
|
||||||
(xp->u.strv[0] == NULL) : !hasnonempty(xp->u.strv))) ?
|
(xp->u.strv[0] == NULL) : !hasnonempty(xp->u.strv))) ?
|
||||||
@ -1334,7 +1334,7 @@ varsub(Expand *xp, const char *sp, const char *word,
|
|||||||
/* expand word instead of variable value */
|
/* expand word instead of variable value */
|
||||||
state = XBASE;
|
state = XBASE;
|
||||||
if (Flag(FNOUNSET) && xp->str == null && !zero_ok &&
|
if (Flag(FNOUNSET) && xp->str == null && !zero_ok &&
|
||||||
(ctype(c, C_SUBOP2) || (state != XBASE && c != '+')))
|
(ksh_issubop2(c) || (state != XBASE && c != '+')))
|
||||||
errorf(Tf_parm, sp);
|
errorf(Tf_parm, sp);
|
||||||
*stypep = stype;
|
*stypep = stype;
|
||||||
*slenp = slen;
|
*slenp = slen;
|
||||||
|
4
exec.c
4
exec.c
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.191 2017/03/22 00:20:51 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/exec.c,v 1.192 2017/04/02 13:08:06 tg Exp $");
|
||||||
|
|
||||||
#ifndef MKSH_DEFAULT_EXECSHELL
|
#ifndef MKSH_DEFAULT_EXECSHELL
|
||||||
#define MKSH_DEFAULT_EXECSHELL MKSH_UNIXROOT "/bin/sh"
|
#define MKSH_DEFAULT_EXECSHELL MKSH_UNIXROOT "/bin/sh"
|
||||||
@ -1163,7 +1163,7 @@ findcom(const char *name, int flags)
|
|||||||
union mksh_cchack npath;
|
union mksh_cchack npath;
|
||||||
|
|
||||||
if (mksh_vdirsep(name)
|
if (mksh_vdirsep(name)
|
||||||
#ifdef __OS2__
|
#ifdef MKSH_DOSPATH
|
||||||
&& (strcmp(name, T_builtin) != 0)
|
&& (strcmp(name, T_builtin) != 0)
|
||||||
#endif
|
#endif
|
||||||
) {
|
) {
|
||||||
|
9
expr.c
9
expr.c
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||||
* 2011, 2012, 2013, 2014, 2016
|
* 2011, 2012, 2013, 2014, 2016, 2017
|
||||||
* mirabilos <m@mirbsd.org>
|
* mirabilos <m@mirbsd.org>
|
||||||
*
|
*
|
||||||
* Provided that these terms and disclaimer and all copyright notices
|
* Provided that these terms and disclaimer and all copyright notices
|
||||||
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.90 2016/11/07 16:58:48 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/expr.c,v 1.91 2017/03/26 00:10:23 tg Exp $");
|
||||||
|
|
||||||
#define EXPRTOK_DEFNS
|
#define EXPRTOK_DEFNS
|
||||||
#include "exprtok.h"
|
#include "exprtok.h"
|
||||||
@ -572,8 +572,9 @@ exprtoken(Expr_state *es)
|
|||||||
if (c == '\0')
|
if (c == '\0')
|
||||||
es->tok = END;
|
es->tok = END;
|
||||||
else if (ksh_isalphx(c)) {
|
else if (ksh_isalphx(c)) {
|
||||||
for (; ksh_isalnux(c); c = *cp)
|
do {
|
||||||
cp++;
|
c = *++cp;
|
||||||
|
} while (ksh_isalnux(c));
|
||||||
if (c == '[') {
|
if (c == '[') {
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
|
4
lex.c
4
lex.c
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.231 2017/03/22 00:20:43 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.232 2017/03/26 00:10:24 tg Exp $");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* states while lexing word
|
* states while lexing word
|
||||||
@ -489,7 +489,7 @@ yylex(int cf)
|
|||||||
* If this is a trim operation,
|
* If this is a trim operation,
|
||||||
* treat (,|,) specially in STBRACE.
|
* treat (,|,) specially in STBRACE.
|
||||||
*/
|
*/
|
||||||
if (ctype(c, C_SUBOP2)) {
|
if (ksh_issubop2(c)) {
|
||||||
ungetsc(c);
|
ungetsc(c);
|
||||||
if (Flag(FSH))
|
if (Flag(FSH))
|
||||||
PUSH_STATE(STBRACEBOURNE);
|
PUSH_STATE(STBRACEBOURNE);
|
||||||
|
10
lksh.1
10
lksh.1
@ -1,4 +1,4 @@
|
|||||||
.\" $MirOS: src/bin/mksh/lksh.1,v 1.22 2017/02/27 16:04:37 tg Exp $
|
.\" $MirOS: src/bin/mksh/lksh.1,v 1.23 2017/04/02 13:38:02 tg Exp $
|
||||||
.\"-
|
.\"-
|
||||||
.\" Copyright (c) 2008, 2009, 2010, 2012, 2013, 2015, 2016, 2017
|
.\" Copyright (c) 2008, 2009, 2010, 2012, 2013, 2015, 2016, 2017
|
||||||
.\" mirabilos <m@mirbsd.org>
|
.\" mirabilos <m@mirbsd.org>
|
||||||
@ -74,7 +74,7 @@
|
|||||||
.\" with -mandoc, it might implement .Mx itself, but we want to
|
.\" with -mandoc, it might implement .Mx itself, but we want to
|
||||||
.\" use our own definition. And .Dd must come *first*, always.
|
.\" use our own definition. And .Dd must come *first*, always.
|
||||||
.\"
|
.\"
|
||||||
.Dd $Mdocdate: February 27 2017 $
|
.Dd $Mdocdate: April 2 2017 $
|
||||||
.\"
|
.\"
|
||||||
.\" Check which macro package we use, and do other -mdoc setup.
|
.\" Check which macro package we use, and do other -mdoc setup.
|
||||||
.\"
|
.\"
|
||||||
@ -263,15 +263,13 @@ Functions defined with the
|
|||||||
reserved word share the shell options
|
reserved word share the shell options
|
||||||
.Pq Ic set -o
|
.Pq Ic set -o
|
||||||
instead of locally scoping them.
|
instead of locally scoping them.
|
||||||
.It
|
|
||||||
Support for persistent history is never compiled in.
|
|
||||||
.El
|
.El
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr mksh 1
|
.Xr mksh 1
|
||||||
.Pp
|
.Pp
|
||||||
.Pa https://www.mirbsd.org/mksh.htm
|
.Pa http://www.mirbsd.org/mksh.htm
|
||||||
.Pp
|
.Pp
|
||||||
.Pa https://www.mirbsd.org/ksh\-chan.htm
|
.Pa http://www.mirbsd.org/ksh\-chan.htm
|
||||||
.Sh CAVEATS
|
.Sh CAVEATS
|
||||||
To use
|
To use
|
||||||
.Nm
|
.Nm
|
||||||
|
11
misc.c
11
misc.c
@ -30,7 +30,7 @@
|
|||||||
#include <grp.h>
|
#include <grp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.252 2017/03/11 23:56:17 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/misc.c,v 1.254 2017/04/02 13:08:06 tg Exp $");
|
||||||
|
|
||||||
#define KSH_CHVT_FLAG
|
#define KSH_CHVT_FLAG
|
||||||
#ifdef MKSH_SMALL
|
#ifdef MKSH_SMALL
|
||||||
@ -89,11 +89,10 @@ setctypes(const char *s, int t)
|
|||||||
void
|
void
|
||||||
initctypes(void)
|
initctypes(void)
|
||||||
{
|
{
|
||||||
setctypes(letters_uc, C_ALPHA);
|
setctypes(letters_uc, C_ALPHX);
|
||||||
setctypes(letters_lc, C_ALPHA);
|
setctypes(letters_lc, C_ALPHX);
|
||||||
chtypes['_'] |= C_ALPHA;
|
chtypes['_'] |= C_ALPHX;
|
||||||
setctypes("0123456789", C_DIGIT);
|
setctypes("0123456789", C_DIGIT);
|
||||||
/* \0 added automatically */
|
|
||||||
setctypes(TC_LEX1, C_LEX1);
|
setctypes(TC_LEX1, C_LEX1);
|
||||||
setctypes("*@#!$-?", C_VAR1);
|
setctypes("*@#!$-?", C_VAR1);
|
||||||
setctypes(TC_IFSWS, C_IFSWS);
|
setctypes(TC_IFSWS, C_IFSWS);
|
||||||
@ -1706,7 +1705,7 @@ simplify_path(char *p)
|
|||||||
case 0:
|
case 0:
|
||||||
return;
|
return;
|
||||||
case '/':
|
case '/':
|
||||||
#ifdef __OS2__
|
#ifdef MKSH_DOSPATH
|
||||||
case '\\':
|
case '\\':
|
||||||
#endif
|
#endif
|
||||||
/* exactly two leading slashes? (SUSv4 3.266) */
|
/* exactly two leading slashes? (SUSv4 3.266) */
|
||||||
|
32
mksh.1
32
mksh.1
@ -1,4 +1,4 @@
|
|||||||
.\" $MirOS: src/bin/mksh/mksh.1,v 1.435 2017/03/19 22:31:27 tg Exp $
|
.\" $MirOS: src/bin/mksh/mksh.1,v 1.436 2017/04/02 14:14:07 tg Exp $
|
||||||
.\" $OpenBSD: ksh.1,v 1.160 2015/07/04 13:27:04 feinerer Exp $
|
.\" $OpenBSD: ksh.1,v 1.160 2015/07/04 13:27:04 feinerer Exp $
|
||||||
.\"-
|
.\"-
|
||||||
.\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
|
.\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
|
||||||
@ -76,7 +76,7 @@
|
|||||||
.\" with -mandoc, it might implement .Mx itself, but we want to
|
.\" with -mandoc, it might implement .Mx itself, but we want to
|
||||||
.\" use our own definition. And .Dd must come *first*, always.
|
.\" use our own definition. And .Dd must come *first*, always.
|
||||||
.\"
|
.\"
|
||||||
.Dd $Mdocdate: March 19 2017 $
|
.Dd $Mdocdate: April 2 2017 $
|
||||||
.\"
|
.\"
|
||||||
.\" Check which macro package we use, and do other -mdoc setup.
|
.\" Check which macro package we use, and do other -mdoc setup.
|
||||||
.\"
|
.\"
|
||||||
@ -6455,7 +6455,7 @@ contains the system and suid profile.
|
|||||||
.Xr utf\-8 7 ,
|
.Xr utf\-8 7 ,
|
||||||
.Xr mknod 8
|
.Xr mknod 8
|
||||||
.Pp
|
.Pp
|
||||||
.Pa https://www.mirbsd.org/ksh\-chan.htm
|
.Pa http://www.mirbsd.org/ksh\-chan.htm
|
||||||
.Rs
|
.Rs
|
||||||
.%A Morris Bolsky
|
.%A Morris Bolsky
|
||||||
.%B "The KornShell Command and Programming Language"
|
.%B "The KornShell Command and Programming Language"
|
||||||
@ -6549,9 +6549,17 @@ The effort of several projects, such as Debian and OpenBSD, and other
|
|||||||
contributors including our users, to improve the shell is appreciated.
|
contributors including our users, to improve the shell is appreciated.
|
||||||
See the documentation, web site and CVS for details.
|
See the documentation, web site and CVS for details.
|
||||||
.Pp
|
.Pp
|
||||||
|
.Nm mksh\-os2
|
||||||
|
is developed by
|
||||||
|
.An KO Myung-Hun Aq Mt komh@chollian.net .
|
||||||
|
.Pp
|
||||||
|
.Nm mksh\-w32
|
||||||
|
is developed by
|
||||||
|
.An Michael Langguth Aq Mt lan@scalaris.com .
|
||||||
|
.Pp
|
||||||
The BSD daemon is Copyright \(co Marshall Kirk McKusick.
|
The BSD daemon is Copyright \(co Marshall Kirk McKusick.
|
||||||
The complete legalese is at:
|
The complete legalese is at:
|
||||||
.Pa https://www.mirbsd.org/TaC\-mksh.txt
|
.Pa http://www.mirbsd.org/TaC\-mksh.txt
|
||||||
.\"
|
.\"
|
||||||
.\" This boils down to: feel free to use mksh.ico as application icon
|
.\" This boils down to: feel free to use mksh.ico as application icon
|
||||||
.\" or shortcut for mksh or mksh/Win32 or OS/2; distro patches are ok
|
.\" or shortcut for mksh or mksh/Win32 or OS/2; distro patches are ok
|
||||||
@ -6690,9 +6698,19 @@ not in the search path at all; if you really need this, run the command
|
|||||||
.Li PATH=.$PATHSEP$PATH
|
.Li PATH=.$PATHSEP$PATH
|
||||||
or add that to a suitable initialisation file.
|
or add that to a suitable initialisation file.
|
||||||
.Pp
|
.Pp
|
||||||
You will have gotten this shell through komh's port on Shellworld
|
There are two different newline modes for mksh-os2: standard (Unix) mode,
|
||||||
most likely. It differs from standard mksh in that ASCII (CR+LF)
|
in which only LF (0A hex) is supported as line separator, and "textmode",
|
||||||
newlines are accepted in many places.
|
which also accepts ASCII newlines (CR+LF), like most other tools on OS/2,
|
||||||
|
but creating an incompatibility with standard
|
||||||
|
.Nm .
|
||||||
|
If you compiled mksh from source, you will get the standard Unix mode unless
|
||||||
|
.Fl T
|
||||||
|
is added during compilation; you will most likely have gotten this shell
|
||||||
|
through komh's port on OS/2World, or from his OS/2 Factory on eComStation
|
||||||
|
Korea, which uses "textmode", though.
|
||||||
|
Most OS/2 users will want to use "textmode" unless they need absolute
|
||||||
|
compatibility with Unix
|
||||||
|
.Nm .
|
||||||
.Ss "How do I start mksh on a specific terminal?"
|
.Ss "How do I start mksh on a specific terminal?"
|
||||||
Normally:
|
Normally:
|
||||||
.Dl mksh \-T/dev/tty2
|
.Dl mksh \-T/dev/tty2
|
||||||
|
61
sh.h
61
sh.h
@ -175,9 +175,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef EXTERN
|
#ifdef EXTERN
|
||||||
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.797 2017/03/22 00:20:53 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.800 2017/04/02 14:14:08 tg Exp $");
|
||||||
#endif
|
#endif
|
||||||
#define MKSH_VERSION "R54 2017/03/21"
|
#define MKSH_VERSION "R54 2017/03/25"
|
||||||
|
|
||||||
/* arithmetic types: C implementation */
|
/* arithmetic types: C implementation */
|
||||||
#if !HAVE_CAN_INTTYPES
|
#if !HAVE_CAN_INTTYPES
|
||||||
@ -392,13 +392,20 @@ struct rusage {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __OS2__
|
#ifdef __OS2__
|
||||||
|
#define MKSH_UNIXROOT "/@unixroot"
|
||||||
|
#else
|
||||||
|
#define MKSH_UNIXROOT ""
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MKSH_DOSPATH
|
||||||
|
#ifndef __GNUC__
|
||||||
|
# error GCC extensions needed later on
|
||||||
|
#endif
|
||||||
#define MKSH_PATHSEPS ";"
|
#define MKSH_PATHSEPS ";"
|
||||||
#define MKSH_PATHSEPC ';'
|
#define MKSH_PATHSEPC ';'
|
||||||
#define MKSH_UNIXROOT "/@unixroot"
|
|
||||||
#else
|
#else
|
||||||
#define MKSH_PATHSEPS ":"
|
#define MKSH_PATHSEPS ":"
|
||||||
#define MKSH_PATHSEPC ':'
|
#define MKSH_PATHSEPC ':'
|
||||||
#define MKSH_UNIXROOT ""
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !HAVE_FLOCK_DECL
|
#if !HAVE_FLOCK_DECL
|
||||||
@ -505,12 +512,20 @@ extern int __cdecl setegid(gid_t);
|
|||||||
EXTERN const char *safe_prompt; /* safe prompt if PS1 substitution fails */
|
EXTERN const char *safe_prompt; /* safe prompt if PS1 substitution fails */
|
||||||
|
|
||||||
#ifdef MKSH_LEGACY_MODE
|
#ifdef MKSH_LEGACY_MODE
|
||||||
#define KSH_VERSIONNAME "LEGACY"
|
#define KSH_VERSIONNAME_ISLEGACY "LEGACY"
|
||||||
#else
|
#else
|
||||||
#define KSH_VERSIONNAME "MIRBSD"
|
#define KSH_VERSIONNAME_ISLEGACY "MIRBSD"
|
||||||
#endif
|
#endif
|
||||||
EXTERN const char initvsn[] E_INIT("KSH_VERSION=@(#)" KSH_VERSIONNAME \
|
#ifdef MKSH_WITH_TEXTMODE
|
||||||
" KSH " MKSH_VERSION);
|
#define KSH_VERSIONNAME_TEXTMODE " +TEXTMODE"
|
||||||
|
#else
|
||||||
|
#define KSH_VERSIONNAME_TEXTMODE ""
|
||||||
|
#endif
|
||||||
|
#ifndef KSH_VERSIONNAME_VENDOR_EXT
|
||||||
|
#define KSH_VERSIONNAME_VENDOR_EXT ""
|
||||||
|
#endif
|
||||||
|
EXTERN const char initvsn[] E_INIT("KSH_VERSION=@(#)" KSH_VERSIONNAME_ISLEGACY \
|
||||||
|
" KSH " MKSH_VERSION KSH_VERSIONNAME_TEXTMODE KSH_VERSIONNAME_VENDOR_EXT);
|
||||||
#define KSH_VERSION (initvsn + /* "KSH_VERSION=@(#)" */ 16)
|
#define KSH_VERSION (initvsn + /* "KSH_VERSION=@(#)" */ 16)
|
||||||
|
|
||||||
EXTERN const char digits_uc[] E_INIT("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
EXTERN const char digits_uc[] E_INIT("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||||
@ -578,7 +593,7 @@ char *ucstrstr(char *, const char *);
|
|||||||
#define mkssert(e) do { } while (/* CONSTCOND */ 0)
|
#define mkssert(e) do { } while (/* CONSTCOND */ 0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (!defined(MKSH_BUILDMAKEFILE4BSD) && !defined(MKSH_BUILDSH)) || (MKSH_BUILD_R != 541)
|
#if (!defined(MKSH_BUILDMAKEFILE4BSD) && !defined(MKSH_BUILDSH)) || (MKSH_BUILD_R != 549)
|
||||||
#error Must run Build.sh to compile this.
|
#error Must run Build.sh to compile this.
|
||||||
extern void thiswillneverbedefinedIhope(void);
|
extern void thiswillneverbedefinedIhope(void);
|
||||||
int
|
int
|
||||||
@ -1243,7 +1258,7 @@ EXTERN bool really_exit;
|
|||||||
/*
|
/*
|
||||||
* fast character classes
|
* fast character classes
|
||||||
*/
|
*/
|
||||||
#define C_ALPHA BIT(0) /* a-z_A-Z */
|
#define C_ALPHX BIT(0) /* A-Za-z_ */
|
||||||
#define C_DIGIT BIT(1) /* 0-9 */
|
#define C_DIGIT BIT(1) /* 0-9 */
|
||||||
#define C_LEX1 BIT(2) /* \t \n\0|&;<>() */
|
#define C_LEX1 BIT(2) /* \t \n\0|&;<>() */
|
||||||
#define C_VAR1 BIT(3) /* *@#!$-? */
|
#define C_VAR1 BIT(3) /* *@#!$-? */
|
||||||
@ -1251,17 +1266,16 @@ EXTERN bool really_exit;
|
|||||||
#define C_SUBOP1 BIT(5) /* "=-+?" */
|
#define C_SUBOP1 BIT(5) /* "=-+?" */
|
||||||
#define C_QUOTE BIT(6) /* \t\n "#$&'()*;<=>?[\]`| (needing quoting) */
|
#define C_QUOTE BIT(6) /* \t\n "#$&'()*;<=>?[\]`| (needing quoting) */
|
||||||
#define C_IFS BIT(7) /* $IFS */
|
#define C_IFS BIT(7) /* $IFS */
|
||||||
#define C_SUBOP2 BIT(8) /* "#%" (magic, see below) */
|
|
||||||
|
|
||||||
extern unsigned char chtypes[];
|
extern unsigned char chtypes[];
|
||||||
|
|
||||||
#define ctype(c, t) tobool( ((t) == C_SUBOP2) ? \
|
#define ctype(c, t) tobool(chtypes[(unsigned char)(c)] & (t))
|
||||||
(((c) == '#' || (c) == '%') ? 1 : 0) : \
|
|
||||||
(chtypes[(unsigned char)(c)] & (t)) )
|
|
||||||
#define ord(c) ((int)(unsigned char)(c))
|
#define ord(c) ((int)(unsigned char)(c))
|
||||||
#define ksh_isalphx(c) ctype((c), C_ALPHA)
|
#define ksh_issubop2(c) tobool((c) == ord('#') || (c) == ord('%'))
|
||||||
#define ksh_isalnux(c) ctype((c), C_ALPHA | C_DIGIT)
|
#define ksh_isalpha(c) (ctype((c), C_ALPHX) && (c) != ord('_'))
|
||||||
#define ksh_isdigit(c) (((c) >= '0') && ((c) <= '9'))
|
#define ksh_isalphx(c) ctype((c), C_ALPHX)
|
||||||
|
#define ksh_isalnux(c) ctype((c), C_ALPHX | C_DIGIT)
|
||||||
|
#define ksh_isdigit(c) ctype((c), C_DIGIT)
|
||||||
#define ksh_islower(c) (((c) >= 'a') && ((c) <= 'z'))
|
#define ksh_islower(c) (((c) >= 'a') && ((c) <= 'z'))
|
||||||
#define ksh_isupper(c) (((c) >= 'A') && ((c) <= 'Z'))
|
#define ksh_isupper(c) (((c) >= 'A') && ((c) <= 'Z'))
|
||||||
#define ksh_tolower(c) (ksh_isupper(c) ? (c) - 'A' + 'a' : (c))
|
#define ksh_tolower(c) (ksh_isupper(c) ? (c) - 'A' + 'a' : (c))
|
||||||
@ -2414,9 +2428,6 @@ EXTERN bool tty_hasstate; /* true if tty_state is valid */
|
|||||||
extern int tty_init_fd(void); /* initialise tty_fd, tty_devtty */
|
extern int tty_init_fd(void); /* initialise tty_fd, tty_devtty */
|
||||||
|
|
||||||
#ifdef __OS2__
|
#ifdef __OS2__
|
||||||
#ifndef __GNUC__
|
|
||||||
# error oops?
|
|
||||||
#endif
|
|
||||||
#define binopen2(path,flags) __extension__({ \
|
#define binopen2(path,flags) __extension__({ \
|
||||||
int binopen2_fd = open((path), (flags) | O_BINARY); \
|
int binopen2_fd = open((path), (flags) | O_BINARY); \
|
||||||
if (binopen2_fd >= 0) \
|
if (binopen2_fd >= 0) \
|
||||||
@ -2429,10 +2440,16 @@ extern int tty_init_fd(void); /* initialise tty_fd, tty_devtty */
|
|||||||
setmode(binopen3_fd, O_BINARY); \
|
setmode(binopen3_fd, O_BINARY); \
|
||||||
(binopen3_fd); \
|
(binopen3_fd); \
|
||||||
})
|
})
|
||||||
|
#else
|
||||||
|
#define binopen2(path,flags) open((path), (flags) | O_BINARY)
|
||||||
|
#define binopen3(path,flags,mode) open((path), (flags) | O_BINARY, (mode))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef MKSH_DOSPATH
|
||||||
#define mksh_abspath(s) __extension__({ \
|
#define mksh_abspath(s) __extension__({ \
|
||||||
const char *mksh_abspath_s = (s); \
|
const char *mksh_abspath_s = (s); \
|
||||||
(mksh_cdirsep(mksh_abspath_s[0]) || \
|
(mksh_cdirsep(mksh_abspath_s[0]) || \
|
||||||
(ksh_isalphx(mksh_abspath_s[0]) && \
|
(ksh_isalpha(mksh_abspath_s[0]) && \
|
||||||
mksh_abspath_s[1] == ':')); \
|
mksh_abspath_s[1] == ':')); \
|
||||||
})
|
})
|
||||||
#define mksh_cdirsep(c) __extension__({ \
|
#define mksh_cdirsep(c) __extension__({ \
|
||||||
@ -2448,8 +2465,6 @@ extern int tty_init_fd(void); /* initialise tty_fd, tty_devtty */
|
|||||||
})
|
})
|
||||||
#define mksh_vdirsep(s) (mksh_sdirsep((s)) != NULL)
|
#define mksh_vdirsep(s) (mksh_sdirsep((s)) != NULL)
|
||||||
#else
|
#else
|
||||||
#define binopen2(path,flags) open((path), (flags) | O_BINARY)
|
|
||||||
#define binopen3(path,flags,mode) open((path), (flags) | O_BINARY, (mode))
|
|
||||||
#define mksh_abspath(s) ((s)[0] == '/')
|
#define mksh_abspath(s) ((s)[0] == '/')
|
||||||
#define mksh_cdirsep(c) ((c) == '/')
|
#define mksh_cdirsep(c) ((c) == '/')
|
||||||
#define mksh_sdirsep(s) strchr((s), '/')
|
#define mksh_sdirsep(s) strchr((s), '/')
|
||||||
|
9
var.c
9
var.c
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
* Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
|
||||||
* 2011, 2012, 2013, 2014, 2015, 2016
|
* 2011, 2012, 2013, 2014, 2015, 2016, 2017
|
||||||
* mirabilos <m@mirbsd.org>
|
* mirabilos <m@mirbsd.org>
|
||||||
*
|
*
|
||||||
* Provided that these terms and disclaimer and all copyright notices
|
* Provided that these terms and disclaimer and all copyright notices
|
||||||
@ -28,7 +28,7 @@
|
|||||||
#include <sys/sysctl.h>
|
#include <sys/sysctl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.209 2016/11/11 23:31:39 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.210 2017/03/26 00:10:26 tg Exp $");
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Variables
|
* Variables
|
||||||
@ -1053,8 +1053,9 @@ skip_varname(const char *s, bool aok)
|
|||||||
size_t alen;
|
size_t alen;
|
||||||
|
|
||||||
if (s && ksh_isalphx(*s)) {
|
if (s && ksh_isalphx(*s)) {
|
||||||
while (*++s && ksh_isalnux(*s))
|
do {
|
||||||
;
|
++s;
|
||||||
|
} while (ksh_isalnux(*s));
|
||||||
if (aok && *s == '[' && (alen = array_ref_len(s)))
|
if (aok && *s == '[' && (alen = array_ref_len(s)))
|
||||||
s += alen;
|
s += alen;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user