drop all deprecated code, you have been warned

This commit is contained in:
tg 2012-04-07 11:19:53 +00:00
parent 2d879f3b79
commit 5b4d0dbbc5
7 changed files with 26 additions and 188 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.542 2012/04/06 23:10:50 tg Exp $'
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.543 2012/04/07 11:19:45 tg Exp $'
#-
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012
@ -1268,9 +1268,9 @@ ac_ifcpp 'ifdef MKSH_ASSUME_UTF8' isset_MKSH_ASSUME_UTF8 '' \
ac_ifcpp 'ifdef MKSH_CONSERVATIVE_FDS' isset_MKSH_CONSERVATIVE_FDS '' \
'if traditional/conservative fd use is requested' && \
check_categories="$check_categories convfds"
ac_ifcpp 'ifdef MKSH_DISABLE_DEPRECATED' isset_MKSH_DISABLE_DEPRECATED '' \
"if deprecated features are to be omitted" && \
check_categories="$check_categories nodeprecated"
#ac_ifcpp 'ifdef MKSH_DISABLE_DEPRECATED' isset_MKSH_DISABLE_DEPRECATED '' \
# "if deprecated features are to be omitted" && \
# check_categories="$check_categories nodeprecated"
#
# Environment: headers
@ -1392,7 +1392,7 @@ else
#define EXTERN
#define MKSH_INCLUDES_ONLY
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.542 2012/04/06 23:10:50 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.543 2012/04/07 11:19:45 tg Exp $");
int main(void) { printf("Hello, World!\n"); return (0); }
EOF
case $cm in

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/Makefile,v 1.96 2012/03/27 23:13:41 tg Exp $
# $MirOS: src/bin/mksh/Makefile,v 1.97 2012/04/07 11:19:46 tg Exp $
#-
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012
@ -41,14 +41,13 @@ CPPFLAGS+= -DMKSH_ASSUME_UTF8 -DMKSH_DISABLE_DEPRECATED \
-DHAVE_CAN_INT8TYPE=1 -DHAVE_CAN_UCBINT8=1 -DHAVE_RLIM_T=1 \
-DHAVE_SIG_T=1 -DHAVE_SYS_SIGNAME=1 -DHAVE_SYS_SIGLIST=1 \
-DHAVE_STRSIGNAL=0 -DHAVE_FLOCK=1 -DHAVE_LOCK_FCNTL=1 \
-DHAVE_MMAP=1 -DHAVE_GETRUSAGE=1 -DHAVE_KILLPG=1 \
-DHAVE_MKNOD=0 -DHAVE_MKSTEMP=1 -DHAVE_NICE=1 -DHAVE_REVOKE=1 \
-DHAVE_GETRUSAGE=1 -DHAVE_KILLPG=1 -DHAVE_MKNOD=0 \
-DHAVE_MKSTEMP=1 -DHAVE_MMAP=1 -DHAVE_NICE=1 -DHAVE_REVOKE=1 \
-DHAVE_SETLOCALE_CTYPE=0 -DHAVE_LANGINFO_CODESET=0 \
-DHAVE_SELECT=1 -DHAVE_SETRESUGID=1 -DHAVE_SETGROUPS=1 \
-DHAVE_STRCASESTR=1 -DHAVE_STRLCPY=1 -DHAVE_FLOCK_DECL=1 \
-DHAVE_REVOKE_DECL=1 -DHAVE_SYS_SIGLIST_DECL=1 \
-DHAVE_PERSISTENT_HISTORY=1 -DHAVE_SILENT_IDIVWRAPV=0 \
-DMKSH_BUILD_R=409
-DHAVE_STRLCPY=1 -DHAVE_FLOCK_DECL=1 -DHAVE_REVOKE_DECL=1 \
-DHAVE_SYS_SIGLIST_DECL=1 -DHAVE_PERSISTENT_HISTORY=1 \
-DHAVE_SILENT_IDIVWRAPV=0 -DMKSH_BUILD_R=409
CPPFLAGS+= -D${${PROG:L}_tf:C/(Mir${MAN:E}{0,1}){2}/4/:S/x/mksh_BUILD/:U}
COPTS+= -std=c99 -Wall
.endif

