mirtoconf the checks if to use persistent history support
This commit is contained in:
parent
f6ff09ccbe
commit
e31b852abc
13
Build.sh
13
Build.sh
@ -1,5 +1,5 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# $MirOS: src/bin/mksh/Build.sh,v 1.153 2007/02/27 00:31:17 tg Exp $
|
# $MirOS: src/bin/mksh/Build.sh,v 1.154 2007/03/03 21:36:06 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_ASSUME_UTF8 MKSH_NEED_MKNOD MKSH_NOPWNAM
|
# CPPFLAGS recognised: MKSH_SMALL MKSH_ASSUME_UTF8 MKSH_NEED_MKNOD MKSH_NOPWNAM
|
||||||
@ -459,8 +459,6 @@ ac_test flock_ex '' 'flock and LOCK_EX' <<-'EOF'
|
|||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
int main(void) { return (flock(0, LOCK_EX)); }
|
int main(void) { return (flock(0, LOCK_EX)); }
|
||||||
EOF
|
EOF
|
||||||
test 11 = $HAVE_FLOCK_EX$HAVE_MKSH_FULL || \
|
|
||||||
check_categories=$check_categories,no-histfile
|
|
||||||
|
|
||||||
ac_test setlocale_ctype '!' mksh_defutf8 0 'setlocale(LC_CTYPE, "")' <<-'EOF'
|
ac_test setlocale_ctype '!' mksh_defutf8 0 'setlocale(LC_CTYPE, "")' <<-'EOF'
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
@ -525,6 +523,15 @@ ac_test multi_idstring '' 'if we can use __RCSID(x) multiple times' <<-'EOF'
|
|||||||
int main(void) { return (0); }
|
int main(void) { return (0); }
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
ac_test persistent_history mksh_full 0 'if to use persistent history' <<-'EOF'
|
||||||
|
#if !HAVE_FLOCK_EX || defined(MKSH_SMALL)
|
||||||
|
#error No, some prerequisites are missing.
|
||||||
|
#endif
|
||||||
|
int main(void) { return (0); }
|
||||||
|
EOF
|
||||||
|
test 1 = $HAVE_PERSISTENT_HISTORY || \
|
||||||
|
check_categories=$check_categories,no-histfile
|
||||||
|
|
||||||
#
|
#
|
||||||
# Compiler: Praeprocessor (only if needed)
|
# Compiler: Praeprocessor (only if needed)
|
||||||
#
|
#
|
||||||
|
16
histrap.c
16
histrap.c
@ -3,12 +3,12 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.42 2007/02/27 15:03:28 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/histrap.c,v 1.43 2007/03/03 21:36:07 tg Exp $");
|
||||||
|
|
||||||
Trap sigtraps[NSIG + 1];
|
Trap sigtraps[NSIG + 1];
|
||||||
static struct sigaction Sigact_ign, Sigact_trap;
|
static struct sigaction Sigact_ign, Sigact_trap;
|
||||||
|
|
||||||
#ifdef V_HISTFILE
|
#if HAVE_PERSISTENT_HISTORY
|
||||||
static int hist_count_lines(unsigned char *, int);
|
static int hist_count_lines(unsigned char *, int);
|
||||||
static int hist_shrink(unsigned char *, int);
|
static int hist_shrink(unsigned char *, int);
|
||||||
static unsigned char *hist_skip_back(unsigned char *,int *,int);
|
static unsigned char *hist_skip_back(unsigned char *,int *,int);
|
||||||
@ -28,7 +28,7 @@ static char **current; /* current position in history[] */
|
|||||||
static int hstarted; /* set after hist_init() called */
|
static int hstarted; /* set after hist_init() called */
|
||||||
static Source *hist_source;
|
static Source *hist_source;
|
||||||
|
|
||||||
#ifdef V_HISTFILE
|
#if HAVE_PERSISTENT_HISTORY
|
||||||
static char *hname; /* current name of history file */
|
static char *hname; /* current name of history file */
|
||||||
static int histfd;
|
static int histfd;
|
||||||
static int hsize;
|
static int hsize;
|
||||||
@ -501,7 +501,7 @@ sethistsize(int n)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef V_HISTFILE
|
#if HAVE_PERSISTENT_HISTORY
|
||||||
/*
|
/*
|
||||||
* set history file
|
* set history file
|
||||||
* This can mean reloading/resetting/starting history file
|
* This can mean reloading/resetting/starting history file
|
||||||
@ -573,7 +573,7 @@ histsave(int lno __unused, const char *cmd, int dowrite __unused)
|
|||||||
if ((cp = strchr(c, '\n')) != NULL)
|
if ((cp = strchr(c, '\n')) != NULL)
|
||||||
*cp = '\0';
|
*cp = '\0';
|
||||||
|
|
||||||
#ifdef V_HISTFILE
|
#if HAVE_PERSISTENT_HISTORY
|
||||||
if (histfd && dowrite)
|
if (histfd && dowrite)
|
||||||
writehistfile(lno, c);
|
writehistfile(lno, c);
|
||||||
#endif
|
#endif
|
||||||
@ -616,7 +616,7 @@ histsave(int lno __unused, const char *cmd, int dowrite __unused)
|
|||||||
void
|
void
|
||||||
hist_init(Source *s)
|
hist_init(Source *s)
|
||||||
{
|
{
|
||||||
#ifdef V_HISTFILE
|
#if HAVE_PERSISTENT_HISTORY
|
||||||
unsigned char *base;
|
unsigned char *base;
|
||||||
int lines;
|
int lines;
|
||||||
int fd;
|
int fd;
|
||||||
@ -629,7 +629,7 @@ hist_init(Source *s)
|
|||||||
|
|
||||||
hist_source = s;
|
hist_source = s;
|
||||||
|
|
||||||
#ifdef V_HISTFILE
|
#if HAVE_PERSISTENT_HISTORY
|
||||||
hname = str_val(global("HISTFILE"));
|
hname = str_val(global("HISTFILE"));
|
||||||
if (hname == NULL)
|
if (hname == NULL)
|
||||||
return;
|
return;
|
||||||
@ -689,7 +689,7 @@ hist_init(Source *s)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef V_HISTFILE
|
#if HAVE_PERSISTENT_HISTORY
|
||||||
typedef enum state {
|
typedef enum state {
|
||||||
shdr, /* expecting a header */
|
shdr, /* expecting a header */
|
||||||
sline, /* looking for a null byte to end the line */
|
sline, /* looking for a null byte to end the line */
|
||||||
|
4
main.c
4
main.c
@ -13,7 +13,7 @@
|
|||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.70 2007/02/13 13:36:18 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/main.c,v 1.71 2007/03/03 21:36:07 tg Exp $");
|
||||||
|
|
||||||
extern char **environ;
|
extern char **environ;
|
||||||
|
|
||||||
@ -615,7 +615,7 @@ quitenv(struct shf *shf)
|
|||||||
*/
|
*/
|
||||||
if (ep->oenv == NULL) {
|
if (ep->oenv == NULL) {
|
||||||
if (ep->type == E_NONE) { /* Main shell exiting? */
|
if (ep->type == E_NONE) { /* Main shell exiting? */
|
||||||
#ifdef V_HISTFILE
|
#if HAVE_PERSISTENT_HISTORY
|
||||||
if (Flag(FTALKING))
|
if (Flag(FTALKING))
|
||||||
hist_finish();
|
hist_finish();
|
||||||
#endif
|
#endif
|
||||||
|
9
sh.h
9
sh.h
@ -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.112 2007/02/16 17:46:42 tg Exp $"
|
#define MKSH_SH_H_ID "$MirOS: src/bin/mksh/sh.h,v 1.113 2007/03/03 21:36:07 tg Exp $"
|
||||||
#define MKSH_VERSION "R29 2007/02/16"
|
#define MKSH_VERSION "R29 2007/02/16"
|
||||||
|
|
||||||
#if HAVE_SYS_PARAM_H
|
#if HAVE_SYS_PARAM_H
|
||||||
@ -739,10 +739,7 @@ extern const struct builtin shbuiltins [], kshbuiltins [];
|
|||||||
#define V_OPTIND 4
|
#define V_OPTIND 4
|
||||||
#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 */
|
|
||||||
#if HAVE_FLOCK_EX && !defined(MKSH_SMALL)
|
|
||||||
#define V_HISTFILE 10
|
#define V_HISTFILE 10
|
||||||
#endif
|
|
||||||
#define V_COLUMNS 13
|
#define V_COLUMNS 13
|
||||||
#define V_TMOUT 15
|
#define V_TMOUT 15
|
||||||
#define V_TMPDIR 16
|
#define V_TMPDIR 16
|
||||||
@ -1173,13 +1170,13 @@ int c_test(char **);
|
|||||||
/* histrap.c */
|
/* histrap.c */
|
||||||
void init_histvec(void);
|
void init_histvec(void);
|
||||||
void hist_init(Source *);
|
void hist_init(Source *);
|
||||||
#ifdef V_HISTFILE
|
#if HAVE_PERSISTENT_HISTORY
|
||||||
void hist_finish(void);
|
void hist_finish(void);
|
||||||
#endif
|
#endif
|
||||||
void histsave(int, const char *, int);
|
void histsave(int, const char *, int);
|
||||||
int c_fc(char **);
|
int c_fc(char **);
|
||||||
void sethistsize(int);
|
void sethistsize(int);
|
||||||
#ifdef V_HISTFILE
|
#if HAVE_PERSISTENT_HISTORY
|
||||||
void sethistfile(const char *);
|
void sethistfile(const char *);
|
||||||
#endif
|
#endif
|
||||||
char **histpos(void);
|
char **histpos(void);
|
||||||
|
6
var.c
6
var.c
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include "sh.h"
|
#include "sh.h"
|
||||||
|
|
||||||
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.34 2007/01/15 02:48:28 tg Exp $");
|
__RCSID("$MirOS: src/bin/mksh/var.c,v 1.35 2007/03/03 21:36:08 tg Exp $");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Variables
|
* Variables
|
||||||
@ -88,7 +88,7 @@ initvar(void)
|
|||||||
{ "OPTIND", V_OPTIND },
|
{ "OPTIND", V_OPTIND },
|
||||||
{ "PATH", V_PATH },
|
{ "PATH", V_PATH },
|
||||||
{ "TMPDIR", V_TMPDIR },
|
{ "TMPDIR", V_TMPDIR },
|
||||||
#ifdef V_HISTFILE
|
#if HAVE_PERSISTENT_HISTORY
|
||||||
{ "HISTFILE", V_HISTFILE },
|
{ "HISTFILE", V_HISTFILE },
|
||||||
#endif
|
#endif
|
||||||
{ "HISTSIZE", V_HISTSIZE },
|
{ "HISTSIZE", V_HISTSIZE },
|
||||||
@ -987,7 +987,7 @@ setspec(struct tbl *vp)
|
|||||||
sethistsize((int) intval(vp));
|
sethistsize((int) intval(vp));
|
||||||
vp->flag |= SPECIAL;
|
vp->flag |= SPECIAL;
|
||||||
break;
|
break;
|
||||||
#ifdef V_HISTFILE
|
#if HAVE_PERSISTENT_HISTORY
|
||||||
case V_HISTFILE:
|
case V_HISTFILE:
|
||||||
sethistfile(str_val(vp));
|
sethistfile(str_val(vp));
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user