autoscan for persistent history support

This commit is contained in:
tg 2007-01-18 16:05:05 +00:00
parent 7b903e4aa9
commit 6d157ffe47
4 changed files with 20 additions and 15 deletions

View File

@ -1,5 +1,5 @@
#!/bin/sh #!/bin/sh
# $MirOS: src/bin/mksh/Build.sh,v 1.143 2007/01/18 15:50:31 tg Exp $ # $MirOS: src/bin/mksh/Build.sh,v 1.144 2007/01/18 16:05:04 tg Exp $
#- #-
# Env: CC, CFLAGS, CPP, CPPFLAGS, LDFLAGS, LIBS, NOWARN, NROFF, TARGET_OS # Env: CC, CFLAGS, CPP, CPPFLAGS, LDFLAGS, LIBS, NOWARN, NROFF, TARGET_OS
# CPPFLAGS recognised: MKSH_SMALL MKSH_NOPWNAM # CPPFLAGS recognised: MKSH_SMALL MKSH_NOPWNAM
@ -418,6 +418,12 @@ ac_test arc4random_push arc4random 0 <<-'EOF'
int main(void) { arc4random_push(1); return (0); } int main(void) { arc4random_push(1); return (0); }
EOF EOF
ac_test flock_ex '' 'flock and LOCK_EX' <<-'EOF'
#include <fcntl.h>
int main(void) { return (flock(0, LOCK_EX)); }
EOF
test 1 = $HAVE_FLOCK_EX || check_categories=$check_categories,no-histfile
ac_test setlocale_ctype '' 'setlocale(LC_CTYPE, "")' <<-'EOF' ac_test setlocale_ctype '' 'setlocale(LC_CTYPE, "")' <<-'EOF'
#include <locale.h> #include <locale.h>
#include <stddef.h> #include <stddef.h>

View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/Makefile,v 1.28 2007/01/18 15:50:32 tg Exp $ # $MirOS: src/bin/mksh/Makefile,v 1.29 2007/01/18 16:05:05 tg Exp $
PROG= mksh PROG= mksh
SRCS= alloc.c edit.c eval.c exec.c expr.c funcs.c histrap.c \ SRCS= alloc.c edit.c eval.c exec.c expr.c funcs.c histrap.c \
@ -12,10 +12,11 @@ CPPFLAGS+= -DHAVE_ATTRIBUTE=1 -DHAVE_ATTRIBUTE_BOUNDED=1 \
-DHAVE_RLIM_T=1 -DHAVE_SIG_T=1 -DHAVE_MKSH_SIGNAME=0 \ -DHAVE_RLIM_T=1 -DHAVE_SIG_T=1 -DHAVE_MKSH_SIGNAME=0 \
-DHAVE_SYS_SIGNAME=1 -DHAVE__SYS_SIGNAME=0 \ -DHAVE_SYS_SIGNAME=1 -DHAVE__SYS_SIGNAME=0 \
-DHAVE_SYS_SIGLIST=1 -DHAVE_STRSIGNAL=0 -DHAVE_ARC4RANDOM=1 \ -DHAVE_SYS_SIGLIST=1 -DHAVE_STRSIGNAL=0 -DHAVE_ARC4RANDOM=1 \
-DHAVE_ARC4RANDOM_PUSH=1 -DHAVE_SETLOCALE_CTYPE=1 \ -DHAVE_ARC4RANDOM_PUSH=1 -DHAVE_FLOCK_EX=1 \
-DHAVE_LANGINFO_CODESET=1 -DHAVE_REVOKE=1 -DHAVE_SETMODE=1 \ -DHAVE_SETLOCALE_CTYPE=1 -DHAVE_LANGINFO_CODESET=1 \
-DHAVE_SETRESUGID=1 -DHAVE_SETGROUPS=1 -DHAVE_STRCASESTR=1 \ -DHAVE_REVOKE=1 -DHAVE_SETMODE=1 -DHAVE_SETRESUGID=1 \
-DHAVE_STRLCPY=1 -DHAVE_MULTI_IDSTRING=1 -DHAVE_SETGROUPS=1 -DHAVE_STRCASESTR=1 -DHAVE_STRLCPY=1 \
-DHAVE_MULTI_IDSTRING=1
.endif .endif
CDIAGFLAGS+= -Wno-cast-qual CDIAGFLAGS+= -Wno-cast-qual