126
check.t
View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.530 2012/04/06 12:30:40 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.531 2012/04/07 11:19:47 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 $
@ -29,7 +29,7 @@
# http://www.freebsd.org/cgi/cvsweb.cgi/src/tools/regression/bin/test/regress.sh?rev=HEAD
expected-stdout:
@(#)MIRBSD KSH R40 2012/03/29
@(#)MIRBSD KSH R40 2012/04/07
description:
Check version of shell.
stdin:
@ -3422,7 +3422,6 @@ expected-stdout:
name: integer-base-err-1
description:
Can't have 0 base (causes shell to exit)
category: nodeprecated
expected-exit: e != 0
stdin:
typeset -i i
@ -3432,19 +3431,6 @@ stdin:
expected-stderr-pattern:
/^.*:.*0#4.*\n$/
---
name: integer-base-err-1-deprecated
description:
Can't have 0 base (causes shell to exit)
category: !nodeprecated
expected-exit: e != 0
stdin:
typeset -i i
i=3
i=0#4
echo $i
expected-stderr-pattern:
/^.*octal is deprecated\n.*:.*0#4.*\n$/
---
name: integer-base-err-2
description:
Can't have multiple bases in a 'constant' (causes shell to exit)
@ -3640,22 +3626,10 @@ expected-stdout:
64
64
---
name: integer-base-check-flat-posix
description:
Check behaviour of POSuX bases
category: !nodeprecated
stdin:
echo :$((10)).$((010)).$((0x10)).
expected-stdout:
:10.8.16.
expected-stderr-pattern:
/octal is deprecated/
---
name: integer-base-check-flat-right
name: integer-base-check-flat
description:
Check behaviour does not match POSuX, because a not type-safe
scripting language has *no* business interpreting "010" as octal
category: nodeprecated
stdin:
echo :$((10)).$((010)).$((0x10)).
expected-stdout:
@ -9429,99 +9403,6 @@ expected-stdout:
11 0
12 0
---
name: event-subst-1a
description:
Check that '!' substitution in interactive mode works
category: !smksh,!nodeprecated
file-setup: file 755 "falsetto"
#! /bin/sh
echo molto bene
exit 42
file-setup: file 755 "!false"
#! /bin/sh
echo si
need-ctty: yes
arguments: !-i!
stdin:
export PATH=.:$PATH
falsetto
echo yeap
!false
expected-exit: 42
expected-stdout:
molto bene
yeap
molto bene
expected-stderr-pattern:
/.*/
---
name: event-subst-1b
description:
Check that '!' substitution in interactive mode works
even when a space separates it from the search command,
which is not what GNU bash provides but required for the
other regression tests below to check
category: !smksh,!nodeprecated
file-setup: file 755 "falsetto"
#! /bin/sh
echo molto bene
exit 42
file-setup: file 755 "!"
#! /bin/sh
echo si
need-ctty: yes
arguments: !-i!
stdin:
export PATH=.:$PATH
falsetto
echo yeap
! false
expected-exit: 42
expected-stdout:
molto bene
yeap
molto bene
expected-stderr-pattern:
/.*/
---
name: event-subst-2
description:
Check that '!' substitution in interactive mode
does not break things
category: !smksh,!nodeprecated
file-setup: file 755 "falsetto"
#! /bin/sh
echo molto bene
exit 42
file-setup: file 755 "!"
#! /bin/sh
echo si
need-ctty: yes
arguments: !-i!
env-setup: !ENV=./Env!
file-setup: file 644 "Env"
PS1=X
stdin:
export PATH=.:$PATH
falsetto
echo yeap
!false
echo meow
! false
echo = $?
if
! false; then echo foo; else echo bar; fi
expected-stdout:
molto bene
yeap
molto bene
meow
molto bene
= 42
foo
expected-stderr-pattern:
/.*/
---
name: event-subst-3
description:
Check that '!' substitution in noninteractive mode is ignored
@ -9554,7 +9435,6 @@ expected-stdout:
name: event-subst-0
description:
Check that '!' substitution in interactive mode is ignored
category: nodeprecated
need-ctty: yes
arguments: !-i!
file-setup: file 755 "falsetto"

21
lex.c
View File

@ -22,7 +22,7 @@
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.160 2012/03/31 17:29:59 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/lex.c,v 1.161 2012/04/07 11:19:49 tg Exp $");
/*
* states while lexing word
@ -1440,25 +1440,6 @@ getsc_line(Source *s)
alarm(0);
}
cp = Xstring(s->xs, xp);
#if !defined(MKSH_SMALL) && !defined(MKSH_DISABLE_DEPRECATED)
if (interactive && *cp == '!' && cur_prompt == PS1) {
int linelen;
linelen = Xlength(s->xs, xp);
XcheckN(s->xs, xp, Zfc_e_dash + /* NUL */ 1);
/* reload after potential realloc */
cp = Xstring(s->xs, xp);
/* change initial '!' into space */
*cp = ' ';
/* NUL terminate the current string */
*xp = '\0';
/* move the actual string forward */
memmove(cp + Zfc_e_dash, cp, linelen + /* NUL */ 1);
xp += Zfc_e_dash;
/* prepend it with "fc -e -" */
memcpy(cp, Tfc_e_dash, Zfc_e_dash);
}
#endif
s->start = s->str = cp;
strip_nuls(Xstring(s->xs, xp), Xlength(s->xs, xp));
/* Note: if input is all nulls, this is not eof */

