merge CVS import stuff
This commit is contained in:
12
history.c
12
history.c
@@ -1,5 +1,5 @@
|
|||||||
/* $MirBSD: history.c,v 1.5 2003/04/15 20:10:21 tg Exp $ */
|
/* $MirBSD: history.c,v 1.6 2003/05/22 14:06:07 tg Exp $ */
|
||||||
/* $OpenBSD: history.c,v 1.19 2003/04/15 08:35:34 deraadt Exp $ */
|
/* $OpenBSD: history.c,v 1.22 2003/05/18 01:02:42 jsyn Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* command history
|
* command history
|
||||||
@@ -65,7 +65,7 @@ static int hist_replace ARGS((char **hp, const char *pat, const char *rep,
|
|||||||
int global));
|
int global));
|
||||||
static char **hist_get ARGS((const char *str, int approx, int allow_cur));
|
static char **hist_get ARGS((const char *str, int approx, int allow_cur));
|
||||||
static char **hist_get_newest ARGS((int allow_cur));
|
static char **hist_get_newest ARGS((int allow_cur));
|
||||||
static char **hist_get_oldest ARGS(());
|
static char **hist_get_oldest ARGS((void));
|
||||||
static void histbackup ARGS((void));
|
static void histbackup ARGS((void));
|
||||||
|
|
||||||
static char **current; /* current position in history[] */
|
static char **current; /* current position in history[] */
|
||||||
@@ -863,7 +863,7 @@ hist_init(s)
|
|||||||
* check on its validity
|
* check on its validity
|
||||||
*/
|
*/
|
||||||
if (base == MAP_FAILED || *base != HMAGIC1 || base[1] != HMAGIC2) {
|
if (base == MAP_FAILED || *base != HMAGIC1 || base[1] != HMAGIC2) {
|
||||||
if (base != (unsigned char *)-1)
|
if (base != MAP_FAILED)
|
||||||
munmap((caddr_t)base, hsize);
|
munmap((caddr_t)base, hsize);
|
||||||
hist_finish();
|
hist_finish();
|
||||||
unlink(hname);
|
unlink(hname);
|
||||||
@@ -1097,7 +1097,7 @@ writehistfile(lno, cmd)
|
|||||||
unsigned char *base;
|
unsigned char *base;
|
||||||
unsigned char *new;
|
unsigned char *new;
|
||||||
int bytes;
|
int bytes;
|
||||||
char hdr[5];
|
unsigned char hdr[5];
|
||||||
|
|
||||||
(void) flock(histfd, LOCK_EX);
|
(void) flock(histfd, LOCK_EX);
|
||||||
sizenow = lseek(histfd, 0L, SEEK_END);
|
sizenow = lseek(histfd, 0L, SEEK_END);
|
||||||
@@ -1161,7 +1161,7 @@ static int
|
|||||||
sprinkle(fd)
|
sprinkle(fd)
|
||||||
int fd;
|
int fd;
|
||||||
{
|
{
|
||||||
static char mag[] = { HMAGIC1, HMAGIC2 };
|
static unsigned char mag[] = { HMAGIC1, HMAGIC2 };
|
||||||
|
|
||||||
return(write(fd, mag, 2) != 2);
|
return(write(fd, mag, 2) != 2);
|
||||||
}
|
}
|
||||||
|
15
sh.h
15
sh.h
@@ -1,5 +1,5 @@
|
|||||||
/* $MirBSD: sh.h,v 1.2 2003/04/12 14:32:14 tg Exp $ */
|
/* $MirBSD: sh.h,v 1.3 2003/05/22 14:06:07 tg Exp $ */
|
||||||
/* $OpenBSD: sh.h,v 1.12 2002/10/07 23:09:32 vincent Exp $ */
|
/* $OpenBSD: sh.h,v 1.13 2003/05/16 19:58:57 jsyn Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Public Domain Bourne/Korn shell
|
* Public Domain Bourne/Korn shell
|
||||||
@@ -15,7 +15,6 @@
|
|||||||
# define ARGS(args) () /* K&R declaration */
|
# define ARGS(args) () /* K&R declaration */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* Start of common headers */
|
/* Start of common headers */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
@@ -379,11 +378,9 @@ EXTERN int exstat; /* exit status */
|
|||||||
EXTERN int subst_exstat; /* exit status of last $(..)/`..` */
|
EXTERN int subst_exstat; /* exit status of last $(..)/`..` */
|
||||||
EXTERN const char *safe_prompt; /* safe prompt if PS1 substitution fails */
|
EXTERN const char *safe_prompt; /* safe prompt if PS1 substitution fails */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Area-based allocation built on malloc/free
|
* Area-based allocation built on malloc/free
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct Area {
|
typedef struct Area {
|
||||||
struct link *freelist; /* free list */
|
struct link *freelist; /* free list */
|
||||||
} Area;
|
} Area;
|
||||||
@@ -406,7 +403,6 @@ EXTERN Area aperm; /* permanent object space */
|
|||||||
# define kshdebug_dump(a)
|
# define kshdebug_dump(a)
|
||||||
#endif /* KSH_DEBUG */
|
#endif /* KSH_DEBUG */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* parsing & execution environment
|
* parsing & execution environment
|
||||||
*/
|
*/
|
||||||
@@ -453,7 +449,6 @@ EXTERN struct env {
|
|||||||
#define LSHELL 8 /* return to interactive shell() */
|
#define LSHELL 8 /* return to interactive shell() */
|
||||||
#define LAEXPR 9 /* error in arithmetic expression */
|
#define LAEXPR 9 /* error in arithmetic expression */
|
||||||
|
|
||||||
|
|
||||||
/* option processing */
|
/* option processing */
|
||||||
#define OF_CMDLINE 0x01 /* command line */
|
#define OF_CMDLINE 0x01 /* command line */
|
||||||
#define OF_SET 0x02 /* set builtin */
|
#define OF_SET 0x02 /* set builtin */
|
||||||
@@ -599,7 +594,6 @@ EXTERN int volatile fatal_trap;/* received a fatal signal */
|
|||||||
extern Trap sigtraps[SIGNALS+1];
|
extern Trap sigtraps[SIGNALS+1];
|
||||||
#endif /* !FROM_TRAP_C */
|
#endif /* !FROM_TRAP_C */
|
||||||
|
|
||||||
|
|
||||||
#ifdef KSH
|
#ifdef KSH
|
||||||
/*
|
/*
|
||||||
* TMOUT support
|
* TMOUT support
|
||||||
@@ -614,11 +608,9 @@ EXTERN unsigned int ksh_tmout;
|
|||||||
EXTERN enum tmout_enum ksh_tmout_state I__(TMOUT_EXECUTING);
|
EXTERN enum tmout_enum ksh_tmout_state I__(TMOUT_EXECUTING);
|
||||||
#endif /* KSH */
|
#endif /* KSH */
|
||||||
|
|
||||||
|
|
||||||
/* For "You have stopped jobs" message */
|
/* For "You have stopped jobs" message */
|
||||||
EXTERN int really_exit;
|
EXTERN int really_exit;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* fast character classes
|
* fast character classes
|
||||||
*/
|
*/
|
||||||
@@ -641,7 +633,6 @@ extern short ctypes [];
|
|||||||
|
|
||||||
EXTERN int ifs0 I__(' '); /* for "$*" */
|
EXTERN int ifs0 I__(' '); /* for "$*" */
|
||||||
|
|
||||||
|
|
||||||
/* Argument parsing for built-in commands and getopts command */
|
/* Argument parsing for built-in commands and getopts command */
|
||||||
|
|
||||||
/* Values for Getopt.flags */
|
/* Values for Getopt.flags */
|
||||||
@@ -667,7 +658,6 @@ typedef struct {
|
|||||||
EXTERN Getopt builtin_opt; /* for shell builtin commands */
|
EXTERN Getopt builtin_opt; /* for shell builtin commands */
|
||||||
EXTERN Getopt user_opt; /* parsing state for getopts builtin command */
|
EXTERN Getopt user_opt; /* parsing state for getopts builtin command */
|
||||||
|
|
||||||
|
|
||||||
#ifdef KSH
|
#ifdef KSH
|
||||||
/* This for co-processes */
|
/* This for co-processes */
|
||||||
|
|
||||||
@@ -711,7 +701,6 @@ EXTERN int x_cols I__(80); /* tty columns */
|
|||||||
# define x_cols 80 /* for pr_menu(exec.c) */
|
# define x_cols 80 /* for pr_menu(exec.c) */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
/* These to avoid bracket matching problems */
|
/* These to avoid bracket matching problems */
|
||||||
#define OPAREN '('
|
#define OPAREN '('
|
||||||
#define CPAREN ')'
|
#define CPAREN ')'
|
||||||
|
Reference in New Issue
Block a user