merge CVS import stuff

This commit is contained in:
tg 2003-05-22 14:06:07 +00:00
parent 9ff3f0d1fb
commit 019f31cd5c
2 changed files with 9 additions and 20 deletions

View File

@ -1,5 +1,5 @@
/* $MirBSD: history.c,v 1.5 2003/04/15 20:10:21 tg Exp $ */
/* $OpenBSD: history.c,v 1.19 2003/04/15 08:35:34 deraadt Exp $ */
/* $MirBSD: history.c,v 1.6 2003/05/22 14:06:07 tg Exp $ */
/* $OpenBSD: history.c,v 1.22 2003/05/18 01:02:42 jsyn Exp $ */
/*
* command history
@ -65,7 +65,7 @@ static int hist_replace ARGS((char **hp, const char *pat, const char *rep,
int global));
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_oldest ARGS(());
static char **hist_get_oldest ARGS((void));
static void histbackup ARGS((void));
static char **current; /* current position in history[] */
@ -863,7 +863,7 @@ hist_init(s)
* check on its validity
*/
if (base == MAP_FAILED || *base != HMAGIC1 || base[1] != HMAGIC2) {
if (base != (unsigned char *)-1)
if (base != MAP_FAILED)
munmap((caddr_t)base, hsize);
hist_finish();
unlink(hname);
@ -1097,7 +1097,7 @@ writehistfile(lno, cmd)
unsigned char *base;
unsigned char *new;
int bytes;
char hdr[5];
unsigned char hdr[5];
(void) flock(histfd, LOCK_EX);
sizenow = lseek(histfd, 0L, SEEK_END);
@ -1161,7 +1161,7 @@ static int
sprinkle(fd)
int fd;
{
static char mag[] = { HMAGIC1, HMAGIC2 };
static unsigned char mag[] = { HMAGIC1, HMAGIC2 };
return(write(fd, mag, 2) != 2);
}

17
sh.h
View File

@ -1,5 +1,5 @@
/* $MirBSD: sh.h,v 1.2 2003/04/12 14:32:14 tg Exp $ */
/* $OpenBSD: sh.h,v 1.12 2002/10/07 23:09:32 vincent Exp $ */
/* $MirBSD: sh.h,v 1.3 2003/05/22 14:06:07 tg Exp $ */
/* $OpenBSD: sh.h,v 1.13 2003/05/16 19:58:57 jsyn Exp $ */
/*
* Public Domain Bourne/Korn shell
@ -15,7 +15,6 @@
# define ARGS(args) () /* K&R declaration */
#endif
/* Start of common headers */
#include <stdio.h>
@ -363,7 +362,7 @@ typedef INT32 Tflag;
* not a char that is used often. Also, can't use the high bit as it causes
* portability problems (calling strchr(x, 0x80|'x') is error prone).
*/
#define MAGIC (7)/* prefix for *?[!{,} during expand */
#define MAGIC (7) /* prefix for *?[!{,} during expand */
#define ISMAGIC(c) ((unsigned char)(c) == MAGIC)
#define NOT '!' /* might use ^ (ie, [!...] vs [^..]) */
@ -379,11 +378,9 @@ EXTERN int exstat; /* exit status */
EXTERN int subst_exstat; /* exit status of last $(..)/`..` */
EXTERN const char *safe_prompt; /* safe prompt if PS1 substitution fails */
/*
* Area-based allocation built on malloc/free
*/
typedef struct Area {
struct link *freelist; /* free list */
} Area;
@ -406,7 +403,6 @@ EXTERN Area aperm; /* permanent object space */
# define kshdebug_dump(a)
#endif /* KSH_DEBUG */
/*
* parsing & execution environment
*/
@ -453,7 +449,6 @@ EXTERN struct env {
#define LSHELL 8 /* return to interactive shell() */
#define LAEXPR 9 /* error in arithmetic expression */
/* option processing */
#define OF_CMDLINE 0x01 /* command line */
#define OF_SET 0x02 /* set builtin */
@ -599,7 +594,6 @@ EXTERN int volatile fatal_trap;/* received a fatal signal */
extern Trap sigtraps[SIGNALS+1];
#endif /* !FROM_TRAP_C */
#ifdef KSH
/*
* TMOUT support
@ -614,11 +608,9 @@ EXTERN unsigned int ksh_tmout;
EXTERN enum tmout_enum ksh_tmout_state I__(TMOUT_EXECUTING);
#endif /* KSH */
/* For "You have stopped jobs" message */
EXTERN int really_exit;
/*
* fast character classes
*/
@ -641,7 +633,6 @@ extern short ctypes [];
EXTERN int ifs0 I__(' '); /* for "$*" */
/* Argument parsing for built-in commands and getopts command */
/* Values for Getopt.flags */
@ -667,7 +658,6 @@ typedef struct {
EXTERN Getopt builtin_opt; /* for shell builtin commands */
EXTERN Getopt user_opt; /* parsing state for getopts builtin command */
#ifdef KSH
/* 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) */
#endif
/* These to avoid bracket matching problems */
#define OPAREN '('
#define CPAREN ')'