add basic LEGACY KSH mode (Build.sh -L), no changes yet

This commit is contained in:
tg 2012-06-25 16:05:10 +00:00
parent b0543ef064
commit 967e929e98
3 changed files with 52 additions and 8 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.573 2012/06/24 20:47:07 tg Exp $'
srcversion='$MirOS: src/bin/mksh/Build.sh,v 1.574 2012/06/25 16:05:06 tg Exp $'
#-
# Copyright (c) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012
@ -316,6 +316,7 @@ cm=normal
optflags=-std-compile-opts
last=
tfn=
legacy=0
for i
do
@ -347,6 +348,12 @@ do
:-j)
pm=1
;;
:-L)
legacy=1
;;
:+L)
legacy=0
;;
:-M)
cm=makefile
;;
@ -385,7 +392,11 @@ if test -n "$last"; then
exit 1
fi
test -z "$tfn" && tfn=mksh
test -z "$tfn" && if test $legacy = 0; then
tfn=mksh
else
tfn=lksh
fi
if test -d $tfn || test -d $tfn.exe; then
echo "$me: Error: ./$tfn is a directory!" >&2
exit 1
@ -393,8 +404,16 @@ fi
rmf a.exe* a.out* conftest.c *core core.* lft ${tfn}* no *.bc *.ll *.o \
Rebuild.sh signames.inc test.sh x vv.out
SRCS="lalloc.c edit.c eval.c exec.c expr.c funcs.c histrap.c"
SRCS="$SRCS jobs.c lex.c main.c misc.c shf.c syn.c tree.c var.c"
SRCS="lalloc.c eval.c exec.c expr.c funcs.c histrap.c jobs.c"
SRCS="$SRCS lex.c main.c misc.c shf.c syn.c tree.c var.c"
if test $legacy = 0; then
SRCS="$SRCS edit.c"
check_categories="$check_categories shell:legacy-no"
else
check_categories="$check_categories shell:legacy-yes"
add_cppflags -DMKSH_LEGACY_MODE
fi
if test x"$srcdir" = x"."; then
CPPFLAGS="-I. $CPPFLAGS"
@ -1465,7 +1484,7 @@ else
#define EXTERN
#define MKSH_INCLUDES_ONLY
#include "sh.h"
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.573 2012/06/24 20:47:07 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/Build.sh,v 1.574 2012/06/25 16:05:06 tg Exp $");
int main(void) { printf("Hello, World!\n"); return (0); }
EOF
case $cm in

12
check.t
View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.538 2012/06/24 20:39:24 tg Exp $
# $MirOS: src/bin/mksh/check.t,v 1.539 2012/06/25 16:05:08 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 $
@ -35,6 +35,16 @@ description:
stdin:
echo $KSH_VERSION
name: KSH_VERSION
category: shell:legacy-no
---
expected-stdout:
@(#)LEGACY KSH R40 2012/06/24
description:
Check version of legacy shell.
stdin:
echo $KSH_VERSION
name: KSH_VERSION-legacy
category: shell:legacy-yes
---
name: selftest-1
description:

19
sh.h
View File

@ -157,7 +157,7 @@
#endif
#ifdef EXTERN
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.561 2012/06/24 20:39:26 tg Exp $");
__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.562 2012/06/25 16:05:10 tg Exp $");
#endif
#define MKSH_VERSION "R40 2012/06/24"
@ -427,7 +427,14 @@ extern int wcwidth(__WCHAR_TYPE__);
#define LINE 4096 /* input line size */
EXTERN const char *safe_prompt; /* safe prompt if PS1 substitution fails */
EXTERN const char initvsn[] E_INIT("KSH_VERSION=@(#)MIRBSD KSH " MKSH_VERSION);
#ifdef MKSH_LEGACY_MODE
#define KSH_VERSIONNAME "LEGACY"
#else
#define KSH_VERSIONNAME "MIRBSD"
#endif
EXTERN const char initvsn[] E_INIT("KSH_VERSION=@(#)" KSH_VERSIONNAME \
" KSH " MKSH_VERSION);
#define KSH_VERSION (initvsn + /* "KSH_VERSION=@(#)" */ 16)
EXTERN const char digits_uc[] E_INIT("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
@ -529,6 +536,14 @@ im_sorry_dave(void)
} while (/* CONSTCOND */ 0)
#endif
#ifdef MKSH_LEGACY_MODE
#ifndef MKSH_NO_CMDLINE_EDITING
#define MKSH_NO_CMDLINE_EDITING /* defined */
#endif
#undef MKSH_S_NOVI
#define MKSH_S_NOVI 1
#endif
#ifdef MKSH_SMALL
#ifndef MKSH_CONSERVATIVE_FDS
#define MKSH_CONSERVATIVE_FDS /* defined */