12
check.t
View File

@ -1,4 +1,4 @@
# $MirOS: src/bin/mksh/check.t,v 1.86 2007/01/18 15:50:32 tg Exp $ # $MirOS: src/bin/mksh/check.t,v 1.87 2007/01/18 16:05:05 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 $
@ -1961,8 +1961,7 @@ name: history-ed-1
description: description:
Basic (ed) editing works (assumes you have generic ed editor Basic (ed) editing works (assumes you have generic ed editor
that prints no prompts). This is for newish ed(1) and stderr. that prints no prompts). This is for newish ed(1) and stderr.
# we don't have persistent history on Solaris (no flock) category: !no-histfile,!oldish-ed
category: !os:solaris,!oldish-ed
arguments: !-i! arguments: !-i!
env-setup: !ENV=./Env!HISTFILE=hist.file! env-setup: !ENV=./Env!HISTFILE=hist.file!
file-setup: file 644 "Env" file-setup: file 644 "Env"
@ -1982,7 +1981,7 @@ expected-stderr-pattern:
name: history-ed-2 name: history-ed-2
description: description:
Correct command is edited when number given Correct command is edited when number given
category: !os:solaris,!oldish-ed category: !no-histfile,!oldish-ed
arguments: !-i! arguments: !-i!
env-setup: !ENV=./Env!HISTFILE=hist.file! env-setup: !ENV=./Env!HISTFILE=hist.file!
file-setup: file 644 "Env" file-setup: file 644 "Env"
@ -2009,7 +2008,7 @@ name: history-ed-3
description: description:
Newly created multi line commands show up as single command Newly created multi line commands show up as single command
in history. in history.
category: !os:solaris,!oldish-ed category: !no-histfile,!oldish-ed
arguments: !-i! arguments: !-i!
env-setup: !ENV=./Env!HISTFILE=hist.file! env-setup: !ENV=./Env!HISTFILE=hist.file!
file-setup: file 644 "Env" file-setup: file 644 "Env"
@ -3860,8 +3859,7 @@ expected-stdout:
name: persist-history-1 name: persist-history-1
description: description:
Check if persistent history saving works Check if persistent history saving works
# we don't have persistent history on Solaris (no flock) category: !no-histfile,pdksh,!smksh
category: !os:solaris,!os:plan9,pdksh,!smksh
arguments: !-i! arguments: !-i!
env-setup: !ENV=./Env!HISTFILE=hist.file! env-setup: !ENV=./Env!HISTFILE=hist.file!
file-setup: file 644 "Env" file-setup: file 644 "Env"

4
sh.h
View File

@ -8,7 +8,7 @@
/* $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.108 2007/01/18 15:50:32 tg Exp $" #define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.109 2007/01/18 16:05:05 tg Exp $"
#define MKSH_VERSION "R29 2007/01/18" #define MKSH_VERSION "R29 2007/01/18"
#if HAVE_SYS_PARAM_H #if HAVE_SYS_PARAM_H
@ -740,7 +740,7 @@ extern const struct builtin shbuiltins [], kshbuiltins [];
#define V_RANDOM 8 #define V_RANDOM 8
#define V_HISTSIZE 9 #define V_HISTSIZE 9
/* this is defined when we support persistent history, undefined otherwise */ /* this is defined when we support persistent history, undefined otherwise */
#if !defined(__sun__) && !defined(MKSH_SMALL) #if HAVE_FLOCK_EX && !defined(MKSH_SMALL)
#define V_HISTFILE 10 #define V_HISTFILE 10
#endif #endif
#define V_COLUMNS 13 #define V_COLUMNS 13