From 783afc8802f8eef170ca419ea940a4b37634cb20 Mon Sep 17 00:00:00 2001 From: tg Date: Wed, 21 May 2003 18:35:58 +0000 Subject: [PATCH] Sync MirBSD main source tree against OpenBSD-current, which should be fairly stable after the Hackathon now. --- config.h | 35 ++++++++++++++++++----------------- history.c | 10 +++++----- missing.c | 11 +++-------- proto.h | 3 +-- sh.h | 15 ++------------- 5 files changed, 29 insertions(+), 45 deletions(-) diff --git a/config.h b/config.h index d484db7..6aa3afb 100644 --- a/config.h +++ b/config.h @@ -1,7 +1,7 @@ -/* $OpenBSD: config.h,v 1.7 2003/02/28 09:45:09 jmc Exp $ */ +/* $OpenBSD: config.h,v 1.8 2003/05/16 18:49:46 jsyn Exp $ */ + +/* config.h. NOT generated automatically. */ -/* config.h. Generated automatically by configure. */ -/* config.h.in. Generated automatically from configure.in by autoheader. */ /* * This file, acconfig.h, which is a part of pdksh (the public domain ksh), * is placed in the public domain. It comes with no licence, warranty @@ -11,7 +11,6 @@ #ifndef CONFIG_H #define CONFIG_H - /* Define if on AIX 3. System headers sometimes define this. We just want to avoid a redefinition error message. */ @@ -25,7 +24,6 @@ /* Define to empty if the keyword does not work. */ /* #undef const */ - /* Define to `int' if doesn't define. */ /* #undef gid_t */ @@ -174,6 +172,9 @@ /* Define if opendir() will open non-directory files */ /* #undef OPENDIR_DOES_NONDIR */ +/* Define if you have a dup2() function in your C library */ +#define HAVE_DUP2 1 + /* Define if the pgrp of setpgrp() can't be the pid of a zombie process */ /* #undef NEED_PGRP_SYNC */ @@ -192,44 +193,44 @@ /* Define if your OS maps references to /dev/fd/n to file descriptor n */ #define HAVE_DEV_FD 1 -/* Default PATH (see comments in configure.in for more details) */ +/* Default PATH */ #define DEFAULT_PATH "/bin:/usr/bin:/sbin:/usr/sbin" /* Define if your C library's getwd/getcwd function dumps core in unreadable * directories. */ /* #undef HPUX_GETWD_BUG */ -/* Include ksh features? (see comments in configure.in for more details) */ +/* Include ksh features? */ /* #define KSH 1 */ -/* Include emacs editing? (see comments in configure.in for more details) */ +/* Include emacs editing? */ #define EMACS 1 -/* Include vi editing? (see comments in configure.in for more details) */ +/* Include vi editing? */ #define VI 1 -/* Include job control? (see comments in configure.in for more details) */ +/* Include job control? */ #define JOBS 1 -/* Include brace-expansion? (see comments in configure.in for more details) */ +/* Include brace-expansion? */ #define BRACE_EXPAND 1 -/* Include any history? (see comments in configure.in for more details) */ +/* Include any history? */ #define HISTORY 1 -/* Include complex history? (see comments in configure.in for more details) */ +/* Include complex history? */ #define COMPLEX_HISTORY -/* Strict POSIX behaviour? (see comments in configure.in for more details) */ +/* Strict POSIX behaviour? */ /* #undef POSIXLY_CORRECT */ -/* Specify default $ENV? (see comments in configure.in for more details) */ +/* Specify default $ENV? */ /* #undef DEFAULT_ENV */ -/* Include shl(1) support? (see comments in configure.in for more details) */ +/* Include shl(1) support? */ /* #undef SWTCH */ -/* Include game-of-life? (see comments in configure.in for more details) */ +/* Include game-of-life? */ /* #undef SILLY */ /* The number of bytes in a int. */ diff --git a/history.c b/history.c index 2571f70..a3737c4 100644 --- a/history.c +++ b/history.c @@ -1,4 +1,4 @@ -/* $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 @@ -64,7 +64,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[] */ @@ -862,7 +862,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); @@ -1096,7 +1096,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); @@ -1160,7 +1160,7 @@ static int sprinkle(fd) int fd; { - static char mag[] = { HMAGIC1, HMAGIC2 }; + static unsigned char mag[] = { HMAGIC1, HMAGIC2 }; return(write(fd, mag, 2) != 2); } diff --git a/missing.c b/missing.c index 2bcffac..f785bb3 100644 --- a/missing.c +++ b/missing.c @@ -1,4 +1,4 @@ -/* $OpenBSD: missing.c,v 1.4 1999/06/15 01:18:35 millert Exp $ */ +/* $OpenBSD: missing.c,v 1.5 2003/05/16 18:49:46 jsyn Exp $ */ /* * Routines which may be missing on some machines @@ -8,7 +8,6 @@ #include "ksh_stat.h" #include "ksh_dir.h" - #ifndef HAVE_MEMSET void * memset(d, c, n) @@ -51,7 +50,6 @@ memmove(d, s, n) } #endif /* !HAVE_MEMMOVE && !HAVE_BCOPY */ - #ifndef HAVE_STRCASECMP /* * Case insensitive string compare routines, same semantics as str[n]cmp() @@ -124,7 +122,6 @@ strncasecmp(s1, s2, n) } #endif /* HAVE_STRCASECMP */ - #ifndef HAVE_STRSTR char * strstr(s, p) @@ -140,8 +137,7 @@ strstr(s, p) return 0; } -#endif /* HAVE_STRSTR */ - +#endif /* !HAVE_STRSTR */ #ifndef HAVE_STRERROR char * @@ -190,7 +186,6 @@ strerror(err) } #endif /* !HAVE_STRERROR */ - #ifdef TIMES_BROKEN # include "ksh_time.h" # include "ksh_times.h" @@ -292,4 +287,4 @@ dup2(oldd, newd) return fcntl(oldd, F_DUPFD, newd); } -#endif /* !HAVE_MEMSET */ +#endif /* !HAVE_DUP2 */ diff --git a/proto.h b/proto.h index 42a0427..d0b7e8a 100644 --- a/proto.h +++ b/proto.h @@ -1,4 +1,4 @@ -/* $OpenBSD: proto.h,v 1.10 2003/04/16 23:11:52 tdeval Exp $ */ +/* $OpenBSD: proto.h,v 1.11 2003/05/16 19:58:57 jsyn Exp $ */ /* * prototypes for PD-KSH @@ -189,7 +189,6 @@ void change_flag ARGS((enum sh_flag f, int what, int newval)); int parse_args ARGS((char **argv, int what, int *setargsp)); int getn ARGS((const char *as, int *ai)); int bi_getn ARGS((const char *as, int *ai)); -char * strerror ARGS((int i)); int gmatch ARGS((const char *s, const char *p, int isfile)); int has_globbing ARGS((const char *xp, const char *xpe)); const unsigned char *pat_scan ARGS((const unsigned char *p, diff --git a/sh.h b/sh.h index 4e8c4ac..8397587 100644 --- a/sh.h +++ b/sh.h @@ -1,4 +1,4 @@ -/* $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 @@ -14,7 +14,6 @@ # define ARGS(args) () /* K&R declaration */ #endif - /* Start of common headers */ #include @@ -362,7 +361,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 [^..]) */ @@ -378,11 +377,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; @@ -405,7 +402,6 @@ EXTERN Area aperm; /* permanent object space */ # define kshdebug_dump(a) #endif /* KSH_DEBUG */ - /* * parsing & execution environment */ @@ -452,7 +448,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 */ @@ -598,7 +593,6 @@ EXTERN int volatile fatal_trap;/* received a fatal signal */ extern Trap sigtraps[SIGNALS+1]; #endif /* !FROM_TRAP_C */ - #ifdef KSH /* * TMOUT support @@ -613,11 +607,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 */ @@ -640,7 +632,6 @@ extern short ctypes []; EXTERN int ifs0 I__(' '); /* for "$*" */ - /* Argument parsing for built-in commands and getopts command */ /* Values for Getopt.flags */ @@ -666,7 +657,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 */ @@ -710,7 +700,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 ')'