diff options
Diffstat (limited to 'usr.bin')
44 files changed, 975 insertions, 206 deletions
diff --git a/usr.bin/apply/apply.1 b/usr.bin/apply/apply.1 index 6b6b3e5ad27..3fdaa99a77d 100644 --- a/usr.bin/apply/apply.1 +++ b/usr.bin/apply/apply.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: apply.1,v 1.3 1995/03/25 03:38:21 glass Exp $ +.\" $NetBSD: apply.1,v 1.4 1996/03/18 23:16:57 jtc Exp $ .\" .\" Copyright (c) 1983, 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -82,7 +82,7 @@ is run, without arguments, once for each If any sequences of .Dq Li \&%d occur in command, the -.Fl n +.Fl # option is ignored. .It Fl a Ns Ar c The use of the character diff --git a/usr.bin/file/magdir/OpenBSD b/usr.bin/file/magdir/OpenBSD index 242aec64993..e7949cff490 100644 --- a/usr.bin/file/magdir/OpenBSD +++ b/usr.bin/file/magdir/OpenBSD @@ -10,6 +10,13 @@ >16 lelong >0 not stripped >32 byte 0x6a (uses shared libs) +0 lelong&077777777 041400314 FreeBSD/i386 demand paged +>3 byte &0x80 +>>20 lelong <4096 shared library +>>20 lelong =4096 dynamically linked executable +>>20 lelong >4096 dynamically linked executable +>3 byte ^0x80 executable +>16 lelong >0 not stripped 0 lelong 000000407 OpenBSD little-endian object file >16 lelong >0 not stripped @@ -183,3 +190,24 @@ >16 belong >0 not stripped 0 belong&0377777777 043400507 OpenBSD/mips core >12 string >\0 from '%s' + +0 belong&0377777777 043600413 NetBSD/arm32 demand paged +>0 byte &0x80 +>>20 lelong <8192 shared library +>>20 lelong =8192 dynamically linked executable +>>20 lelong >8192 dynamically linked executable +>0 byte ^0x80 executable +>16 lelong >0 not stripped +0 belong&0377777777 043600410 NetBSD/arm32 pure +>0 byte &0x80 dynamically linked executable +>0 byte ^0x80 executable +>16 lelong >0 not stripped +0 belong&0377777777 043600407 NetBSD/arm32 +>0 byte &0x80 dynamically linked executable +>0 byte ^0x80 +>>0 byte &0x40 position independent +>>20 lelong !0 executable +>>20 lelong =0 object file +>16 lelong >0 not stripped +0 belong&0377777777 043600507 NetBSD/arm32 core +>12 string >\0 from '%s' diff --git a/usr.bin/gencat/gencat.c b/usr.bin/gencat/gencat.c index 40f3104da48..b6b6b2afe0d 100644 --- a/usr.bin/gencat/gencat.c +++ b/usr.bin/gencat/gencat.c @@ -80,7 +80,7 @@ void usage() { fprintf(stderr, " catfile msgfile [-h <header-file>]...\n"); } -void main( +int main( #if ANSI_C || defined(__cplusplus) int argc, char *argv[]) #else diff --git a/usr.bin/gprof/arm32.c b/usr.bin/gprof/arm32.c new file mode 100644 index 00000000000..2b0bfdfa19c --- /dev/null +++ b/usr.bin/gprof/arm32.c @@ -0,0 +1,17 @@ +/* $NetBSD: arm32.c,v 1.1 1996/04/01 21:51:22 mark Exp $ */ + +#ifndef lint +static char rcsid[] = "$NetBSD: arm32.c,v 1.1 1996/04/01 21:51:22 mark Exp $"; +#endif /* not lint */ + +#include "gprof.h" + +/* + * gprof -c isn't currently supported... + */ +findcall( parentp , p_lowpc , p_highpc ) + nltype *parentp; + unsigned long p_lowpc; + unsigned long p_highpc; +{ +} diff --git a/usr.bin/gprof/arm32.h b/usr.bin/gprof/arm32.h new file mode 100644 index 00000000000..fd4c0f4e4ef --- /dev/null +++ b/usr.bin/gprof/arm32.h @@ -0,0 +1,45 @@ +/* $NetBSD: arm32.h,v 1.1 1996/04/01 21:51:26 mark Exp $ */ + +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * offset (in bytes) of the code from the entry address of a routine. + * (see asgnsamples for use and explanation.) + */ + +#define OFFSET_OF_CODE 0 +#define UNITS_TO_CODE (OFFSET_OF_CODE / sizeof(UNIT)) + +enum opermodes { dummy }; +typedef enum opermodes operandenum; diff --git a/usr.bin/gprof/gprof.h b/usr.bin/gprof/gprof.h index d0ba72299df..681d9e92477 100644 --- a/usr.bin/gprof/gprof.h +++ b/usr.bin/gprof/gprof.h @@ -1,4 +1,4 @@ -/* $NetBSD: gprof.h,v 1.12 1995/04/19 07:22:59 cgd Exp $ */ +/* $NetBSD: gprof.h,v 1.13 1996/04/01 21:54:06 mark Exp $ */ /* * Copyright (c) 1983, 1993 @@ -46,6 +46,9 @@ #if alpha # include "alpha.h" #endif +#if arm32 +# include "arm32.h" +#endif #if i386 # include "i386.h" #endif diff --git a/usr.bin/make/buf.c b/usr.bin/make/buf.c index 22d3a0e855d..52179007773 100644 --- a/usr.bin/make/buf.c +++ b/usr.bin/make/buf.c @@ -1,4 +1,4 @@ -/* $NetBSD: buf.c,v 1.6 1995/06/14 15:18:51 christos Exp $ */ +/* $NetBSD: buf.c,v 1.7 1996/03/29 02:17:13 jtc Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = "@(#)buf.c 5.5 (Berkeley) 12/28/90"; #else -static char rcsid[] = "$NetBSD: buf.c,v 1.6 1995/06/14 15:18:51 christos Exp $"; +static char rcsid[] = "$NetBSD: buf.c,v 1.7 1996/03/29 02:17:13 jtc Exp $"; #endif #endif /* not lint */ @@ -69,7 +69,7 @@ static char rcsid[] = "$NetBSD: buf.c,v 1.6 1995/06/14 15:18:51 christos Exp $"; #define BufExpand(bp,nb) \ if (bp->left < (nb)+1) {\ int newSize = (bp)->size + max((nb)+1,BUF_ADD_INC); \ - Byte *newBuf = (Byte *) realloc((bp)->buffer, newSize); \ + Byte *newBuf = (Byte *) erealloc((bp)->buffer, newSize); \ \ (bp)->inPtr = newBuf + ((bp)->inPtr - (bp)->buffer); \ (bp)->outPtr = newBuf + ((bp)->outPtr - (bp)->buffer);\ diff --git a/usr.bin/make/extern.h b/usr.bin/make/extern.h index c719a2ca197..d1b948ecf54 100644 --- a/usr.bin/make/extern.h +++ b/usr.bin/make/extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: nonints.h,v 1.7 1995/11/02 23:55:00 christos Exp $ */ +/* $NetBSD: nonints.h,v 1.9 1996/03/31 21:30:07 christos Exp $ */ /*- * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -71,7 +71,8 @@ void Punt __P((char *, ...)); void DieHorribly __P((void)); int PrintAddr __P((ClientData, ClientData)); void Finish __P((int)); -char *emalloc __P((size_t)); +void *emalloc __P((size_t)); +void *erealloc __P((void *, size_t)); void enomem __P((void)); int eunlink __P((const char *)); diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c index 0bf0ab56f1d..5ffcbcfb3a5 100644 --- a/usr.bin/make/main.c +++ b/usr.bin/make/main.c @@ -1,5 +1,5 @@ -/* $OpenBSD: main.c,v 1.6 1996/03/27 19:32:36 niklas Exp $ */ -/* $NetBSD: main.c,v 1.26 1996/03/11 13:45:33 christos Exp $ */ +/* $OpenBSD: main.c,v 1.7 1996/04/21 23:43:21 deraadt Exp $ */ +/* $NetBSD: main.c,v 1.28 1996/03/31 21:30:05 christos Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -50,7 +50,7 @@ char copyright[] = static char sccsid[] = "@(#)main.c 5.25 (Berkeley) 4/1/91"; static char rcsid[] = "$NetBSD: main.c,v 1.26 1996/03/11 13:45:33 christos Exp $"; #else -static char rcsid[] = "$OpenBSD: main.c,v 1.6 1996/03/27 19:32:36 niklas Exp $"; +static char rcsid[] = "$OpenBSD: main.c,v 1.7 1996/04/21 23:43:21 deraadt Exp $"; #endif #endif /* not lint */ @@ -981,18 +981,32 @@ Finish(errors) * emalloc -- * malloc, but die on error. */ -char * +void * emalloc(len) size_t len; { - char *p; + void *p; - if ((p = (char *) malloc(len)) == NULL) + if ((p = malloc(len)) == NULL) enomem(); return(p); } /* + * erealloc -- + * realloc, but die on error. + */ +void * +erealloc(ptr, size) + void *ptr; + size_t size; +{ + if ((ptr = realloc(ptr, size)) == NULL) + enomem(); + return(ptr); +} + +/* * enomem -- * die when out of memory. */ diff --git a/usr.bin/make/nonints.h b/usr.bin/make/nonints.h index c719a2ca197..d1b948ecf54 100644 --- a/usr.bin/make/nonints.h +++ b/usr.bin/make/nonints.h @@ -1,4 +1,4 @@ -/* $NetBSD: nonints.h,v 1.7 1995/11/02 23:55:00 christos Exp $ */ +/* $NetBSD: nonints.h,v 1.9 1996/03/31 21:30:07 christos Exp $ */ /*- * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -71,7 +71,8 @@ void Punt __P((char *, ...)); void DieHorribly __P((void)); int PrintAddr __P((ClientData, ClientData)); void Finish __P((int)); -char *emalloc __P((size_t)); +void *emalloc __P((size_t)); +void *erealloc __P((void *, size_t)); void enomem __P((void)); int eunlink __P((const char *)); diff --git a/usr.bin/make/str.c b/usr.bin/make/str.c index 77f773483be..94dacf99a89 100644 --- a/usr.bin/make/str.c +++ b/usr.bin/make/str.c @@ -1,4 +1,4 @@ -/* $NetBSD: str.c,v 1.10.2.1 1995/10/30 22:55:14 jtc Exp $ */ +/* $NetBSD: str.c,v 1.12 1996/03/29 02:17:34 jtc Exp $ */ /*- * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = "@(#)str.c 5.8 (Berkeley) 6/1/90"; #else -static char rcsid[] = "$NetBSD: str.c,v 1.10.2.1 1995/10/30 22:55:14 jtc Exp $"; +static char rcsid[] = "$NetBSD: str.c,v 1.12 1996/03/29 02:17:34 jtc Exp $"; #endif #endif /* not lint */ @@ -206,9 +206,8 @@ brk_string(str, store_argc, expand) *t++ = '\0'; if (argc == argmax) { argmax *= 2; /* ramp up fast */ - if (!(argv = (char **)realloc(argv, - (argmax + 1) * sizeof(char *)))) - enomem(); + argv = (char **)erealloc(argv, + (argmax + 1) * sizeof(char *)); } argv[argc++] = start; start = (char *)NULL; diff --git a/usr.bin/make/targ.c b/usr.bin/make/targ.c index 143cbd329b2..6d047701616 100644 --- a/usr.bin/make/targ.c +++ b/usr.bin/make/targ.c @@ -1,4 +1,5 @@ -/* $NetBSD: targ.c,v 1.6 1995/12/16 05:03:15 christos Exp $ */ +/* $OpenBSD: targ.c,v 1.3 1996/04/21 23:43:28 deraadt Exp $ */ +/* $NetBSD: targ.c,v 1.7 1996/04/08 18:57:49 jtc Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -40,7 +41,7 @@ #ifndef lint /* from: static char sccsid[] = "@(#)targ.c 5.9 (Berkeley) 3/1/91"; */ -static char *rcsid = "$Id: targ.c,v 1.2 1995/12/17 13:42:03 deraadt Exp $"; +static char *rcsid = "$Id: targ.c,v 1.3 1996/04/21 23:43:28 deraadt Exp $"; #endif /* not lint */ /*- @@ -471,9 +472,9 @@ Targ_FmtTime (time) parts = localtime(&time); - sprintf (buf, "%d:%02d:%02d %s %d, 19%d", + sprintf (buf, "%d:%02d:%02d %s %d, %d", parts->tm_hour, parts->tm_min, parts->tm_sec, - months[parts->tm_mon], parts->tm_mday, parts->tm_year); + months[parts->tm_mon], parts->tm_mday, 1900 + parts->tm_year); return(buf); } diff --git a/usr.bin/quota/quota.c b/usr.bin/quota/quota.c index dc0b07f2d11..6ec5d5f9b5a 100644 --- a/usr.bin/quota/quota.c +++ b/usr.bin/quota/quota.c @@ -42,7 +42,7 @@ static char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)quota.c 8.1 (Berkeley) 6/6/93";*/ -static char rcsid[] = "$Id: quota.c,v 1.2 1995/11/25 16:46:24 deraadt Exp $"; +static char rcsid[] = "$Id: quota.c,v 1.3 1996/04/21 23:43:38 deraadt Exp $"; #endif /* not lint */ /* @@ -92,11 +92,11 @@ main(argc, argv) int ngroups; gid_t mygid, gidset[NGROUPS]; int i, gflag = 0, uflag = 0; - char ch; + int ch; extern char *optarg; extern int optind, errno; - while ((ch = getopt(argc, argv, "ugvq")) != EOF) { + while ((ch = getopt(argc, argv, "ugvq")) != -1) { switch(ch) { case 'g': gflag++; diff --git a/usr.bin/rusers/rusers.c b/usr.bin/rusers/rusers.c index 813634181ad..4fb7222e740 100644 --- a/usr.bin/rusers/rusers.c +++ b/usr.bin/rusers/rusers.c @@ -27,7 +27,7 @@ */ #ifndef lint -static char rcsid[] = "$Id: rusers.c,v 1.1 1995/10/18 08:46:04 deraadt Exp $"; +static char rcsid[] = "$Id: rusers.c,v 1.2 1996/04/21 23:43:46 deraadt Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -224,13 +224,15 @@ allhosts(void) } } -void usage(void) +void +usage(void) { fprintf(stderr, "Usage: %s [-la] [hosts ...]\n", argv0); exit(1); } -void main(int argc, char *argv[]) +int +main(int argc, char *argv[]) { int ch; extern int optind; diff --git a/usr.bin/showmount/showmount.c b/usr.bin/showmount/showmount.c index 77440130481..953036b0af8 100644 --- a/usr.bin/showmount/showmount.c +++ b/usr.bin/showmount/showmount.c @@ -1,4 +1,4 @@ -/* $NetBSD: showmount.c,v 1.5 1995/08/31 22:26:08 jtc Exp $ */ +/* $NetBSD: showmount.c,v 1.6 1996/04/01 21:32:19 mark Exp $ */ /* * Copyright (c) 1989, 1993, 1995 @@ -46,7 +46,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)showmount.c 8.3 (Berkeley) 3/29/95"; #endif -static char rcsid[] = "$NetBSD: showmount.c,v 1.5 1995/08/31 22:26:08 jtc Exp $"; +static char rcsid[] = "$NetBSD: showmount.c,v 1.6 1996/04/01 21:32:19 mark Exp $"; #endif not lint #include <sys/types.h> @@ -114,9 +114,10 @@ main(argc, argv) struct exportslist *exp; struct grouplist *grp; int estat, rpcs = 0, mntvers = 1; - char ch, *host; + char *host; + int ch; - while ((ch = getopt(argc, argv, "ade3")) != EOF) + while ((ch = getopt(argc, argv, "ade3")) != -1) switch((char)ch) { case 'a': if (type == 0) { diff --git a/usr.bin/systat/main.c b/usr.bin/systat/main.c index 49929243a37..6d1e8ee9a0c 100644 --- a/usr.bin/systat/main.c +++ b/usr.bin/systat/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.6 1995/05/06 06:25:07 jtc Exp $ */ +/* $NetBSD: main.c,v 1.7 1996/03/21 18:04:25 jtc Exp $ */ /*- * Copyright (c) 1980, 1992, 1993 @@ -43,7 +43,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$NetBSD: main.c,v 1.6 1995/05/06 06:25:07 jtc Exp $"; +static char rcsid[] = "$NetBSD: main.c,v 1.7 1996/03/21 18:04:25 jtc Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -82,7 +82,7 @@ int CMDLINE; static WINDOW *wload; /* one line window for load average */ -void +int main(argc, argv) int argc; char **argv; diff --git a/usr.bin/telnet/commands.c b/usr.bin/telnet/commands.c index 85e8b9daeab..769e2ee4070 100644 --- a/usr.bin/telnet/commands.c +++ b/usr.bin/telnet/commands.c @@ -1,5 +1,5 @@ -/* $OpenBSD: commands.c,v 1.3 1996/03/27 19:32:58 niklas Exp $ */ -/* $NetBSD: commands.c,v 1.13 1996/02/28 21:03:53 thorpej Exp $ */ +/* $OpenBSD: commands.c,v 1.4 1996/04/21 23:44:11 deraadt Exp $ */ +/* $NetBSD: commands.c,v 1.14 1996/03/24 22:03:48 jtk Exp $ */ /* * Copyright (c) 1988, 1990, 1993 @@ -37,9 +37,9 @@ #ifndef lint #if 0 static char sccsid[] = "@(#)commands.c 8.4 (Berkeley) 5/30/95"; -static char rcsid[] = "$NetBSD: commands.c,v 1.13 1996/02/28 21:03:53 thorpej Exp $"; +static char rcsid[] = "$NetBSD: commands.c,v 1.14 1996/03/24 22:03:48 jtk Exp $"; #else -static char rcsid[] = "$OpenBSD: commands.c,v 1.3 1996/03/27 19:32:58 niklas Exp $"; +static char rcsid[] = "$OpenBSD: commands.c,v 1.4 1996/04/21 23:44:11 deraadt Exp $"; #endif #endif /* not lint */ @@ -2172,7 +2172,11 @@ tn(argc, argv) if (temp != INADDR_NONE) { sin.sin_addr.s_addr = temp; sin.sin_family = AF_INET; - (void) strcpy(_hostname, hostp); + host = gethostbyaddr((char *)&temp, sizeof(temp), AF_INET); + if (host) + (void) strcpy(_hostname, host->h_name); + else + (void) strcpy(_hostname, hostp); hostname = _hostname; } else { host = gethostbyname(hostp); diff --git a/usr.bin/units/Makefile b/usr.bin/units/Makefile index 9f583691d3d..4b6b5307b0e 100644 --- a/usr.bin/units/Makefile +++ b/usr.bin/units/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.1 1995/10/18 08:46:30 deraadt Exp $ +# $OpenBSD: Makefile,v 1.2 1996/04/21 23:44:23 deraadt Exp $ PROG= units diff --git a/usr.bin/units/README b/usr.bin/units/README index b44435a3dab..ce335343db6 100644 --- a/usr.bin/units/README +++ b/usr.bin/units/README @@ -1,4 +1,4 @@ -# NetBSD $Id: README,v 1.1 1995/10/18 08:46:30 deraadt Exp $ +# $NetBSD: README,v 1.2 1996/04/06 06:00:59 thorpej Exp $ This is a program which I wrote as a clone of the UNIX 'units' command. I threw it together in a couple days, but it seems to work, diff --git a/usr.bin/units/pathnames.h b/usr.bin/units/pathnames.h index fb2200404d7..94253eaf253 100644 --- a/usr.bin/units/pathnames.h +++ b/usr.bin/units/pathnames.h @@ -1,3 +1,5 @@ +/* $NetBSD: pathnames.h,v 1.3 1996/04/06 06:01:00 thorpej Exp $ */ + /* * Copyright (c) 1993 Christopher G. Demetriou * All rights reserved. @@ -26,8 +28,6 @@ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $Id: pathnames.h,v 1.1 1995/10/18 08:46:30 deraadt Exp $ */ #define _PATH_UNITSLIB "/usr/share/misc/units.lib" diff --git a/usr.bin/units/units.1 b/usr.bin/units/units.1 index 6679a7f0cc1..d5e0f6cdd80 100644 --- a/usr.bin/units/units.1 +++ b/usr.bin/units/units.1 @@ -1,4 +1,4 @@ -.\" $Id: units.1,v 1.1 1995/10/18 08:46:30 deraadt Exp $ +.\" $NetBSD: units.1,v 1.6 1996/04/06 06:01:02 thorpej Exp $ .TH UNITS 1 "14 July 1993" .SH NAME units - conversion program diff --git a/usr.bin/units/units.c b/usr.bin/units/units.c index 269a790ce99..13aaf1a2d06 100644 --- a/usr.bin/units/units.c +++ b/usr.bin/units/units.c @@ -1,3 +1,5 @@ +/* $NetBSD: units.c,v 1.6 1996/04/06 06:01:03 thorpej Exp $ */ + /* * units.c Copyright (c) 1993 by Adrian Mariano (adrian@cam.cornell.edu) * @@ -13,8 +15,6 @@ * * I would appreciate (though I do not require) receiving a copy of any * improvements you might make to this program. - * - * $Id: units.c,v 1.1 1995/10/18 08:46:30 deraadt Exp $ */ #include <ctype.h> @@ -625,20 +625,20 @@ usage() } -void +int main(int argc, char **argv) { struct unittype have, want; char havestr[81], wantstr[81]; - char optchar; + int optchar; char *userfile = 0; int quiet = 0; extern char *optarg; extern int optind; - while (EOF != (optchar = getopt(argc, argv, "vqf:"))) { + while ((optchar = getopt(argc, argv, "vqf:")) != -1) { switch (optchar) { case 'f': userfile = optarg; diff --git a/usr.bin/units/units.lib b/usr.bin/units/units.lib index 4cc61024dc2..060e3ed3d82 100644 --- a/usr.bin/units/units.lib +++ b/usr.bin/units/units.lib @@ -1,4 +1,4 @@ -/ $Id: units.lib,v 1.1 1995/10/18 08:46:30 deraadt Exp $ +/ $NetBSD: units.lib,v 1.3 1996/04/06 06:01:04 thorpej Exp $ / primitive units diff --git a/usr.bin/vgrind/vfontedpr.c b/usr.bin/vgrind/vfontedpr.c index 1bcf6f83ffc..2b67f566a3f 100644 --- a/usr.bin/vgrind/vfontedpr.c +++ b/usr.bin/vgrind/vfontedpr.c @@ -1,4 +1,4 @@ -/* $NetBSD: vfontedpr.c,v 1.3 1994/11/17 08:28:03 jtc Exp $ */ +/* $NetBSD: vfontedpr.c,v 1.4 1996/03/21 18:08:30 jtc Exp $ */ /* * Copyright (c) 1980, 1993 @@ -43,7 +43,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)vfontedpr.c 8.1 (Berkeley) 6/6/93"; #endif -static char rcsid[] = "$NetBSD: vfontedpr.c,v 1.3 1994/11/17 08:28:03 jtc Exp $"; +static char rcsid[] = "$NetBSD: vfontedpr.c,v 1.4 1996/03/21 18:08:30 jtc Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -130,7 +130,7 @@ char *language = "c"; /* the language indicator */ #define ps(x) printf("%s", x) -void +int main(argc, argv) int argc; char *argv[]; diff --git a/usr.bin/vmstat/vmstat.c b/usr.bin/vmstat/vmstat.c index 11d06254ec3..9d388064806 100644 --- a/usr.bin/vmstat/vmstat.c +++ b/usr.bin/vmstat/vmstat.c @@ -1,5 +1,5 @@ -/* $NetBSD: vmstat.c,v 1.27 1995/10/10 01:17:35 cgd Exp $ */ -/* $OpenBSD: vmstat.c,v 1.8 1996/04/18 12:00:05 mickey Exp $ */ +/* $OpenBSD: vmstat.c,v 1.9 1996/04/21 23:44:44 deraadt Exp $ */ +/* $NetBSD: vmstat.c,v 1.28 1996/04/04 00:27:50 cgd Exp $ */ /* * Copyright (c) 1980, 1986, 1991, 1993 @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)vmstat.c 8.1 (Berkeley) 6/6/93"; #else -static char rcsid[] = "$NetBSD: vmstat.c,v 1.27 1995/10/10 01:17:35 cgd Exp $"; +static char rcsid[] = "$NetBSD: vmstat.c,v 1.28 1996/04/04 00:27:50 cgd Exp $"; #endif #endif /* not lint */ @@ -770,7 +770,8 @@ dointr() register long *intrcnt, inttotal, uptime; register int nintr, inamlen; register char *intrname; - struct evcnt evcnt, *allevents; + struct evcntlist allevents; + struct evcnt evcnt, *evptr; struct device dev; uptime = getuptime(); @@ -796,8 +797,9 @@ dointr() inttotal += *intrcnt++; } kread(X_ALLEVENTS, &allevents, sizeof allevents); - while (allevents) { - if (kvm_read(kd, (long)allevents, (void *)&evcnt, + evptr = allevents.tqh_first; + while (evptr) { + if (kvm_read(kd, (long)evptr, (void *)&evcnt, sizeof evcnt) != sizeof evcnt) { (void)fprintf(stderr, "vmstat: event chain trashed\n", kvm_geterr(kd)); @@ -815,7 +817,7 @@ dointr() evcnt.ev_count, evcnt.ev_count / uptime); inttotal += evcnt.ev_count++; } - allevents = evcnt.ev_next; + evptr = evcnt.ev_list.tqe_next; } (void)printf("Total %8ld %8ld\n", inttotal, inttotal / uptime); } diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c index 25d3cdbcb30..1eee27dde0b 100644 --- a/usr.bin/w/w.c +++ b/usr.bin/w/w.c @@ -222,7 +222,7 @@ main(argc, argv) (void)printf(HEADER); if ((kp = kvm_getprocs(kd, KERN_PROC_ALL, 0, &nentries)) == NULL) - err(1, "%s", kvm_geterr(kd)); + errx(1, "%s", kvm_geterr(kd)); for (i = 0; i < nentries; i++, kp++) { struct proc *p = &kp->kp_proc; struct eproc *e; diff --git a/usr.bin/xlint/lint1/param.h b/usr.bin/xlint/lint1/param.h index 3ff1c1e1539..46ae4b74322 100644 --- a/usr.bin/xlint/lint1/param.h +++ b/usr.bin/xlint/lint1/param.h @@ -1,4 +1,4 @@ -/* $NetBSD: param.h,v 1.5 1995/12/17 02:53:11 jonathan Exp $ */ +/* $NetBSD: param.h,v 1.6 1996/04/01 21:47:57 mark Exp $ */ /* * Copyright (c) 1994, 1995 Jochen Pohl @@ -81,6 +81,9 @@ #elif __vax__ #define PTRDIFF_IS_LONG 0 #define SIZEOF_IS_ULONG 0 +#elif __arm32__ +#define PTRDIFF_IS_LONG 0 +#define SIZEOF_IS_ULONG 0 #else #error unknown machine type #endif diff --git a/usr.bin/yacc/Makefile b/usr.bin/yacc/Makefile index 45717e3ab05..07e3da18cd5 100644 --- a/usr.bin/yacc/Makefile +++ b/usr.bin/yacc/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile,v 1.1 1995/10/18 08:47:05 deraadt Exp $ +# $OpenBSD: Makefile,v 1.2 1996/04/21 23:45:02 deraadt Exp $ PROG= yacc SRCS= closure.c error.c lalr.c lr0.c main.c mkpar.c output.c reader.c \ diff --git a/usr.bin/yacc/closure.c b/usr.bin/yacc/closure.c index 9a029180939..303bfbaf0c4 100644 --- a/usr.bin/yacc/closure.c +++ b/usr.bin/yacc/closure.c @@ -1,5 +1,47 @@ +/* $NetBSD: closure.c,v 1.4 1996/03/19 03:21:29 jtc Exp $ */ + +/* + * Copyright (c) 1989 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Robert Paul Corbett. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + #ifndef lint -static char rcsid[] = "$Id: closure.c,v 1.1 1995/10/18 08:47:05 deraadt Exp $"; +#if 0 +static char sccsid[] = "@(#)closure.c 5.3 (Berkeley) 5/24/93"; +#else +static char rcsid[] = "$NetBSD: closure.c,v 1.4 1996/03/19 03:21:29 jtc Exp $"; +#endif #endif /* not lint */ #include "defs.h" diff --git a/usr.bin/yacc/defs.h b/usr.bin/yacc/defs.h index 57e2e28151c..00116e1ea42 100644 --- a/usr.bin/yacc/defs.h +++ b/usr.bin/yacc/defs.h @@ -1,4 +1,43 @@ -/* $OpenBSD: defs.h,v 1.4 1996/03/31 04:56:00 etheisen Exp $ */ +/* $OpenBSD: defs.h,v 1.5 1996/04/21 23:45:06 deraadt Exp $ */ +/* $NetBSD: defs.h,v 1.6 1996/03/19 03:21:30 jtc Exp $ */ + +/* + * Copyright (c) 1989 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Robert Paul Corbett. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * @(#)defs.h 5.6 (Berkeley) 5/24/93 + */ #include <assert.h> #include <ctype.h> diff --git a/usr.bin/yacc/error.c b/usr.bin/yacc/error.c index 9470e6373d8..9b33f451c72 100644 --- a/usr.bin/yacc/error.c +++ b/usr.bin/yacc/error.c @@ -1,9 +1,51 @@ -/* routines for printing error messages */ +/* $NetBSD: error.c,v 1.4 1996/03/19 03:21:32 jtc Exp $ */ + +/* + * Copyright (c) 1989 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Robert Paul Corbett. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ #ifndef lint -static char rcsid[] = "$Id: error.c,v 1.1 1995/10/18 08:47:05 deraadt Exp $"; +#if 0 +static char sccsid[] = "@(#)error.c 5.3 (Berkeley) 6/1/90"; +#else +static char rcsid[] = "$NetBSD: error.c,v 1.4 1996/03/19 03:21:32 jtc Exp $"; +#endif #endif /* not lint */ +/* routines for printing error messages */ + #include "defs.h" diff --git a/usr.bin/yacc/lalr.c b/usr.bin/yacc/lalr.c index 9dec69e6c1d..bf28f5510ab 100644 --- a/usr.bin/yacc/lalr.c +++ b/usr.bin/yacc/lalr.c @@ -1,5 +1,47 @@ +/* $NetBSD: lalr.c,v 1.4 1996/03/19 03:21:33 jtc Exp $ */ + +/* + * Copyright (c) 1989 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Robert Paul Corbett. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + #ifndef lint -static char rcsid[] = "$Id: lalr.c,v 1.1 1995/10/18 08:47:05 deraadt Exp $"; +#if 0 +static char sccsid[] = "@(#)lalr.c 5.3 (Berkeley) 6/1/90"; +#else +static char rcsid[] = "$NetBSD: lalr.c,v 1.4 1996/03/19 03:21:33 jtc Exp $"; +#endif #endif /* not lint */ #include "defs.h" diff --git a/usr.bin/yacc/lr0.c b/usr.bin/yacc/lr0.c index 5cdaf154b81..678f3579b36 100644 --- a/usr.bin/yacc/lr0.c +++ b/usr.bin/yacc/lr0.c @@ -1,5 +1,47 @@ +/* $NetBSD: lr0.c,v 1.4 1996/03/19 03:21:35 jtc Exp $ */ + +/* + * Copyright (c) 1989 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Robert Paul Corbett. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + #ifndef lint -static char rcsid[] = "$Id: lr0.c,v 1.1 1995/10/18 08:47:05 deraadt Exp $"; +#if 0 +static char sccsid[] = "@(#)lr0.c 5.3 (Berkeley) 1/20/91"; +#else +static char rcsid[] = "$NetBSD: lr0.c,v 1.4 1996/03/19 03:21:35 jtc Exp $"; +#endif #endif /* not lint */ #include "defs.h" diff --git a/usr.bin/yacc/main.c b/usr.bin/yacc/main.c index 82b6d409c80..e225915c2a8 100644 --- a/usr.bin/yacc/main.c +++ b/usr.bin/yacc/main.c @@ -1,5 +1,53 @@ +/* $NetBSD: main.c,v 1.5 1996/03/19 03:21:38 jtc Exp $ */ + +/* + * Copyright (c) 1989 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Robert Paul Corbett. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + #ifndef lint -static char rcsid[] = "$Id: main.c,v 1.2 1995/12/22 00:57:08 niklas Exp $"; +char copyright[] = +"@(#) Copyright (c) 1989 The Regents of the University of California.\n\ + All rights reserved.\n"; +#endif /* not lint */ + +#ifndef lint +#if 0 +static char sccsid[] = "@(#)main.c 5.5 (Berkeley) 5/24/93"; +#else +static char rcsid[] = "$NetBSD: main.c,v 1.5 1996/03/19 03:21:38 jtc Exp $"; +#endif #endif /* not lint */ #include <signal.h> @@ -78,7 +126,8 @@ int k; void -onintr() +onintr(signo) + int signo; { done(1); } diff --git a/usr.bin/yacc/mkpar.c b/usr.bin/yacc/mkpar.c index 34df17afc77..d044a0adb80 100644 --- a/usr.bin/yacc/mkpar.c +++ b/usr.bin/yacc/mkpar.c @@ -1,7 +1,49 @@ -/* $OpenBSD: mkpar.c,v 1.3 1996/03/31 04:56:02 etheisen Exp $ */ +/* $OpenBSD: mkpar.c,v 1.4 1996/04/21 23:45:15 deraadt Exp $ */ + +/* $NetBSD: mkpar.c,v 1.4 1996/03/19 03:21:39 jtc Exp $ */ + +/* + * Copyright (c) 1989 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Robert Paul Corbett. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ #ifndef lint -static char rcsid[] = "$Id: mkpar.c,v 1.3 1996/03/31 04:56:02 etheisen Exp $"; +#if 0 +static char sccsid[] = "@(#)mkpar.c 5.3 (Berkeley) 1/20/91"; +#else +static char rcsid[] = "$NetBSD: mkpar.c,v 1.4 1996/03/19 03:21:39 jtc Exp $"; +#endif #endif /* not lint */ #include "defs.h" @@ -360,4 +402,3 @@ free_parser() FREE(parser); } - diff --git a/usr.bin/yacc/output.c b/usr.bin/yacc/output.c index cda64a5c9c0..63844fcfdbd 100644 --- a/usr.bin/yacc/output.c +++ b/usr.bin/yacc/output.c @@ -1,5 +1,47 @@ +/* $NetBSD: output.c,v 1.4 1996/03/19 03:21:41 jtc Exp $ */ + +/* + * Copyright (c) 1989 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Robert Paul Corbett. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + #ifndef lint -static char rcsid[] = "$Id: output.c,v 1.1 1995/10/18 08:47:06 deraadt Exp $"; +#if 0 +static char sccsid[] = "@(#)output.c 5.7 (Berkeley) 5/24/93"; +#else +static char rcsid[] = "$NetBSD: output.c,v 1.4 1996/03/19 03:21:41 jtc Exp $"; +#endif #endif /* not lint */ #include "defs.h" diff --git a/usr.bin/yacc/reader.c b/usr.bin/yacc/reader.c index f0504e32239..84e8fe6fce1 100644 --- a/usr.bin/yacc/reader.c +++ b/usr.bin/yacc/reader.c @@ -1,7 +1,49 @@ -/* $OpenBSD: reader.c,v 1.4 1996/03/31 04:56:01 etheisen Exp $ */ +/* $OpenBSD: reader.c,v 1.5 1996/04/21 23:45:19 deraadt Exp $ */ + +/* $NetBSD: reader.c,v 1.5 1996/03/19 03:21:43 jtc Exp $ */ + +/* + * Copyright (c) 1989 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Robert Paul Corbett. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ #ifndef lint -static char rcsid[] = "$Id: reader.c,v 1.4 1996/03/31 04:56:01 etheisen Exp $"; +#if 0 +static char sccsid[] = "@(#)reader.c 5.7 (Berkeley) 1/20/91"; +#else +static char rcsid[] = "$NetBSD: reader.c,v 1.5 1996/03/19 03:21:43 jtc Exp $"; +#endif #endif /* not lint */ #include "defs.h" diff --git a/usr.bin/yacc/skeleton.c b/usr.bin/yacc/skeleton.c index 7fa773f16a1..de78f96b6c5 100644 --- a/usr.bin/yacc/skeleton.c +++ b/usr.bin/yacc/skeleton.c @@ -1,4 +1,49 @@ -/* $OpenBSD: skeleton.c,v 1.3 1996/03/27 19:33:21 niklas Exp $ */ +/* $OpenBSD: skeleton.c,v 1.4 1996/04/21 23:45:21 deraadt Exp $ */ +/* $NetBSD: skeleton.c,v 1.10 1996/03/25 00:36:18 mrg Exp $ */ + +/* + * Copyright (c) 1989 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Robert Paul Corbett. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#ifndef lint +#if 0 +static char sccsid[] = "@(#)skeleton.c 5.8 (Berkeley) 4/29/95"; +#else +static char rcsid[] = "$NetBSD: skeleton.c,v 1.10 1996/03/25 00:36:18 mrg Exp $"; +#endif +#endif /* not lint */ #include "defs.h" @@ -18,8 +63,9 @@ char *banner[] = { "#ifndef lint", "/*static char yysccsid[] = \"from: @(#)yaccpar 1.9 (Berkeley) 02/21/93\";*/", - "static char yyrcsid[] = \"$OpenBSD: skeleton.c,v 1.3 1996/03/27 19:33:21 niklas Exp $\";", + "static char yyrcsid[] = \"$OpenBSD: skeleton.c,v 1.4 1996/04/21 23:45:21 deraadt Exp $\";", "#endif", + "#include <stdlib.h>", "#define YYBYACC 1", "#define YYMAJOR 1", "#define YYMINOR 9", @@ -60,10 +106,11 @@ char *header[] = "#ifdef YYMAXDEPTH", "#define YYSTACKSIZE YYMAXDEPTH", "#else", - "#define YYSTACKSIZE 500", - "#define YYMAXDEPTH 500", + "#define YYSTACKSIZE 10000", + "#define YYMAXDEPTH 10000", "#endif", "#endif", + "#define YYINITSTACKSIZE 200", "int yydebug;", "int yynerrs;", "int yyerrflag;", @@ -72,30 +119,53 @@ char *header[] = "YYSTYPE *yyvsp;", "YYSTYPE yyval;", "YYSTYPE yylval;", - "short yyss[YYSTACKSIZE];", - "YYSTYPE yyvs[YYSTACKSIZE];", - "#define yystacksize YYSTACKSIZE", + "short *yyss;", + "short *yysslim;", + "YYSTYPE *yyvs;", + "int yystacksize;", 0 }; char *body[] = { + "/* allocate initial stack or double stack size, up to YYMAXDEPTH */", + "static int yygrowstack()", + "{", + " int newsize, i;", + " short *newss;", + " YYSTYPE *newvs;", + "", + " if ((newsize = yystacksize) == 0)", + " newsize = YYINITSTACKSIZE;", + " else if (newsize >= YYMAXDEPTH)", + " return -1;", + " else if ((newsize *= 2) > YYMAXDEPTH)", + " newsize = YYMAXDEPTH;", + " i = yyssp - yyss;", + " if ((newss = (short *)realloc(yyss, newsize * sizeof *newss)) == NULL)", + " return -1;", + " yyss = newss;", + " yyssp = newss + i;", + " if ((newvs = (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs)) == NULL)", + " return -1;", + " yyvs = newvs;", + " yyvsp = newvs + i;", + " yystacksize = newsize;", + " yysslim = yyss + newsize - 1;", + " return 0;", + "}", + "", "#define YYABORT goto yyabort", "#define YYREJECT goto yyabort", "#define YYACCEPT goto yyaccept", "#define YYERROR goto yyerrlab", "int", - "#if defined(__STDC__)", - "yyparse(void)", - "#else", "yyparse()", - "#endif", "{", " register int yym, yyn, yystate;", "#if YYDEBUG", " register char *yys;", - " extern char *getenv();", "", " if (yys = getenv(\"YYDEBUG\"))", " {", @@ -109,6 +179,7 @@ char *body[] = " yyerrflag = 0;", " yychar = (-1);", "", + " if (yyss == NULL && yygrowstack()) goto yyoverflow;", " yyssp = yyss;", " yyvsp = yyvs;", " *yyssp = yystate = 0;", @@ -137,7 +208,7 @@ char *body[] = " printf(\"%sdebug: state %d, shifting to state %d\\n\",", " YYPREFIX, yystate, yytable[yyn]);", "#endif", - " if (yyssp >= yyss + yystacksize - 1)", + " if (yyssp >= yysslim && yygrowstack())", " {", " goto yyoverflow;", " }", @@ -154,6 +225,10 @@ char *body[] = " goto yyreduce;", " }", " if (yyerrflag) goto yyinrecovery;", + "#ifdef lint", + " goto yynewerror;", + "#endif", + "yynewerror:", " yyerror(\"syntax error\");", "#ifdef lint", " goto yyerrlab;", @@ -174,7 +249,7 @@ char *body[] = " printf(\"%sdebug: state %d, error recovery shifting\\", " to state %d\\n\", YYPREFIX, *yyssp, yytable[yyn]);", "#endif", - " if (yyssp >= yyss + yystacksize - 1)", + " if (yyssp >= yysslim && yygrowstack())", " {", " goto yyoverflow;", " }", @@ -271,7 +346,7 @@ char *trailer[] = " printf(\"%sdebug: after reduction, shifting from state %d \\", "to state %d\\n\", YYPREFIX, *yyssp, yystate);", "#endif", - " if (yyssp >= yyss + yystacksize - 1)", + " if (yyssp >= yysslim && yygrowstack())", " {", " goto yyoverflow;", " }", diff --git a/usr.bin/yacc/symtab.c b/usr.bin/yacc/symtab.c index 8c7de7eb0ae..64677bd7651 100644 --- a/usr.bin/yacc/symtab.c +++ b/usr.bin/yacc/symtab.c @@ -1,5 +1,47 @@ +/* $NetBSD: symtab.c,v 1.4 1996/03/19 03:21:48 jtc Exp $ */ + +/* + * Copyright (c) 1989 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Robert Paul Corbett. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + #ifndef lint -static char rcsid[] = "$Id: symtab.c,v 1.1 1995/10/18 08:47:06 deraadt Exp $"; +#if 0 +static char sccsid[] = "@(#)symtab.c 5.3 (Berkeley) 6/1/90"; +#else +static char rcsid[] = "$NetBSD: symtab.c,v 1.4 1996/03/19 03:21:48 jtc Exp $"; +#endif #endif /* not lint */ #include "defs.h" diff --git a/usr.bin/yacc/test/error.tab.c b/usr.bin/yacc/test/error.tab.c index 8a5c902551e..b16d6ddc8d8 100644 --- a/usr.bin/yacc/test/error.tab.c +++ b/usr.bin/yacc/test/error.tab.c @@ -1,11 +1,14 @@ #ifndef lint /*static char yysccsid[] = "from: @(#)yaccpar 1.9 (Berkeley) 02/21/93";*/ -static char rcsid[] = "$Id: error.tab.c,v 1.1 1995/10/18 08:47:06 deraadt Exp $"; +static char yyrcsid[] = "$OpenBSD: error.tab.c,v 1.2 1996/04/21 23:45:31 deraadt Exp $"; #endif +#include <stdlib.h> #define YYBYACC 1 #define YYMAJOR 1 #define YYMINOR 9 -#define yyclearin (yychar=(-1)) +#define YYLEX yylex() +#define YYEMPTY -1 +#define yyclearin (yychar=(YYEMPTY)) #define yyerrok (yyerrflag=0) #define YYRECOVERING (yyerrflag!=0) #define YYPREFIX "yy" @@ -58,10 +61,11 @@ typedef int YYSTYPE; #ifdef YYMAXDEPTH #define YYSTACKSIZE YYMAXDEPTH #else -#define YYSTACKSIZE 500 -#define YYMAXDEPTH 500 +#define YYSTACKSIZE 10000 +#define YYMAXDEPTH 10000 #endif #endif +#define YYINITSTACKSIZE 200 int yydebug; int yynerrs; int yyerrflag; @@ -70,14 +74,42 @@ short *yyssp; YYSTYPE *yyvsp; YYSTYPE yyval; YYSTYPE yylval; -short yyss[YYSTACKSIZE]; -YYSTYPE yyvs[YYSTACKSIZE]; -#define yystacksize YYSTACKSIZE +short *yyss; +short *yysslim; +YYSTYPE *yyvs; +int yystacksize; #line 4 "error.y" main(){printf("yyparse() = %d\n",yyparse());} yylex(){return-1;} yyerror(s)char*s;{printf("%s\n",s);} -#line 80 "error.tab.c" +#line 86 "error.tab.c" +/* allocate initial stack or double stack size, up to YYMAXDEPTH */ +static int yygrowstack() +{ + int newsize, i; + short *newss; + YYSTYPE *newvs; + + if ((newsize = yystacksize) == 0) + newsize = YYINITSTACKSIZE; + else if (newsize >= YYMAXDEPTH) + return -1; + else if ((newsize *= 2) > YYMAXDEPTH) + newsize = YYMAXDEPTH; + i = yyssp - yyss; + if ((newss = (short *)realloc(yyss, newsize * sizeof *newss)) == NULL) + return -1; + yyss = newss; + yyssp = newss + i; + if ((newvs = (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs)) == NULL) + return -1; + yyvs = newvs; + yyvsp = newvs + i; + yystacksize = newsize; + yysslim = yyss + newsize - 1; + return 0; +} + #define YYABORT goto yyabort #define YYREJECT goto yyabort #define YYACCEPT goto yyaccept @@ -88,7 +120,6 @@ yyparse() register int yym, yyn, yystate; #if YYDEBUG register char *yys; - extern char *getenv(); if (yys = getenv("YYDEBUG")) { @@ -102,12 +133,13 @@ yyparse() yyerrflag = 0; yychar = (-1); + if (yyss == NULL && yygrowstack()) goto yyoverflow; yyssp = yyss; yyvsp = yyvs; *yyssp = yystate = 0; yyloop: - if (yyn = yydefred[yystate]) goto yyreduce; + if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { if ((yychar = yylex()) < 0) yychar = 0; @@ -130,7 +162,7 @@ yyloop: printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yyssp >= yyss + yystacksize - 1) + if (yyssp >= yysslim && yygrowstack()) { goto yyoverflow; } @@ -171,7 +203,7 @@ yyinrecovery: printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yyssp, yytable[yyn]); #endif - if (yyssp >= yyss + yystacksize - 1) + if (yyssp >= yysslim && yygrowstack()) { goto yyoverflow; } @@ -260,7 +292,7 @@ yyreduce: printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yyssp, yystate); #endif - if (yyssp >= yyss + yystacksize - 1) + if (yyssp >= yysslim && yygrowstack()) { goto yyoverflow; } diff --git a/usr.bin/yacc/test/ftp.tab.c b/usr.bin/yacc/test/ftp.tab.c index 76539f81bd2..177b1f9ea5b 100644 --- a/usr.bin/yacc/test/ftp.tab.c +++ b/usr.bin/yacc/test/ftp.tab.c @@ -1,18 +1,22 @@ #ifndef lint /*static char yysccsid[] = "from: @(#)yaccpar 1.9 (Berkeley) 02/21/93";*/ -static char rcsid[] = "$Id: ftp.tab.c,v 1.1 1995/10/18 08:47:07 deraadt Exp $"; +static char yyrcsid[] = "$OpenBSD: ftp.tab.c,v 1.2 1996/04/21 23:45:32 deraadt Exp $"; #endif +#include <stdlib.h> #define YYBYACC 1 #define YYMAJOR 1 #define YYMINOR 9 -#define yyclearin (yychar=(-1)) +#define YYLEX yylex() +#define YYEMPTY -1 +#define yyclearin (yychar=(YYEMPTY)) #define yyerrok (yyerrflag=0) #define YYRECOVERING (yyerrflag!=0) #define YYPREFIX "yy" -#line 26 "ftp.y" +#line 28 "ftp.y" #ifndef lint -static char sccsid[] = "@(#)ftpcmd.y 5.20.1.1 (Berkeley) 3/2/89"; +/*static char sccsid[] = "from: @(#)ftpcmd.y 5.20.1.1 (Berkeley) 3/2/89";*/ +static char rcsid[] = "$Id: ftp.tab.c,v 1.2 1996/04/21 23:45:32 deraadt Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -57,7 +61,7 @@ char cbuf[512]; char *fromname; char *index(); -#line 60 "ftp.tab.c" +#line 65 "ftp.tab.c" #define A 257 #define B 258 #define C 259 @@ -366,10 +370,11 @@ typedef int YYSTYPE; #ifdef YYMAXDEPTH #define YYSTACKSIZE YYMAXDEPTH #else -#define YYSTACKSIZE 500 -#define YYMAXDEPTH 500 +#define YYSTACKSIZE 10000 +#define YYMAXDEPTH 10000 #endif #endif +#define YYINITSTACKSIZE 200 int yydebug; int yynerrs; int yyerrflag; @@ -378,10 +383,11 @@ short *yyssp; YYSTYPE *yyvsp; YYSTYPE yyval; YYSTYPE yylval; -short yyss[YYSTACKSIZE]; -YYSTYPE yyvs[YYSTACKSIZE]; -#define yystacksize YYSTACKSIZE -#line 658 "ftp.y" +short *yyss; +short *yysslim; +YYSTYPE *yyvs; +int yystacksize; +#line 662 "ftp.y" extern jmp_buf errcatch; @@ -905,7 +911,34 @@ char *filename; reply(504, "SIZE not implemented for Type %c.", "?AEIL"[type]); } } -#line 908 "ftp.tab.c" +#line 915 "ftp.tab.c" +/* allocate initial stack or double stack size, up to YYMAXDEPTH */ +static int yygrowstack() +{ + int newsize, i; + short *newss; + YYSTYPE *newvs; + + if ((newsize = yystacksize) == 0) + newsize = YYINITSTACKSIZE; + else if (newsize >= YYMAXDEPTH) + return -1; + else if ((newsize *= 2) > YYMAXDEPTH) + newsize = YYMAXDEPTH; + i = yyssp - yyss; + if ((newss = (short *)realloc(yyss, newsize * sizeof *newss)) == NULL) + return -1; + yyss = newss; + yyssp = newss + i; + if ((newvs = (YYSTYPE *)realloc(yyvs, newsize * sizeof *newvs)) == NULL) + return -1; + yyvs = newvs; + yyvsp = newvs + i; + yystacksize = newsize; + yysslim = yyss + newsize - 1; + return 0; +} + #define YYABORT goto yyabort #define YYREJECT goto yyabort #define YYACCEPT goto yyaccept @@ -916,7 +949,6 @@ yyparse() register int yym, yyn, yystate; #if YYDEBUG register char *yys; - extern char *getenv(); if (yys = getenv("YYDEBUG")) { @@ -930,12 +962,13 @@ yyparse() yyerrflag = 0; yychar = (-1); + if (yyss == NULL && yygrowstack()) goto yyoverflow; yyssp = yyss; yyvsp = yyvs; *yyssp = yystate = 0; yyloop: - if (yyn = yydefred[yystate]) goto yyreduce; + if ((yyn = yydefred[yystate]) != 0) goto yyreduce; if (yychar < 0) { if ((yychar = yylex()) < 0) yychar = 0; @@ -958,7 +991,7 @@ yyloop: printf("%sdebug: state %d, shifting to state %d\n", YYPREFIX, yystate, yytable[yyn]); #endif - if (yyssp >= yyss + yystacksize - 1) + if (yyssp >= yysslim && yygrowstack()) { goto yyoverflow; } @@ -999,7 +1032,7 @@ yyinrecovery: printf("%sdebug: state %d, error recovery shifting\ to state %d\n", YYPREFIX, *yyssp, yytable[yyn]); #endif - if (yyssp >= yyss + yystacksize - 1) + if (yyssp >= yysslim && yygrowstack()) { goto yyoverflow; } @@ -1047,27 +1080,27 @@ yyreduce: switch (yyn) { case 2: -#line 99 "ftp.y" +#line 102 "ftp.y" { fromname = (char *) 0; } break; case 4: -#line 106 "ftp.y" +#line 109 "ftp.y" { user((char *) yyvsp[-1]); free((char *) yyvsp[-1]); } break; case 5: -#line 111 "ftp.y" +#line 114 "ftp.y" { pass((char *) yyvsp[-1]); free((char *) yyvsp[-1]); } break; case 6: -#line 116 "ftp.y" +#line 119 "ftp.y" { usedefault = 0; if (pdata >= 0) { @@ -1078,13 +1111,13 @@ case 6: } break; case 7: -#line 125 "ftp.y" +#line 128 "ftp.y" { passive(); } break; case 8: -#line 129 "ftp.y" +#line 132 "ftp.y" { switch (cmd_type) { @@ -1121,7 +1154,7 @@ case 8: } break; case 9: -#line 164 "ftp.y" +#line 167 "ftp.y" { switch (yyvsp[-1]) { @@ -1135,7 +1168,7 @@ case 9: } break; case 10: -#line 176 "ftp.y" +#line 179 "ftp.y" { switch (yyvsp[-1]) { @@ -1149,19 +1182,19 @@ case 10: } break; case 11: -#line 188 "ftp.y" +#line 191 "ftp.y" { reply(202, "ALLO command ignored."); } break; case 12: -#line 192 "ftp.y" +#line 195 "ftp.y" { reply(202, "ALLO command ignored."); } break; case 13: -#line 196 "ftp.y" +#line 199 "ftp.y" { if (yyvsp[-3] && yyvsp[-1] != NULL) retrieve((char *) 0, (char *) yyvsp[-1]); @@ -1170,7 +1203,7 @@ case 13: } break; case 14: -#line 203 "ftp.y" +#line 206 "ftp.y" { if (yyvsp[-3] && yyvsp[-1] != NULL) store((char *) yyvsp[-1], "w", 0); @@ -1179,7 +1212,7 @@ case 14: } break; case 15: -#line 210 "ftp.y" +#line 213 "ftp.y" { if (yyvsp[-3] && yyvsp[-1] != NULL) store((char *) yyvsp[-1], "a", 0); @@ -1188,14 +1221,14 @@ case 15: } break; case 16: -#line 217 "ftp.y" +#line 220 "ftp.y" { if (yyvsp[-1]) send_file_list("."); } break; case 17: -#line 222 "ftp.y" +#line 225 "ftp.y" { if (yyvsp[-3] && yyvsp[-1] != NULL) send_file_list((char *) yyvsp[-1]); @@ -1204,14 +1237,14 @@ case 17: } break; case 18: -#line 229 "ftp.y" +#line 232 "ftp.y" { if (yyvsp[-1]) retrieve("/bin/ls -lgA", ""); } break; case 19: -#line 234 "ftp.y" +#line 237 "ftp.y" { if (yyvsp[-3] && yyvsp[-1] != NULL) retrieve("/bin/ls -lgA %s", (char *) yyvsp[-1]); @@ -1220,7 +1253,7 @@ case 19: } break; case 20: -#line 241 "ftp.y" +#line 244 "ftp.y" { if (yyvsp[-3] && yyvsp[-1] != NULL) statfilecmd((char *) yyvsp[-1]); @@ -1229,13 +1262,13 @@ case 20: } break; case 21: -#line 248 "ftp.y" +#line 251 "ftp.y" { statcmd(); } break; case 22: -#line 252 "ftp.y" +#line 255 "ftp.y" { if (yyvsp[-3] && yyvsp[-1] != NULL) delete((char *) yyvsp[-1]); @@ -1244,7 +1277,7 @@ case 22: } break; case 23: -#line 259 "ftp.y" +#line 262 "ftp.y" { if (fromname) { renamecmd(fromname, (char *) yyvsp[-1]); @@ -1257,20 +1290,20 @@ case 23: } break; case 24: -#line 270 "ftp.y" +#line 273 "ftp.y" { reply(225, "ABOR command successful."); } break; case 25: -#line 274 "ftp.y" +#line 277 "ftp.y" { if (yyvsp[-1]) cwd(pw->pw_dir); } break; case 26: -#line 279 "ftp.y" +#line 282 "ftp.y" { if (yyvsp[-3] && yyvsp[-1] != NULL) cwd((char *) yyvsp[-1]); @@ -1279,13 +1312,13 @@ case 26: } break; case 27: -#line 286 "ftp.y" +#line 289 "ftp.y" { help(cmdtab, (char *) 0); } break; case 28: -#line 290 "ftp.y" +#line 293 "ftp.y" { register char *cp = (char *)yyvsp[-1]; @@ -1302,13 +1335,13 @@ case 28: } break; case 29: -#line 305 "ftp.y" +#line 308 "ftp.y" { reply(200, "NOOP command successful."); } break; case 30: -#line 309 "ftp.y" +#line 312 "ftp.y" { if (yyvsp[-3] && yyvsp[-1] != NULL) makedir((char *) yyvsp[-1]); @@ -1317,7 +1350,7 @@ case 30: } break; case 31: -#line 316 "ftp.y" +#line 319 "ftp.y" { if (yyvsp[-3] && yyvsp[-1] != NULL) removedir((char *) yyvsp[-1]); @@ -1326,33 +1359,33 @@ case 31: } break; case 32: -#line 323 "ftp.y" +#line 326 "ftp.y" { if (yyvsp[-1]) pwd(); } break; case 33: -#line 328 "ftp.y" +#line 331 "ftp.y" { if (yyvsp[-1]) cwd(".."); } break; case 34: -#line 333 "ftp.y" +#line 336 "ftp.y" { help(sitetab, (char *) 0); } break; case 35: -#line 337 "ftp.y" +#line 340 "ftp.y" { help(sitetab, (char *) yyvsp[-1]); } break; case 36: -#line 341 "ftp.y" +#line 344 "ftp.y" { int oldmask; @@ -1364,7 +1397,7 @@ case 36: } break; case 37: -#line 351 "ftp.y" +#line 354 "ftp.y" { int oldmask; @@ -1381,7 +1414,7 @@ case 37: } break; case 38: -#line 366 "ftp.y" +#line 369 "ftp.y" { if (yyvsp[-5] && (yyvsp[-1] != NULL)) { if (yyvsp[-3] > 0777) @@ -1397,7 +1430,7 @@ case 38: } break; case 39: -#line 380 "ftp.y" +#line 383 "ftp.y" { reply(200, "Current IDLE time limit is %d seconds; max %d", @@ -1405,7 +1438,7 @@ case 39: } break; case 40: -#line 386 "ftp.y" +#line 389 "ftp.y" { if (yyvsp[-1] < 30 || yyvsp[-1] > maxtimeout) { reply(501, @@ -1421,7 +1454,7 @@ case 40: } break; case 41: -#line 400 "ftp.y" +#line 403 "ftp.y" { if (yyvsp[-3] && yyvsp[-1] != NULL) store((char *) yyvsp[-1], "w", 1); @@ -1430,7 +1463,7 @@ case 41: } break; case 42: -#line 407 "ftp.y" +#line 410 "ftp.y" { #ifdef unix #ifdef BSD @@ -1445,7 +1478,7 @@ case 42: } break; case 43: -#line 428 "ftp.y" +#line 431 "ftp.y" { if (yyvsp[-3] && yyvsp[-1] != NULL) sizecmd((char *) yyvsp[-1]); @@ -1454,7 +1487,7 @@ case 43: } break; case 44: -#line 445 "ftp.y" +#line 448 "ftp.y" { if (yyvsp[-3] && yyvsp[-1] != NULL) { struct stat stbuf; @@ -1468,8 +1501,9 @@ case 44: struct tm *gmtime(); t = gmtime(&stbuf.st_mtime); reply(213, - "19%02d%02d%02d%02d%02d%02d", - t->tm_year, t->tm_mon+1, t->tm_mday, + "%04d%02d%02d%02d%02d%02d", + 1900 + t->tm_year, + t->tm_mon+1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); } } @@ -1478,20 +1512,20 @@ case 44: } break; case 45: -#line 467 "ftp.y" +#line 471 "ftp.y" { reply(221, "Goodbye."); dologout(0); } break; case 46: -#line 472 "ftp.y" +#line 476 "ftp.y" { yyerrok; } break; case 47: -#line 477 "ftp.y" +#line 481 "ftp.y" { char *renamefrom(); @@ -1504,13 +1538,13 @@ case 47: } break; case 49: -#line 493 "ftp.y" +#line 497 "ftp.y" { *(char **)&(yyval) = ""; } break; case 52: -#line 504 "ftp.y" +#line 508 "ftp.y" { register char *a, *p; @@ -1522,116 +1556,116 @@ case 52: } break; case 53: -#line 516 "ftp.y" +#line 520 "ftp.y" { yyval = FORM_N; } break; case 54: -#line 520 "ftp.y" +#line 524 "ftp.y" { yyval = FORM_T; } break; case 55: -#line 524 "ftp.y" +#line 528 "ftp.y" { yyval = FORM_C; } break; case 56: -#line 530 "ftp.y" +#line 534 "ftp.y" { cmd_type = TYPE_A; cmd_form = FORM_N; } break; case 57: -#line 535 "ftp.y" +#line 539 "ftp.y" { cmd_type = TYPE_A; cmd_form = yyvsp[0]; } break; case 58: -#line 540 "ftp.y" +#line 544 "ftp.y" { cmd_type = TYPE_E; cmd_form = FORM_N; } break; case 59: -#line 545 "ftp.y" +#line 549 "ftp.y" { cmd_type = TYPE_E; cmd_form = yyvsp[0]; } break; case 60: -#line 550 "ftp.y" +#line 554 "ftp.y" { cmd_type = TYPE_I; } break; case 61: -#line 554 "ftp.y" +#line 558 "ftp.y" { cmd_type = TYPE_L; cmd_bytesz = NBBY; } break; case 62: -#line 559 "ftp.y" +#line 563 "ftp.y" { cmd_type = TYPE_L; cmd_bytesz = yyvsp[0]; } break; case 63: -#line 565 "ftp.y" +#line 569 "ftp.y" { cmd_type = TYPE_L; cmd_bytesz = yyvsp[0]; } break; case 64: -#line 572 "ftp.y" +#line 576 "ftp.y" { yyval = STRU_F; } break; case 65: -#line 576 "ftp.y" +#line 580 "ftp.y" { yyval = STRU_R; } break; case 66: -#line 580 "ftp.y" +#line 584 "ftp.y" { yyval = STRU_P; } break; case 67: -#line 586 "ftp.y" +#line 590 "ftp.y" { yyval = MODE_S; } break; case 68: -#line 590 "ftp.y" +#line 594 "ftp.y" { yyval = MODE_B; } break; case 69: -#line 594 "ftp.y" +#line 598 "ftp.y" { yyval = MODE_C; } break; case 70: -#line 600 "ftp.y" +#line 604 "ftp.y" { /* * Problem: this production is used for all pathname @@ -1650,7 +1684,7 @@ case 70: } break; case 72: -#line 622 "ftp.y" +#line 626 "ftp.y" { register int ret, dec, multby, digit; @@ -1675,7 +1709,7 @@ case 72: } break; case 73: -#line 647 "ftp.y" +#line 651 "ftp.y" { if (logged_in) yyval = 1; @@ -1685,7 +1719,7 @@ case 73: } } break; -#line 1688 "ftp.tab.c" +#line 1723 "ftp.tab.c" } yyssp -= yym; yystate = *yyssp; @@ -1728,7 +1762,7 @@ break; printf("%sdebug: after reduction, shifting from state %d \ to state %d\n", YYPREFIX, *yyssp, yystate); #endif - if (yyssp >= yyss + yystacksize - 1) + if (yyssp >= yysslim && yygrowstack()) { goto yyoverflow; } diff --git a/usr.bin/yacc/test/ftp.y b/usr.bin/yacc/test/ftp.y index fb926f64109..0067c4bc86a 100644 --- a/usr.bin/yacc/test/ftp.y +++ b/usr.bin/yacc/test/ftp.y @@ -1,3 +1,5 @@ +/* $OpenBSD: ftp.y,v 1.2 1996/04/21 23:45:35 deraadt Exp $ */ + /* * Copyright (c) 1985, 1988 Regents of the University of California. * All rights reserved. @@ -15,7 +17,6 @@ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * from: @(#)ftpcmd.y 5.20.1.1 (Berkeley) 3/2/89 - * $Id: ftp.y,v 1.1 1995/10/18 08:47:07 deraadt Exp $ */ /* @@ -27,7 +28,7 @@ #ifndef lint /*static char sccsid[] = "from: @(#)ftpcmd.y 5.20.1.1 (Berkeley) 3/2/89";*/ -static char rcsid[] = "$Id: ftp.y,v 1.1 1995/10/18 08:47:07 deraadt Exp $"; +static char rcsid[] = "$Id: ftp.y,v 1.2 1996/04/21 23:45:35 deraadt Exp $"; #endif /* not lint */ #include <sys/param.h> @@ -457,8 +458,9 @@ cmd: USER SP username CRLF struct tm *gmtime(); t = gmtime(&stbuf.st_mtime); reply(213, - "19%02d%02d%02d%02d%02d%02d", - t->tm_year, t->tm_mon+1, t->tm_mday, + "%04d%02d%02d%02d%02d%02d", + 1900 + t->tm_year, + t->tm_mon+1, t->tm_mday, t->tm_hour, t->tm_min, t->tm_sec); } } diff --git a/usr.bin/yacc/verbose.c b/usr.bin/yacc/verbose.c index 1f0a66741ee..41481d8959f 100644 --- a/usr.bin/yacc/verbose.c +++ b/usr.bin/yacc/verbose.c @@ -1,10 +1,51 @@ +/* $NetBSD: verbose.c,v 1.4 1996/03/19 03:21:50 jtc Exp $ */ + +/* + * Copyright (c) 1989 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Robert Paul Corbett. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + #ifndef lint -static char rcsid[] = "$Id: verbose.c,v 1.1 1995/10/18 08:47:06 deraadt Exp $"; +#if 0 +static char sccsid[] = "@(#)verbose.c 5.3 (Berkeley) 1/20/91"; +#else +static char rcsid[] = "$NetBSD: verbose.c,v 1.4 1996/03/19 03:21:50 jtc Exp $"; +#endif #endif /* not lint */ #include "defs.h" - static short *null_rules; verbose() @@ -329,4 +370,3 @@ int stateno; fprintf(verbose_file, "\t%s goto %d\n", symbol_name[as], k); } } - diff --git a/usr.bin/yacc/warshall.c b/usr.bin/yacc/warshall.c index 298f27512e3..03567fa88e0 100644 --- a/usr.bin/yacc/warshall.c +++ b/usr.bin/yacc/warshall.c @@ -1,5 +1,47 @@ +/* $NetBSD: warshall.c,v 1.4 1996/03/19 03:21:51 jtc Exp $ */ + +/* + * Copyright (c) 1989 The Regents of the University of California. + * All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Robert Paul Corbett. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by the University of + * California, Berkeley and its contributors. + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + #ifndef lint -static char rcsid[] = "$Id: warshall.c,v 1.1 1995/10/18 08:47:06 deraadt Exp $"; +#if 0 +static char sccsid[] = "@(#)warshall.c 5.4 (Berkeley) 5/24/93"; +#else +static char rcsid[] = "$NetBSD: warshall.c,v 1.4 1996/03/19 03:21:51 jtc Exp $"; +#endif #endif /* not lint */ #include "defs.h" |