* merge OpenBSD 3.5-current

* retain local changes to ls and md5 (md4, hint hint)
* fix up ksh (limits - we still have 4096 bytes input buffer;
  random usage)
* fix manpages (mdX, ksh)
This commit is contained in:
tg 2004-05-23 12:47:01 +00:00
parent daf9f30b2f
commit b051c6e857
7 changed files with 33 additions and 51 deletions

View File

@ -1,5 +1,5 @@
# $MirBSD: Makefile,v 1.2 2004/04/07 17:14:11 tg Exp $
# $OpenBSD: Makefile,v 1.16 2004/01/09 17:10:07 brad Exp $
# $MirBSD: Makefile,v 1.3 2004/05/23 12:47:00 tg Exp $
# $OpenBSD: Makefile,v 1.18 2004/02/16 19:07:19 deraadt Exp $
PROG= ksh
SRCS= alloc.c c_ksh.c c_sh.c c_test.c c_ulimit.c edit.c emacs.c \

15
alloc.c
View File

@ -1,5 +1,6 @@
/* $MirBSD: alloc.c,v 1.2 2004/04/17 00:47:16 tg Exp $ */
/* $OpenBSD: alloc.c,v 1.6 2003/08/05 20:52:27 millert Exp $ */
/* $MirBSD: alloc.c,v 1.3 2004/05/23 12:47:00 tg Exp $ */
/* $OpenBSD: alloc.c,v 1.7 2004/02/19 18:51:17 deraadt Exp $ */
/*
* Copyright (c) 2002 Marc Espie.
*
@ -63,7 +64,7 @@ alloc(size_t size, Area *ap)
{
struct link *l;
l = malloc(size + sizeof(struct link));
l = malloc(sizeof(struct link) + size);
if (l == NULL)
internal_errorf(1, "unable to allocate memory");
l->next = ap->freelist;
@ -87,15 +88,15 @@ aresize(void *ptr, size_t size, Area *ap)
lprev = l->prev;
lnext = l->next;
l2 = realloc(l, size+sizeof(struct link));
l2 = realloc(l, sizeof(struct link) + size);
if (l2 == NULL)
internal_errorf(1, "unable to allocate memory");
if (lprev)
lprev->next = l2;
lprev->next = l2;
else
ap->freelist = l2;
ap->freelist = l2;
if (lnext)
lnext->prev = l2;
lnext->prev = l2;
return L2P(l2);
}

View File

@ -1,5 +1,5 @@
/* $MirBSD: c_ksh.c,v 1.2 2004/04/17 00:47:17 tg Exp $ */
/* $OpenBSD: c_ksh.c,v 1.17 2003/10/22 07:40:38 jmc Exp $ */
/* $MirBSD: c_ksh.c,v 1.3 2004/05/23 12:47:00 tg Exp $ */
/* $OpenBSD: c_ksh.c,v 1.18 2004/02/10 13:03:36 jmc Exp $ */
/*
* built-in Korn commands: c_*
@ -1276,7 +1276,7 @@ c_kill(wp)
if (j_kill(p, sig))
rv = 1;
} else if (!getn(p, &n)) {
bi_errorf("%s: arguments must be jobs or process ids",
bi_errorf("%s: arguments must be jobs or process IDs",
p);
rv = 1;
} else {

View File

@ -1,5 +1,5 @@
.\" $MirBSD: ksh.1tbl,v 1.23 2004/04/29 19:06:24 tg Exp $
.\" $OpenBSD: ksh.1tbl,v 1.65 2004/01/23 23:08:45 jmc Exp $
.\" $MirBSD: ksh.1tbl,v 1.24 2004/05/23 12:47:00 tg Exp $
.\" $OpenBSD: ksh.1tbl,v 1.70 2004/05/09 06:07:42 otto Exp $
.\"
.\" Copyright (c) 1980, 1990, 1993
.\" The Regents of the University of California. All rights reserved.
@ -376,8 +376,8 @@ to the standard input of the following command.
The exit status of a pipeline is that of its last command.
A pipeline may be prefixed by the
.Ql \&!
reversed word which causes the exit status of the pipeline to be logically
complemented: if the original status was 0 the complemented status will be 1;
reserved word, which causes the exit status of the pipeline to be logically
complemented: if the original status was 0, the complemented status will be 1;
if the original status was not 0, the complemented status will be 0.
.Pp
.Em Lists
@ -575,7 +575,7 @@ is set to the word and
is executed.
If
.Ic in
is not used to specify a word list, the positional parameters ($1, $2, etc.)
is not used to specify a word list, the positional parameters ($1, $2, etc.\&)
are used instead.
For historical reasons, open and close braces may be used instead of
.Ic do
@ -1557,19 +1557,14 @@ May be unset or
.Dv NULL
if the shell doesn't know where it is.
.It Ev RANDOM
A simple random number generator.
A pseudo-random number generator.
Every time
.Ev RANDOM
is referenced, it is assigned the next number in a random number series.
The point in the series can be set by assigning a number to
.Ev RANDOM
(see
.Xr rand 3 ) .
.Pp
On systems which provide the
is referenced, it is assigned the next random number in the range
0\-32767.
The pseudo-random number generator is seeded via
.Xr arc4random 3
function, the random value is seeded on start by the arcfour
random number generator.
if the function exists, else with a less random mechanism.
If a feedback function is provided, changed values are propagated
back to the arcfour random number generator.
.It Ev REPLY
@ -5111,6 +5106,7 @@ deleted and a new prompt to be printed.
.It Pa /etc/suid_profile
.El
.Sh SEE ALSO
.Xr arc4random 1 ,
.Xr awk 1 ,
.Xr csh 1 ,
.Xr ed 1 ,

21
sh.h
View File

@ -1,10 +1,5 @@
/* $MirBSD: sh.h,v 1.6 2003/12/23 13:41:50 tg Exp $ */
/* $OpenBSD: sh.h,v 1.15 2003/10/22 07:40:38 jmc Exp $ */
/*
* Public Domain Bourne/Korn shell
*/
/* $MirBSD: sh.h,v 1.7 2004/05/23 12:47:01 tg Exp $ */
/* $OpenBSD: sh.h,v 1.17 2004/05/10 16:28:47 pvalchev Exp $ */
/* $From: sh.h,v 1.2 1994/05/19 18:32:40 michael Exp michael $ */
#include "config.h" /* system and option configuration info */
@ -247,15 +242,7 @@ extern int dup2 ARGS((int, int));
* by autoconf (assumes an 8 bit byte, but I'm not concerned).
* NOTE: INT32 may end up being more than 32 bits.
*/
#if SIZEOF_INT >= 4
# define INT32 int
#else /* SIZEOF_INT */
# if SIZEOF_LONG >= 4
# define INT32 long
# else /* SIZEOF_LONG */
#error cannot find 32 bit type...
# endif /* SIZEOF_LONG */
#endif /* SIZEOF_INT */
/* end of common headers */
@ -367,8 +354,8 @@ typedef INT32 Tflag;
#define NOT '!' /* might use ^ (ie, [!...] vs [^..]) */
#define LINE 4096 /* input line size */
#define PATH 4096 /* pathname size (todo: PATH_MAX/pathconf()) */
#define ARRAYMAX 4095 /* max array index */
#define PATH 1024 /* pathname size (todo: PATH_MAX/pathconf()) */
#define ARRAYMAX 2047 /* max array index */
EXTERN const char *kshname; /* $0 */
EXTERN pid_t kshpid; /* $$, shell pid */

8
var.c
View File

@ -1,5 +1,5 @@
/* $MirBSD: var.c,v 1.4 2004/04/29 18:58:16 tg Exp $ */
/* $OpenBSD: var.c,v 1.16 2003/08/05 20:52:27 millert Exp $ */
/* $MirBSD: var.c,v 1.5 2004/05/23 12:47:01 tg Exp $ */
/* $OpenBSD: var.c,v 1.17 2004/05/08 19:42:35 deraadt Exp $ */
#include "sh.h"
#include "ksh_time.h"
@ -885,13 +885,11 @@ makenv()
/*
* Called after a fork in parent to bump the random number generator.
* Done to ensure children will not get the same random number sequence
* if the parent doesn't use $RANDOM.
*/
void
change_random()
{
prng_seed(rand());
srand(prng_seed(rand() ^ time(NULL)));
}
/*

4
vi.c
View File

@ -1,5 +1,5 @@
/* $MirBSD: vi.c,v 1.3 2003/12/23 13:41:51 tg Exp $ */
/* $OpenBSD: vi.c,v 1.12 2003/10/16 22:08:48 millert Exp $ */
/* $MirBSD: vi.c,v 1.4 2004/05/23 12:47:01 tg Exp $ */
/* $OpenBSD: vi.c,v 1.13 2004/05/10 16:28:47 pvalchev Exp $ */
/*
* vi command editing