19
mksh.1
View File

@ -1,4 +1,4 @@
.\" $MirOS: src/bin/mksh/mksh.1,v 1.282 2012/03/23 23:25:27 tg Exp $
.\" $MirOS: src/bin/mksh/mksh.1,v 1.283 2012/04/07 11:19:49 tg Exp $
.\" $OpenBSD: ksh.1,v 1.141 2011/09/03 22:59:08 jmc Exp $
.\"-
.\" Copyright © 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
@ -72,7 +72,7 @@
.\" with -mandoc, it might implement .Mx itself, but we want to
.\" use our own definition. And .Dd must come *first*, always.
.\"
.Dd $Mdocdate: March 23 2012 $
.Dd $Mdocdate: April 7 2012 $
.\"
.\" Check which macro package we use
.\"
@ -2480,14 +2480,14 @@ is a decimal integer specifying the base, and
.Ar number
is a number in the specified base.
Additionally, base-16 integers may be specified by prefixing them with
.Sq 0x Pq case-insensitive
.Sq 0x
.Pq case-insensitive
in all forms of arithmetic expressions, except as numeric arguments to the
.Ic test
built-in command.
Base-8 integers may be specified by prefixing them with
.Sq 0 ,
but this is deprecated and will be removed in the next version of
.Nm .
It is discouraged to prefix numbers with a sole zero
.Pq Sq 0 ,
because some shells may interpret them as base-8 integers.
As a special
.Nm mksh
extension, numbers to the base of one are treated as either (8-bit
@ -3353,11 +3353,8 @@ The meaning of
and
.Fl s
is identical: re-execute the selected command without invoking an editor.
This command is usually accessed with the predefined
This command is usually accessed with the predefined:
.Ic alias r=\*(aqfc \-e \-\*(aq
or (deprecated; will be removed RSN) by prefixing an interactive mode input line with
.Sq \&!
.Pq wbx extension .
.Pp
.It Ic fg Op Ar job ...
Resume the specified job(s) in the foreground.

4
sh.h
View File

@ -152,9 +152,9 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.544 2012/04/06 15:23:11 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.545 2012/04/07 11:19:51 tg Exp $");
#endif
#define MKSH_VERSION "R40 2012/03/29"
#define MKSH_VERSION "R40 2012/04/07"
/* arithmetic types: C implementation */
#if !HAVE_CAN_INTTYPES

21
var.c
View File

@ -27,7 +27,7 @@
#include <sys/sysctl.h>
#endif
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.144 2012/03/24 19:13:27 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.145 2012/04/07 11:19:53 tg Exp $");
/*-
* Variables
@ -488,30 +488,11 @@ getint(struct tbl *vp, mksh_ari_t *nump, bool arith)
base = 10;
num = 0;
neg = 0;
#ifdef MKSH_DISABLE_DEPRECATED
if (arith && s[0] == '0' && (s[1] | 0x20) == 'x') {
s += 2;
base = 16;
have_base = true;
}
#else
if (arith && *s == '0' && *(s+1)) {
s++;
if (*s == 'x' || *s == 'X') {
s++;
base = 16;
} else if (vp->flag & ZEROFIL) {
while (*s == '0')
s++;
} else {
warningf(true, "interpreting %s[%lu]='%s' as octal"
" is deprecated", vp->name,
arrayindex(vp), vp->val.s + vp->type);
base = 8;
}
have_base = true;
}
#endif
while ((c = *s++)) {
if (c == '-') {
neg++;