diff options
Diffstat (limited to 'sys/lib')
49 files changed, 345 insertions, 283 deletions
diff --git a/sys/lib/libkern/arch/alpha/Makefile.inc b/sys/lib/libkern/arch/alpha/Makefile.inc index b984665e3a5..2cef95cd260 100644 --- a/sys/lib/libkern/arch/alpha/Makefile.inc +++ b/sys/lib/libkern/arch/alpha/Makefile.inc @@ -1,9 +1,9 @@ -# $OpenBSD: Makefile.inc,v 1.12 2002/04/28 20:55:14 pvalchev Exp $ +# $OpenBSD: Makefile.inc,v 1.13 2003/06/01 17:00:30 deraadt Exp $ # $NetBSD: Makefile.inc,v 1.9 1996/08/27 00:44:24 cgd Exp $ SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \ memchr.c memcmp.c memset.c \ - bcmp.c bzero.S ffs.S softfloat.c strcat.c strcmp.c strcpy.c \ + bcmp.c bzero.S ffs.S softfloat.c strcmp.c \ strlcat.c strlcpy.c strlen.c strncmp.c \ strncpy.c scanc.c skpc.c htonl.S htons.S ntohl.S ntohs.S \ random.c strncasecmp.c diff --git a/sys/lib/libkern/arch/hppa/Makefile.inc b/sys/lib/libkern/arch/hppa/Makefile.inc index abef9b9e0d0..47bd03f41f1 100644 --- a/sys/lib/libkern/arch/hppa/Makefile.inc +++ b/sys/lib/libkern/arch/hppa/Makefile.inc @@ -1,9 +1,9 @@ -# $OpenBSD: Makefile.inc,v 1.16 2003/01/28 22:55:53 mickey Exp $ +# $OpenBSD: Makefile.inc,v 1.17 2003/06/01 17:00:30 deraadt Exp $ SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \ random.c ashrdi3.c divdi3.c strncpy.c strncmp.c strcmp.c memchr.c \ - memcmp.c memset.c strlen.c strcpy.c strlcpy.c strlcat.c \ - strcat.c skpc.c strncasecmp.c \ + memcmp.c memset.c strlen.c strlcpy.c strlcat.c \ + skpc.c strncasecmp.c \ bcmp.c scanc.c ffs.c SRCS+= milli.S diff --git a/sys/lib/libkern/arch/i386/Makefile.inc b/sys/lib/libkern/arch/i386/Makefile.inc index 00928bb3c2c..eacb3cc5bbb 100644 --- a/sys/lib/libkern/arch/i386/Makefile.inc +++ b/sys/lib/libkern/arch/i386/Makefile.inc @@ -1,9 +1,9 @@ -# $OpenBSD: Makefile.inc,v 1.7 2000/12/18 18:40:46 provos Exp $ +# $OpenBSD: Makefile.inc,v 1.8 2003/06/01 17:00:30 deraadt Exp $ # $NetBSD: Makefile.inc,v 1.10 1996/04/13 01:17:41 cgd Exp $ SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \ memchr.S memcmp.S \ - bcmp.S ffs.S memset.S strcat.S strcmp.S strcpy.S strlcat.c strlcpy.c \ + bcmp.S ffs.S memset.S strcmp.S strlcat.c strlcpy.c \ strlen.S strncmp.c \ strncpy.c scanc.S skpc.S locc.S htonl.S htons.S ntohl.S ntohs.S \ strncasecmp.c diff --git a/sys/lib/libkern/arch/m68k/Makefile.inc b/sys/lib/libkern/arch/m68k/Makefile.inc index 41329201e3e..fd44dc81ac6 100644 --- a/sys/lib/libkern/arch/m68k/Makefile.inc +++ b/sys/lib/libkern/arch/m68k/Makefile.inc @@ -1,9 +1,9 @@ -# $OpenBSD: Makefile.inc,v 1.7 2000/12/18 18:40:46 provos Exp $ +# $OpenBSD: Makefile.inc,v 1.8 2003/06/01 17:00:30 deraadt Exp $ # $NetBSD: Makefile.inc,v 1.7 1996/04/18 01:53:04 cgd Exp $ SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \ memchr.c memcmp.S memset.S \ - bcmp.S bzero.S ffs.S strcat.S strcmp.S strcpy.S strlcat.c strlcpy.c \ + bcmp.S bzero.S ffs.S strcmp.S strlcat.c strlcpy.c \ strlen.S strncmp.S \ strncpy.S htonl.S htons.S ntohl.S ntohs.S scanc.S skpc.S locc.S \ strncasecmp.c diff --git a/sys/lib/libkern/arch/m88k/Makefile.inc b/sys/lib/libkern/arch/m88k/Makefile.inc index e5c2cb3055d..981b6ce386d 100644 --- a/sys/lib/libkern/arch/m88k/Makefile.inc +++ b/sys/lib/libkern/arch/m88k/Makefile.inc @@ -1,7 +1,7 @@ -# $OpenBSD: Makefile.inc,v 1.5 2001/02/01 03:25:42 smurph Exp $ +# $OpenBSD: Makefile.inc,v 1.6 2003/06/01 17:00:30 deraadt Exp $ # $NetBSD: Makefile.inc,v 1.2 1996/04/13 01:17:58 cgd Exp $ SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \ memchr.c memcmp.c memset.c bcmp.c random.c \ - strcat.c strcmp.c strcpy.c strlcat.c strlcpy.c strlen.c strncmp.c \ + strcmp.c strlcat.c strlcpy.c strlen.c strncmp.c \ strncpy.c scanc.c skpc.c strncasecmp.c ffs.c diff --git a/sys/lib/libkern/arch/mips/Makefile.inc b/sys/lib/libkern/arch/mips/Makefile.inc index d3b951e07b5..420fb818fd4 100644 --- a/sys/lib/libkern/arch/mips/Makefile.inc +++ b/sys/lib/libkern/arch/mips/Makefile.inc @@ -1,11 +1,11 @@ -# $OpenBSD: Makefile.inc,v 1.9 2000/12/18 18:40:46 provos Exp $ +# $OpenBSD: Makefile.inc,v 1.10 2003/06/01 17:00:31 deraadt Exp $ # $NetBSD: Makefile.inc,v 1.4 1996/04/13 01:17:46 cgd Exp $ # # There are likely more that we will notice when we go native SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \ memchr.c memcmp.c memset.c strcmp.c \ - bcmp.S bcopy.S bzero.S strcat.c strcmp.c strcpy.c strlcat.c strlcpy.c \ + bcmp.S bcopy.S bzero.S strcmp.c strlcat.c strlcpy.c \ ffs.S htonl.S \ htons.S strcmp.S strlen.S strncmp.c random.c scanc.c skpc.c strncpy.c \ strncasecmp.c diff --git a/sys/lib/libkern/arch/powerpc/Makefile.inc b/sys/lib/libkern/arch/powerpc/Makefile.inc index d4044794977..4063f90ed0b 100644 --- a/sys/lib/libkern/arch/powerpc/Makefile.inc +++ b/sys/lib/libkern/arch/powerpc/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.9 2002/11/11 16:32:48 drahn Exp $ +# $OpenBSD: Makefile.inc,v 1.10 2003/06/01 17:00:31 deraadt Exp $ # $NetBSD: Makefile.inc,v 1.6 1994/10/26 06:39:03 cgd Exp $ CFLAGS += -D_KERNEL @@ -6,7 +6,7 @@ CFLAGS += -D_KERNEL SRCS+= __main.c __eabi.c \ imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \ memchr.c memcmp.c memset.c \ - bcmp.c ffs.c strcat.c strcmp.c strcpy.c strlcat.c strlcpy.c \ + bcmp.c ffs.c strcmp.c strlcat.c strlcpy.c \ strlen.c strncmp.c \ strncpy.c scanc.c skpc.c locc.c \ memcpy.c random.c strncasecmp.c diff --git a/sys/lib/libkern/arch/sparc/Makefile.inc b/sys/lib/libkern/arch/sparc/Makefile.inc index 2560b9391b9..b2c73360f51 100644 --- a/sys/lib/libkern/arch/sparc/Makefile.inc +++ b/sys/lib/libkern/arch/sparc/Makefile.inc @@ -1,9 +1,9 @@ -# $OpenBSD: Makefile.inc,v 1.10 2002/08/11 12:21:33 art Exp $ +# $OpenBSD: Makefile.inc,v 1.11 2003/06/01 17:00:31 deraadt Exp $ # $NetBSD: Makefile.inc,v 1.12 1996/04/23 23:05:22 christos Exp $ SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \ memchr.c memcmp.c memset.c \ - bcmp.c bzero.S strcat.c strcmp.c strcpy.c strlcat.c strlcpy.c \ + bcmp.c bzero.S strcmp.c strlcat.c strlcpy.c \ strlen.S strncmp.c \ strncpy.c htonl.S htons.S ntohl.S ntohs.S scanc.c skpc.c \ strncasecmp.c diff --git a/sys/lib/libkern/arch/sparc64/Makefile.inc b/sys/lib/libkern/arch/sparc64/Makefile.inc index 52c05a7295d..60ec5985400 100644 --- a/sys/lib/libkern/arch/sparc64/Makefile.inc +++ b/sys/lib/libkern/arch/sparc64/Makefile.inc @@ -1,11 +1,11 @@ -# $OpenBSD: Makefile.inc,v 1.4 2002/09/06 22:59:58 art Exp $ +# $OpenBSD: Makefile.inc,v 1.5 2003/06/01 17:00:31 deraadt Exp $ # $NetBSD: Makefile.inc,v 1.4 2000/11/01 19:37:20 thorpej Exp $ SRCS+= __main.c \ imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \ bcmp.c ffs.S \ memchr.c memcmp.c \ - strcat.c strcmp.c strcpy.c strlen.S strlcpy.c strlcat.c \ + strcmp.c strlen.S strlcpy.c strlcat.c \ strncasecmp.c strncmp.c strncpy.c \ scanc.c skpc.c \ htonl.S htons.S ntohl.S ntohs.S diff --git a/sys/lib/libkern/arch/vax/Makefile.inc b/sys/lib/libkern/arch/vax/Makefile.inc index 6ac2e2c903c..2ca3980045d 100644 --- a/sys/lib/libkern/arch/vax/Makefile.inc +++ b/sys/lib/libkern/arch/vax/Makefile.inc @@ -1,7 +1,7 @@ -# $OpenBSD: Makefile.inc,v 1.6 2000/12/18 18:40:47 provos Exp $ +# $OpenBSD: Makefile.inc,v 1.7 2003/06/01 17:00:32 deraadt Exp $ # $NetBSD: Makefile.inc,v 1.2 1996/04/13 01:17:58 cgd Exp $ SRCS+= __main.c imax.c imin.c lmax.c lmin.c max.c min.c ulmax.c ulmin.c \ memchr.c memcmp.c \ - strcat.c strcmp.c strcpy.c strlcat.c strlcpy.c strlen.c strncmp.c \ + strcmp.c strlcat.c strlcpy.c strlen.c strncmp.c \ strncpy.c scanc.c skpc.c strncasecmp.c diff --git a/sys/lib/libkern/funcs.h b/sys/lib/libkern/funcs.h new file mode 100644 index 00000000000..9312dfb7d8a --- /dev/null +++ b/sys/lib/libkern/funcs.h @@ -0,0 +1,2 @@ +size_t strlcpy(char *, const char *, int); +size_t strlcat(char *, const char *, int); diff --git a/sys/lib/libsa/Makefile b/sys/lib/libsa/Makefile index 0ee34dcda08..882987e6b6f 100644 --- a/sys/lib/libsa/Makefile +++ b/sys/lib/libsa/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.20 2001/06/23 01:47:39 drahn Exp $ +# $OpenBSD: Makefile,v 1.21 2003/06/01 17:00:32 deraadt Exp $ # $NetBSD: Makefile,v 1.13 1996/10/02 16:19:51 ws Exp $ LIB= sa @@ -25,8 +25,9 @@ CPPFLAGS+= -D__INTERNAL_LIBSA_CREAD .endif # stand routines -SRCS+= alloc.c memcpy.c exit.c exec.c getfile.c gets.c globals.c printf.c \ - strerror.c strcmp.c memset.c memcmp.c strncpy.c strncmp.c strchr.c +SRCS+= alloc.c memcpy.c exit.c exec.c getfile.c gets.c globals.c \ + printf.c snprintf.c strerror.c strcmp.c memset.c memcmp.c \ + strncpy.c strncmp.c strchr.c # math from libkern SRCS+= divdi3.c qdivrem.c diff --git a/sys/lib/libsa/Makefile.inc b/sys/lib/libsa/Makefile.inc index 1cf0c954a0e..5aa8a259245 100644 --- a/sys/lib/libsa/Makefile.inc +++ b/sys/lib/libsa/Makefile.inc @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile.inc,v 1.11 2002/04/29 01:02:28 hugh Exp $ +# $OpenBSD: Makefile.inc,v 1.12 2003/06/01 17:00:32 deraadt Exp $ # $NetBSD: Makefile.inc,v 1.5 1996/09/30 16:01:18 ws Exp $ # # NOTE: $S must correspond to the top of the 'sys' tree @@ -31,7 +31,7 @@ ${SALIB}: .NOTMAIN __always_make_salib @echo making sure the stand-alone library is up to date... @${SAMAKE} libsa.a -clean:: .NOTMAIN __always_make_salib +clean:: .NOTMAIN __always_make_salib @echo cleaning the stand-alone library objects @${SAMAKE} clean -rmdir -p ${SADST} diff --git a/sys/lib/libsa/alloc.c b/sys/lib/libsa/alloc.c index 34fcf0aba79..c4be3a324d3 100644 --- a/sys/lib/libsa/alloc.c +++ b/sys/lib/libsa/alloc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: alloc.c,v 1.6 2002/03/14 03:16:09 millert Exp $ */ +/* $OpenBSD: alloc.c,v 1.7 2003/06/01 17:00:32 deraadt Exp $ */ /* $NetBSD: alloc.c,v 1.6 1997/02/04 18:36:33 thorpej Exp $ */ /* @@ -40,30 +40,30 @@ * SUCH DAMAGE. * * @(#)alloc.c 8.1 (Berkeley) 6/11/93 - * + * * * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University * All Rights Reserved. * * Author: Alessandro Forin - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * + * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * + * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. */ diff --git a/sys/lib/libsa/arp.c b/sys/lib/libsa/arp.c index aaad7fa7366..b441d77df9a 100644 --- a/sys/lib/libsa/arp.c +++ b/sys/lib/libsa/arp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arp.c,v 1.9 2002/03/14 03:16:09 millert Exp $ */ +/* $OpenBSD: arp.c,v 1.10 2003/06/01 17:00:32 deraadt Exp $ */ /* $NetBSD: arp.c,v 1.15 1996/10/13 02:28:58 christos Exp $ */ /* @@ -80,14 +80,14 @@ arpwhohas(d, addr) struct ether_header eh; struct { struct ether_arp arp; - u_char pad[18]; /* 60 - sizeof(...) */ + u_char pad[18]; /* 60 - sizeof(...) */ } data; } wbuf; struct { struct ether_header eh; struct { struct ether_arp arp; - u_char pad[24]; /* extra space */ + u_char pad[24]; /* extra space */ } data; } rbuf; @@ -103,8 +103,8 @@ arpwhohas(d, addr) } #ifdef ARP_DEBUG - if (debug) - printf("arpwhohas: send request for %s\n", inet_ntoa(addr)); + if (debug) + printf("arpwhohas: send request for %s\n", inet_ntoa(addr)); #endif bzero((char *)&wbuf.data, sizeof(wbuf.data)); @@ -132,7 +132,7 @@ arpwhohas(d, addr) /* Store ethernet address in cache */ ah = &rbuf.data.arp; #ifdef ARP_DEBUG - if (debug) { + if (debug) { printf("arp: response from %s\n", ether_sprintf(rbuf.eh.ether_shost)); printf("arp: cacheing %s --> %s\n", @@ -153,7 +153,7 @@ arpsend(d, pkt, len) { #ifdef ARP_DEBUG - if (debug) + if (debug) printf("arpsend: called\n"); #endif @@ -176,7 +176,7 @@ arprecv(d, pkt, len, tleft) u_int16_t etype; /* host order */ #ifdef ARP_DEBUG - if (debug) + if (debug) printf("arprecv: "); #endif @@ -244,7 +244,7 @@ arprecv(d, pkt, len, tleft) /* We have our answer. */ #ifdef ARP_DEBUG - if (debug) + if (debug) printf("got it\n"); #endif return (n); diff --git a/sys/lib/libsa/bootp.c b/sys/lib/libsa/bootp.c index 1de33af08b6..5e1eaeed887 100644 --- a/sys/lib/libsa/bootp.c +++ b/sys/lib/libsa/bootp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bootp.c,v 1.9 2002/03/14 01:27:07 millert Exp $ */ +/* $OpenBSD: bootp.c,v 1.10 2003/06/01 17:00:32 deraadt Exp $ */ /* $NetBSD: bootp.c,v 1.10 1996/10/13 02:28:59 christos Exp $ */ /* @@ -80,18 +80,18 @@ bootp(sock) } rbuf; #ifdef BOOTP_DEBUG - if (debug) + if (debug) printf("bootp: socket=%d\n", sock); #endif if (!bot) bot = getsecs(); - + if (!(d = socktodesc(sock))) { printf("bootp: bad socket. %d\n", sock); return; } #ifdef BOOTP_DEBUG - if (debug) + if (debug) printf("bootp: d=%x\n", (u_int)d); #endif diff --git a/sys/lib/libsa/cd9660.c b/sys/lib/libsa/cd9660.c index 27876855ed5..1a4c0a5b2c6 100644 --- a/sys/lib/libsa/cd9660.c +++ b/sys/lib/libsa/cd9660.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cd9660.c,v 1.8 2003/04/15 18:41:19 mickey Exp $ */ +/* $OpenBSD: cd9660.c,v 1.9 2003/06/01 17:00:32 deraadt Exp $ */ /* $NetBSD: cd9660.c,v 1.1 1996/09/30 16:01:19 ws Exp $ */ /* @@ -81,7 +81,7 @@ pnmatch(path, pp) { char *cp; int i; - + cp = pp->name; for (i = isonum_711(pp->namlen); --i >= 0; path++, cp++) { if (toupper(*path) == *cp) @@ -145,7 +145,7 @@ cd9660_open(path, f) struct ptable_ent *pp; struct iso_directory_record *dp; int rc; - + /* First find the volume descriptor */ buf = alloc(buf_size = ISO_DEFAULT_BLOCK_SIZE); dp = (struct iso_directory_record *)buf; @@ -170,11 +170,11 @@ cd9660_open(path, f) } if (isonum_723(vd->logical_block_size) != ISO_DEFAULT_BLOCK_SIZE) goto out; - + /* Now get the path table and lookup the directory of the file */ bno = isonum_732(vd->type_m_path_table); psize = isonum_733(vd->path_table_size); - + if (psize > ISO_DEFAULT_BLOCK_SIZE) { free(buf, ISO_DEFAULT_BLOCK_SIZE); buf = alloc(buf_size = roundup(psize, ISO_DEFAULT_BLOCK_SIZE)); @@ -189,12 +189,12 @@ cd9660_open(path, f) rc = EIO; goto out; } - + parent = 1; pp = (struct ptable_ent *)buf; ent = 1; bno = isonum_732(pp->block) + isonum_711(pp->extlen); - + rc = ENOENT; /* * Remove extra separators @@ -261,7 +261,7 @@ cd9660_open(path, f) rc = ENOENT; goto out; } - + /* allocate file system specific data structure */ fp = alloc(sizeof(struct file)); bzero(fp, sizeof(struct file)); @@ -271,14 +271,14 @@ cd9660_open(path, f) fp->bno = isonum_733(dp->extent); fp->size = isonum_733(dp->size); free(buf, buf_size); - + return 0; - + out: if (fp) free(fp, sizeof(struct file)); free(buf, buf_size); - + return rc; } @@ -287,10 +287,10 @@ cd9660_close(f) struct open_file *f; { struct file *fp = (struct file *)f->f_fsdata; - + f->f_fsdata = 0; free(fp, sizeof *fp); - + return 0; } @@ -307,7 +307,7 @@ cd9660_read(f, start, size, resid) char buf[ISO_DEFAULT_BLOCK_SIZE]; char *dp; size_t read, off; - + while (size) { if (fp->off < 0 || fp->off >= fp->size) break; @@ -317,7 +317,7 @@ cd9660_read(f, start, size, resid) dp = buf; else dp = start; - twiddle(); + twiddle(); rc = f->f_dev->dv_strategy(f->f_devdata, F_READ, cdb2devb(bno), ISO_DEFAULT_BLOCK_SIZE, dp, &read); if (rc) @@ -361,7 +361,7 @@ cd9660_seek(f, offset, where) int where; { struct file *fp = (struct file *)f->f_fsdata; - + switch (where) { case SEEK_SET: fp->off = offset; @@ -384,7 +384,7 @@ cd9660_stat(f, sb) struct stat *sb; { struct file *fp = (struct file *)f->f_fsdata; - + /* only importatn stuff */ sb->st_mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH; sb->st_uid = sb->st_gid = 0; diff --git a/sys/lib/libsa/close.c b/sys/lib/libsa/close.c index cc9876fa9c1..9f399b8ea0e 100644 --- a/sys/lib/libsa/close.c +++ b/sys/lib/libsa/close.c @@ -1,4 +1,4 @@ -/* $OpenBSD: close.c,v 1.5 1997/02/06 02:56:44 downsj Exp $ */ +/* $OpenBSD: close.c,v 1.6 2003/06/01 17:00:32 deraadt Exp $ */ /* $NetBSD: close.c,v 1.5 1995/09/06 19:53:29 pk Exp $ */ /*- @@ -37,30 +37,30 @@ * SUCH DAMAGE. * * @(#)close.c 8.1 (Berkeley) 6/11/93 - * + * * * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University * All Rights Reserved. * * Author: Alessandro Forin - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * + * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * + * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. */ diff --git a/sys/lib/libsa/closeall.c b/sys/lib/libsa/closeall.c index c0a149b1368..c330ae8fb17 100644 --- a/sys/lib/libsa/closeall.c +++ b/sys/lib/libsa/closeall.c @@ -1,4 +1,4 @@ -/* $OpenBSD: closeall.c,v 1.2 1996/09/23 14:18:50 mickey Exp $ */ +/* $OpenBSD: closeall.c,v 1.3 2003/06/01 17:00:32 deraadt Exp $ */ /* $NetBSD: close.c,v 1.5 1995/09/06 19:53:29 pk Exp $ */ /*- @@ -37,30 +37,30 @@ * SUCH DAMAGE. * * @(#)close.c 8.1 (Berkeley) 6/11/93 - * + * * * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University * All Rights Reserved. * * Author: Alessandro Forin - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * + * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * + * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. */ diff --git a/sys/lib/libsa/ctime.c b/sys/lib/libsa/ctime.c index d98ab1a013f..9d44dead949 100644 --- a/sys/lib/libsa/ctime.c +++ b/sys/lib/libsa/ctime.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ctime.c,v 1.2 1998/06/11 01:34:10 mickey Exp $ */ +/* $OpenBSD: ctime.c,v 1.3 2003/06/01 17:00:32 deraadt Exp $ */ /* * Copyright (c) 1998 Michael Shalayeff @@ -73,7 +73,7 @@ ctime(clock) tt--; /* no field widths in printf() */ - sprintf(buf, "%s %s %d %d:%d:%d %d\n", + snprintf(buf, sizeof buf, "%s %s %d %d:%d:%d %d\n", ((wday < 0 || wday >= 7)? "???": wdays[wday]), ((month < 0 || month >= 12)? "???": months[month]), (int)tt, hh, mm, ss, year); diff --git a/sys/lib/libsa/ether.c b/sys/lib/libsa/ether.c index b8c9bc4206d..69773361022 100644 --- a/sys/lib/libsa/ether.c +++ b/sys/lib/libsa/ether.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ether.c,v 1.5 1998/02/23 20:32:23 niklas Exp $ */ +/* $OpenBSD: ether.c,v 1.6 2003/06/01 17:00:32 deraadt Exp $ */ /* $NetBSD: ether.c,v 1.8 1996/10/13 02:29:00 christos Exp $ */ /* @@ -67,7 +67,7 @@ sendether(d, pkt, len, dea, etype) register struct ether_header *eh; #ifdef ETHER_DEBUG - if (debug) + if (debug) printf("sendether: called\n"); #endif @@ -103,7 +103,7 @@ readether(d, pkt, len, tleft, etype) register struct ether_header *eh; #ifdef ETHER_DEBUG - if (debug) + if (debug) printf("readether: called\n"); #endif diff --git a/sys/lib/libsa/exec.c b/sys/lib/libsa/exec.c index 498d6fdcc1b..236247058a0 100644 --- a/sys/lib/libsa/exec.c +++ b/sys/lib/libsa/exec.c @@ -1,4 +1,4 @@ -/* $OpenBSD: exec.c,v 1.22 1998/07/14 14:26:18 mickey Exp $ */ +/* $OpenBSD: exec.c,v 1.23 2003/06/01 17:00:32 deraadt Exp $ */ /* $NetBSD: exec.c,v 1.15 1996/10/13 02:29:01 christos Exp $ */ /*- @@ -138,7 +138,7 @@ exec(path, loadaddr, howto) sz = i - sizeof(int); addr += sizeof(int); if (read(io, addr, sz) != sz) - goto shread; + goto shread; addr += sz; } @@ -166,7 +166,7 @@ exec(path, loadaddr, howto) #ifdef EXEC_DEBUG printf("loadaddr=%p etxt=%p daddr=%p ssym=%p esym=%p\n", - loadaddr, etxt, daddr, ssym, esym); + loadaddr, etxt, daddr, ssym, esym); printf("\n\nReturn to boot...\n"); getchar(); #endif diff --git a/sys/lib/libsa/exit.c b/sys/lib/libsa/exit.c index d1b22eb9afe..b4503f7860c 100644 --- a/sys/lib/libsa/exit.c +++ b/sys/lib/libsa/exit.c @@ -1,10 +1,10 @@ -/* $OpenBSD: exit.c,v 1.6 2002/03/15 18:19:52 millert Exp $ */ +/* $OpenBSD: exit.c,v 1.7 2003/06/01 17:00:32 deraadt Exp $ */ /* $NetBSD: exit.c,v 1.11 1996/12/01 20:22:19 pk Exp $ */ /*- * Copyright (c) 1993 John Brezak * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -15,7 +15,7 @@ * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `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 @@ -36,26 +36,26 @@ __dead void panic(const char *fmt, ...) { - extern void closeall(void); - va_list ap; - static int paniced; - - if (!paniced) { - paniced = 1; - closeall(); - } + extern void closeall(void); + va_list ap; + static int paniced; - va_start(ap, fmt); - vprintf(fmt, ap); - printf("\n"); - va_end(ap); - _rtt(); - /*NOTREACHED*/ + if (!paniced) { + paniced = 1; + closeall(); + } + + va_start(ap, fmt); + vprintf(fmt, ap); + printf("\n"); + va_end(ap); + _rtt(); + /*NOTREACHED*/ } void exit() { - panic("exit"); - /*NOTREACHED*/ + panic("exit"); + /*NOTREACHED*/ } diff --git a/sys/lib/libsa/ioctl.c b/sys/lib/libsa/ioctl.c index ac2a7b2f4b4..25ea2d83b8a 100644 --- a/sys/lib/libsa/ioctl.c +++ b/sys/lib/libsa/ioctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ioctl.c,v 1.2 1996/09/23 14:18:55 mickey Exp $ */ +/* $OpenBSD: ioctl.c,v 1.3 2003/06/01 17:00:32 deraadt Exp $ */ /* $NetBSD: ioctl.c,v 1.4 1994/10/30 21:48:24 cgd Exp $ */ /*- @@ -37,30 +37,30 @@ * SUCH DAMAGE. * * @(#)ioctl.c 8.1 (Berkeley) 6/11/93 - * + * * * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University * All Rights Reserved. * * Author: Alessandro Forin - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * + * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * + * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. */ diff --git a/sys/lib/libsa/iodesc.h b/sys/lib/libsa/iodesc.h index d32a2842426..3e372499a28 100644 --- a/sys/lib/libsa/iodesc.h +++ b/sys/lib/libsa/iodesc.h @@ -1,8 +1,8 @@ -/* $OpenBSD: iodesc.h,v 1.2 1996/09/23 14:18:56 mickey Exp $ */ +/* $OpenBSD: iodesc.h,v 1.3 2003/06/01 17:00:32 deraadt Exp $ */ /* $NetBSD: iodesc.h,v 1.4 1995/09/23 03:31:50 gwr Exp $ */ /* - * Copyright (c) 1993 Adam Glass + * Copyright (c) 1993 Adam Glass * Copyright (c) 1992 Regents of the University of California. * All rights reserved. * diff --git a/sys/lib/libsa/loadfile.c b/sys/lib/libsa/loadfile.c index 6262f0a0d2c..34916ab79ab 100644 --- a/sys/lib/libsa/loadfile.c +++ b/sys/lib/libsa/loadfile.c @@ -1,5 +1,5 @@ /* $NetBSD: loadfile.c,v 1.10 2000/12/03 02:53:04 tsutsui Exp $ */ -/* $OpenBSD: loadfile.c,v 1.4 2003/05/07 18:11:37 mickey Exp $ */ +/* $OpenBSD: loadfile.c,v 1.5 2003/06/01 17:00:32 deraadt Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -127,7 +127,7 @@ loadfile(fname, marks, flags) #ifdef BOOT_AOUT struct exec aout; #endif - + } hdr; ssize_t nr; int fd, rval; @@ -457,7 +457,7 @@ aout_exec(fd, x, marks, flags) sub = 0; else sub = sizeof(*x); - + minp = maxp = ALIGNENTRY(entry); if (lseek(fd, sizeof(*x), SEEK_SET) == -1) { diff --git a/sys/lib/libsa/lseek.c b/sys/lib/libsa/lseek.c index e15f1a534a7..db8804292fa 100644 --- a/sys/lib/libsa/lseek.c +++ b/sys/lib/libsa/lseek.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lseek.c,v 1.4 1997/02/06 02:56:45 downsj Exp $ */ +/* $OpenBSD: lseek.c,v 1.5 2003/06/01 17:00:33 deraadt Exp $ */ /* $NetBSD: lseek.c,v 1.3 1996/06/21 20:09:03 pk Exp $ */ /*- @@ -37,30 +37,30 @@ * SUCH DAMAGE. * * @(#)lseek.c 8.1 (Berkeley) 6/11/93 - * + * * * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University * All Rights Reserved. * * Author: Alessandro Forin - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * + * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * + * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. */ diff --git a/sys/lib/libsa/net.c b/sys/lib/libsa/net.c index 35adb509fbd..c3ebf23d289 100644 --- a/sys/lib/libsa/net.c +++ b/sys/lib/libsa/net.c @@ -1,4 +1,4 @@ -/* $OpenBSD: net.c,v 1.11 2002/03/14 01:27:07 millert Exp $ */ +/* $OpenBSD: net.c,v 1.12 2003/06/01 17:00:33 deraadt Exp $ */ /* $NetBSD: net.c,v 1.14 1996/10/13 02:29:02 christos Exp $ */ /* @@ -72,7 +72,7 @@ sendudp(d, pkt, len) struct ip tip; #ifdef NET_DEBUG - if (debug) { + if (debug) { printf("sendudp: d=%x called.\n", (u_int)d); if (d) { printf("saddr: %s:%d", diff --git a/sys/lib/libsa/net.h b/sys/lib/libsa/net.h index 33f1847875d..efd33d52424 100644 --- a/sys/lib/libsa/net.h +++ b/sys/lib/libsa/net.h @@ -1,8 +1,8 @@ -/* $OpenBSD: net.h,v 1.5 2002/03/14 03:16:10 millert Exp $ */ +/* $OpenBSD: net.h,v 1.6 2003/06/01 17:00:33 deraadt Exp $ */ /* $NetBSD: net.h,v 1.10 1995/10/20 00:46:30 cgd Exp $ */ /* - * Copyright (c) 1993 Adam Glass + * Copyright (c) 1993 Adam Glass * Copyright (c) 1992 Regents of the University of California. * All rights reserved. * diff --git a/sys/lib/libsa/netif.c b/sys/lib/libsa/netif.c index 8adafa0913f..58d067e4e84 100644 --- a/sys/lib/libsa/netif.c +++ b/sys/lib/libsa/netif.c @@ -1,4 +1,4 @@ -/* $OpenBSD: netif.c,v 1.6 1999/01/11 05:12:26 millert Exp $ */ +/* $OpenBSD: netif.c,v 1.7 2003/06/01 17:00:33 deraadt Exp $ */ /* $NetBSD: netif.c,v 1.7 1996/10/13 02:29:03 christos Exp $ */ /* @@ -60,7 +60,7 @@ netif_init() { struct netif_driver *drv; int d, i; - + #ifdef NETIF_DEBUG if (netif_debug) printf("netif_init: called\n"); @@ -113,7 +113,7 @@ netif_select(machdep_hint) for (u = 0; u < drv->netif_nifs; u++) { cur_if.nif_unit = u; unit_done = 0; - + #ifdef NETIF_DEBUG if (netif_debug) printf("\t%s%d:", drv->netif_bname, @@ -189,14 +189,14 @@ netif_attach(nif, desc, machdep_hint) if (netif_debug) printf("%s%d: netif_attach\n", drv->netif_bname, nif->nif_unit); #endif - desc->io_netif = nif; + desc->io_netif = nif; #ifdef PARANOID if (drv->netif_init == NULL) panic("%s%d: no netif_init support", drv->netif_bname, nif->nif_unit); #endif drv->netif_init(desc, machdep_hint); - bzero(drv->netif_ifs[nif->nif_unit].dif_stats, + bzero(drv->netif_ifs[nif->nif_unit].dif_stats, sizeof(struct netif_stats)); } @@ -297,7 +297,7 @@ netif_open(machdep_hint) int fd; register struct iodesc *s; struct netif *nif; - + /* find a free socket */ for (fd = 0, s = sockets; fd < SOPEN_MAX; fd++, s++) if (s->io_netif == (struct netif *)0) @@ -309,7 +309,7 @@ fnd: bzero(s, sizeof(*s)); netif_init(); nif = netif_select(machdep_hint); - if (!nif) + if (!nif) panic("netboot: no interfaces left untried"); if (netif_probe(nif, machdep_hint)) { printf("netboot: couldn't probe %s%d\n", diff --git a/sys/lib/libsa/netif.h b/sys/lib/libsa/netif.h index a9c87d47c36..622cb486477 100644 --- a/sys/lib/libsa/netif.h +++ b/sys/lib/libsa/netif.h @@ -1,4 +1,4 @@ -/* $OpenBSD: netif.h,v 1.4 2002/03/14 01:27:07 millert Exp $ */ +/* $OpenBSD: netif.h,v 1.5 2003/06/01 17:00:33 deraadt Exp $ */ /* $NetBSD: netif.h,v 1.4 1995/09/14 23:45:30 pk Exp $ */ #ifndef __SYS_LIBNETBOOT_NETIF_H @@ -60,5 +60,5 @@ int netif_open(void *); int netif_close(int); struct iodesc *socktodesc(int); - + #endif /* __SYS_LIBNETBOOT_NETIF_H */ diff --git a/sys/lib/libsa/nfs.c b/sys/lib/libsa/nfs.c index 309afb4adc1..d103b186c74 100644 --- a/sys/lib/libsa/nfs.c +++ b/sys/lib/libsa/nfs.c @@ -1,10 +1,10 @@ -/* $OpenBSD: nfs.c,v 1.8 1997/03/25 20:30:43 niklas Exp $ */ +/* $OpenBSD: nfs.c,v 1.9 2003/06/01 17:00:33 deraadt Exp $ */ /* $NetBSD: nfs.c,v 1.19 1996/10/13 02:29:04 christos Exp $ */ /*- * Copyright (c) 1993 John Brezak * All rights reserved. - * + * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: @@ -15,7 +15,7 @@ * documentation and/or other materials provided with the distribution. * 3. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. - * + * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `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 @@ -126,7 +126,7 @@ nfs_getrootfh(d, path, fhp) struct repl d; } rdata; size_t cc; - + #ifdef NFS_DEBUG if (debug) printf("nfs_getrootfh: %s\n", path); @@ -191,7 +191,7 @@ nfs_lookupfh(d, name, newfd) struct repl d; } rdata; ssize_t cc; - + #ifdef NFS_DEBUG if (debug) printf("lookupfh: called\n"); @@ -259,7 +259,7 @@ nfs_readlink(d, buf) if (cc < 4) return (EIO); - + if (rdata.d.errno) return (ntohl(rdata.d.errno)); @@ -390,8 +390,8 @@ nfs_open(path, f) int error = 0; #ifdef NFS_DEBUG - if (debug) - printf("nfs_open: %s\n", path); + if (debug) + printf("nfs_open: %s\n", path); #endif if (nfs_root_node.iodesc == NULL) { printf("nfs_open: must mount first.\n"); @@ -400,7 +400,7 @@ nfs_open(path, f) currfd = &nfs_root_node; newfd = 0; - + cp = path; while (*cp) { /* @@ -418,18 +418,18 @@ nfs_open(path, f) error = ENOTDIR; goto out; } - + /* allocate file system specific data structure */ newfd = alloc(sizeof(*newfd)); newfd->iodesc = currfd->iodesc; newfd->off = 0; - + /* * Get next component of path name. */ { register int len = 0; - + ncp = cp; while ((c = *cp) != '\0' && c != '/') { if (++len > NFS_MAXNAMLEN) { @@ -440,19 +440,19 @@ nfs_open(path, f) } *cp = '\0'; } - + /* lookup a file handle */ error = nfs_lookupfh(currfd, ncp, newfd); *cp = c; if (error) goto out; - + /* * Check for symbolic link */ if (newfd->fa.fa_type == htonl(NFLNK)) { int link_len, len; - + error = nfs_readlink(newfd, linkbuf); if (error) goto out; @@ -468,7 +468,7 @@ nfs_open(path, f) bcopy(cp, &namebuf[link_len], len + 1); bcopy(linkbuf, namebuf, link_len); - + /* * If absolute pathname, restart at root. * If relative pathname, restart at parent directory. @@ -482,10 +482,10 @@ nfs_open(path, f) free(newfd, sizeof(*newfd)); newfd = 0; - + continue; } - + if (currfd != &nfs_root_node) free(currfd, sizeof(*currfd)); currfd = newfd; @@ -499,7 +499,7 @@ out: f->f_fsdata = (void *)currfd; return (0); } - + #ifdef NFS_DEBUG if (debug) printf("nfs_open: %s lookupfh failed: %s\n", @@ -527,7 +527,7 @@ nfs_close(f) if (fp) free(fp, sizeof(struct nfs_iodesc)); f->f_fsdata = (void *)0; - + return (0); } @@ -544,7 +544,7 @@ nfs_read(f, buf, size, resid) register struct nfs_iodesc *fp = (struct nfs_iodesc *)f->f_fsdata; register ssize_t cc; register char *addr = buf; - + #ifdef NFS_DEBUG if (debug) printf("nfs_read: size=%d off=%d\n", size, (int)fp->off); diff --git a/sys/lib/libsa/nullfs.c b/sys/lib/libsa/nullfs.c index 6066b59e21b..84c54cf549e 100644 --- a/sys/lib/libsa/nullfs.c +++ b/sys/lib/libsa/nullfs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: nullfs.c,v 1.4 1997/05/04 22:41:24 millert Exp $ */ +/* $OpenBSD: nullfs.c,v 1.5 2003/06/01 17:00:33 deraadt Exp $ */ /* $NetBSD: open.c,v 1.9 1995/09/19 09:16:52 thorpej Exp $ */ /*- @@ -37,30 +37,30 @@ * SUCH DAMAGE. * * @(#)open.c 8.1 (Berkeley) 6/11/93 - * + * * * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University * All Rights Reserved. * * Author: Alessandro Forin - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * + * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * + * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. */ diff --git a/sys/lib/libsa/open.c b/sys/lib/libsa/open.c index 65306545640..f852f9c2786 100644 --- a/sys/lib/libsa/open.c +++ b/sys/lib/libsa/open.c @@ -1,4 +1,4 @@ -/* $OpenBSD: open.c,v 1.7 1998/09/11 01:41:18 millert Exp $ */ +/* $OpenBSD: open.c,v 1.8 2003/06/01 17:00:33 deraadt Exp $ */ /* $NetBSD: open.c,v 1.12 1996/09/30 16:01:21 ws Exp $ */ /*- @@ -37,30 +37,30 @@ * SUCH DAMAGE. * * @(#)open.c 8.1 (Berkeley) 6/11/93 - * + * * * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University * All Rights Reserved. * * Author: Alessandro Forin - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * + * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * + * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. */ diff --git a/sys/lib/libsa/printf.c b/sys/lib/libsa/printf.c index 8d6d33b03da..edb396d9b09 100644 --- a/sys/lib/libsa/printf.c +++ b/sys/lib/libsa/printf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: printf.c,v 1.18 2003/05/20 19:23:01 jason Exp $ */ +/* $OpenBSD: printf.c,v 1.19 2003/06/01 17:00:33 deraadt Exp $ */ /* $NetBSD: printf.c,v 1.10 1996/11/30 04:19:21 gwr Exp $ */ /*- @@ -65,32 +65,8 @@ #include "stand.h" -static void kprintn(void (*)(int), u_long, int); -static void kdoprnt(void (*)(int), const char *, va_list); - -#ifndef STRIPPED -static void sputchar(int); -static char *sbuf; - -static void -sputchar(c) - int c; -{ - *sbuf++ = c; -} - -void -sprintf(char *buf, const char *fmt, ...) -{ - va_list ap; - - sbuf = buf; - va_start(ap, fmt); - kdoprnt(sputchar, fmt, ap); - va_end(ap); - *sbuf = '\0'; -} -#endif /* NO_SPRINTF */ +void kprintn(void (*)(int), u_long, int); +void kdoprnt(void (*)(int), const char *, va_list); void printf(const char *fmt, ...) @@ -108,7 +84,7 @@ vprintf(const char *fmt, va_list ap) kdoprnt(putchar, fmt, ap); } -static void +void kdoprnt(put, fmt, ap) void (*put)(int); const char *fmt; @@ -201,7 +177,7 @@ reswitch: switch (ch = *fmt++) { va_end(ap); } -static void +void kprintn(put, ul, base) void (*put)(int); unsigned long ul; diff --git a/sys/lib/libsa/rarp.c b/sys/lib/libsa/rarp.c index e022239e958..225f6e96e54 100644 --- a/sys/lib/libsa/rarp.c +++ b/sys/lib/libsa/rarp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rarp.c,v 1.8 2002/03/14 03:16:10 millert Exp $ */ +/* $OpenBSD: rarp.c,v 1.9 2003/06/01 17:00:33 deraadt Exp $ */ /* $NetBSD: rarp.c,v 1.13 1996/10/13 02:29:05 christos Exp $ */ /* @@ -67,19 +67,19 @@ rarp_getipaddress(sock) u_char header[ETHER_SIZE]; struct { struct ether_arp arp; - u_char pad[18]; /* 60 - sizeof(arp) */ + u_char pad[18]; /* 60 - sizeof(arp) */ } data; } wbuf; struct { u_char header[ETHER_SIZE]; struct { struct ether_arp arp; - u_char pad[24]; /* extra space */ + u_char pad[24]; /* extra space */ } data; } rbuf; #ifdef RARP_DEBUG - if (debug) + if (debug) printf("rarp: socket=%d\n", sock); #endif if (!(d = socktodesc(sock))) { @@ -87,7 +87,7 @@ rarp_getipaddress(sock) return (-1); } #ifdef RARP_DEBUG - if (debug) + if (debug) printf("rarp: d=%x\n", (u_int)d); #endif @@ -139,7 +139,7 @@ rarpsend(d, pkt, len) { #ifdef RARP_DEBUG - if (debug) + if (debug) printf("rarpsend: called\n"); #endif @@ -162,7 +162,7 @@ rarprecv(d, pkt, len, tleft) u_int16_t etype; /* host order */ #ifdef RARP_DEBUG - if (debug) + if (debug) printf("rarprecv: "); #endif @@ -216,7 +216,7 @@ rarprecv(d, pkt, len, tleft) /* We have our answer. */ #ifdef RARP_DEBUG - if (debug) + if (debug) printf("got it\n"); #endif return (n); diff --git a/sys/lib/libsa/read.c b/sys/lib/libsa/read.c index 3e85865d0a3..96df4d799b2 100644 --- a/sys/lib/libsa/read.c +++ b/sys/lib/libsa/read.c @@ -1,4 +1,4 @@ -/* $OpenBSD: read.c,v 1.4 1997/02/06 02:56:46 downsj Exp $ */ +/* $OpenBSD: read.c,v 1.5 2003/06/01 17:00:33 deraadt Exp $ */ /* $NetBSD: read.c,v 1.7 1996/06/21 20:29:28 pk Exp $ */ /*- @@ -37,30 +37,30 @@ * SUCH DAMAGE. * * @(#)read.c 8.1 (Berkeley) 6/11/93 - * + * * * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University * All Rights Reserved. * * Author: Alessandro Forin - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * + * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * + * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. */ diff --git a/sys/lib/libsa/readdir.c b/sys/lib/libsa/readdir.c index 277dfc44348..967dbe3c1bd 100644 --- a/sys/lib/libsa/readdir.c +++ b/sys/lib/libsa/readdir.c @@ -1,4 +1,4 @@ -/* $OpenBSD: readdir.c,v 1.4 1997/07/21 15:43:54 mickey Exp $ */ +/* $OpenBSD: readdir.c,v 1.5 2003/06/01 17:00:33 deraadt Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -18,8 +18,8 @@ * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 @@ -68,7 +68,7 @@ opendir(name) return fd; } - + int readdir(fd, dest) int fd; diff --git a/sys/lib/libsa/rpc.c b/sys/lib/libsa/rpc.c index 8fa05ae902c..35b692bc38f 100644 --- a/sys/lib/libsa/rpc.c +++ b/sys/lib/libsa/rpc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rpc.c,v 1.11 2002/03/14 01:27:07 millert Exp $ */ +/* $OpenBSD: rpc.c,v 1.12 2003/06/01 17:00:33 deraadt Exp $ */ /* $NetBSD: rpc.c,v 1.16 1996/10/13 02:29:06 christos Exp $ */ /* @@ -62,7 +62,7 @@ #include "rpc.h" struct auth_info { - int32_t authtype; /* auth type */ + int32_t authtype; /* auth type */ u_int32_t authlen; /* auth length */ }; @@ -76,7 +76,7 @@ struct auth_unix { struct rpc_call { u_int32_t rp_xid; /* request transaction id */ - int32_t rp_direction; /* call direction (0) */ + int32_t rp_direction; /* call direction (0) */ u_int32_t rp_rpcvers; /* rpc version (2) */ u_int32_t rp_prog; /* program */ u_int32_t rp_vers; /* version */ @@ -85,8 +85,8 @@ struct rpc_call { struct rpc_reply { u_int32_t rp_xid; /* request transaction id */ - int32_t rp_direction; /* call direction (1) */ - int32_t rp_astatus; /* accept status (0: accepted) */ + int32_t rp_direction; /* call direction (1) */ + int32_t rp_astatus; /* accept status (0: accepted) */ union { u_int32_t rpu_errno; struct { @@ -321,7 +321,7 @@ struct pmap_list { struct in_addr addr; /* server, net order */ u_int prog; /* host order */ u_int vers; /* host order */ - int port; /* host order */ + int port; /* host order */ } rpc_pmap_list[PMAP_NUM]; /* return port number in host order, or -1 */ @@ -348,7 +348,7 @@ rpc_pmap_putcache(addr, prog, vers, port) struct in_addr addr; /* server, net order */ u_int prog; /* host order */ u_int vers; /* host order */ - int port; /* host order */ + int port; /* host order */ { struct pmap_list *pl; diff --git a/sys/lib/libsa/snprintf.c b/sys/lib/libsa/snprintf.c new file mode 100644 index 00000000000..036bab74b94 --- /dev/null +++ b/sys/lib/libsa/snprintf.c @@ -0,0 +1,83 @@ +/* $OpenBSD: snprintf.c,v 1.1 2003/06/01 17:00:33 deraadt Exp $ */ +/* $NetBSD: printf.c,v 1.10 1996/11/30 04:19:21 gwr Exp $ */ + +/*- + * Copyright (c) 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. + * + * @(#)printf.c 8.1 (Berkeley) 6/11/93 + */ + +#include <sys/cdefs.h> +#include <sys/types.h> +#include <machine/stdarg.h> + +#include "stand.h" + +extern void kprintn(void (*)(int), u_long, int); +extern void kdoprnt(void (*)(int), const char *, va_list); + +#ifndef STRIPPED +static void sputchar(int); + +static char *sbuf, *sbuf_end; +static size_t sbuf_len; + +void +sputchar(c) + int c; +{ + if (sbuf < sbuf_end) + *sbuf = c; + sbuf++; +} + +int +snprintf(char *buf, size_t len, const char *fmt, ...) +{ + va_list ap; + + sbuf = buf; + sbuf_len = len; + sbuf_end = sbuf + len; + va_start(ap, fmt); + kdoprnt(sputchar, fmt, ap); + va_end(ap); + + if (sbuf < sbuf_end) + *sbuf = '\0'; + else if (len > 0) + *(sbuf_end - 1) = '\0'; + + return sbuf - buf; +} + +#endif /* STRIPPED */ diff --git a/sys/lib/libsa/stand.h b/sys/lib/libsa/stand.h index bd012095eea..126fe7bd039 100644 --- a/sys/lib/libsa/stand.h +++ b/sys/lib/libsa/stand.h @@ -1,4 +1,4 @@ -/* $OpenBSD: stand.h,v 1.39 2002/03/15 18:19:52 millert Exp $ */ +/* $OpenBSD: stand.h,v 1.40 2003/06/01 17:00:33 deraadt Exp $ */ /* $NetBSD: stand.h,v 1.18 1996/11/30 04:35:51 gwr Exp $ */ /*- @@ -139,7 +139,7 @@ char *getdisklabel(const char *, struct disklabel *); u_int dkcksum(struct disklabel *); void printf(const char *, ...); -void sprintf(char *, const char *, ...); +int snprintf(char *, size_t, const char *, ...); void vprintf(const char *, _BSD_VA_LIST_); void twiddle(void); void gets(char *); @@ -195,7 +195,7 @@ u_int sleep(u_int); void usleep(u_int); char *ctime(const time_t *); -void putchar(int); +void putchar(int); int getchar(void); #ifdef __INTERNAL_LIBSA_CREAD diff --git a/sys/lib/libsa/strcmp.c b/sys/lib/libsa/strcmp.c index ac5a812aa37..0c2cf99ab90 100644 --- a/sys/lib/libsa/strcmp.c +++ b/sys/lib/libsa/strcmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strcmp.c,v 1.2 1996/10/16 11:32:07 mickey Exp $ */ +/* $OpenBSD: strcmp.c,v 1.3 2003/06/01 17:00:33 deraadt Exp $ */ /*- * Copyright (c) 1996 Michael Shalayeff @@ -18,8 +18,8 @@ * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 diff --git a/sys/lib/libsa/strerror.c b/sys/lib/libsa/strerror.c index d39aea7059e..04f2fbe4720 100644 --- a/sys/lib/libsa/strerror.c +++ b/sys/lib/libsa/strerror.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strerror.c,v 1.5 1997/06/10 16:39:16 millert Exp $ */ +/* $OpenBSD: strerror.c,v 1.6 2003/06/01 17:00:33 deraadt Exp $ */ /* $NetBSD: strerror.c,v 1.11 1996/10/13 02:29:08 christos Exp $ */ /*- @@ -42,7 +42,7 @@ char * strerror(err) int err; { -static char ebuf[64]; + static char ebuf[64]; switch (err) { case EADAPT: @@ -75,7 +75,7 @@ static char ebuf[64]; return "Invalid argument"; default: - sprintf(ebuf, "Unknown error: code %d", err); + snprintf(ebuf, sizeof ebuf, "Unknown error: code %d", err); return ebuf; } } diff --git a/sys/lib/libsa/strncmp.c b/sys/lib/libsa/strncmp.c index d55d73f9a3f..c0487c65ea9 100644 --- a/sys/lib/libsa/strncmp.c +++ b/sys/lib/libsa/strncmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strncmp.c,v 1.1 1997/02/06 06:47:00 mickey Exp $ */ +/* $OpenBSD: strncmp.c,v 1.2 2003/06/01 17:00:33 deraadt Exp $ */ /*- * Copyright (c) 1996 Michael Shalayeff @@ -18,8 +18,8 @@ * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 diff --git a/sys/lib/libsa/strncpy.c b/sys/lib/libsa/strncpy.c index 2f09aeb2127..69795eae3b1 100644 --- a/sys/lib/libsa/strncpy.c +++ b/sys/lib/libsa/strncpy.c @@ -1,4 +1,4 @@ -/* $OpenBSD: strncpy.c,v 1.1 1996/10/16 11:32:07 mickey Exp $ */ +/* $OpenBSD: strncpy.c,v 1.2 2003/06/01 17:00:33 deraadt Exp $ */ /*- * Copyright (c) 1996 Michael Shalayeff @@ -18,8 +18,8 @@ * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 diff --git a/sys/lib/libsa/ufs.c b/sys/lib/libsa/ufs.c index 9ac3a3092ca..4cc342b47d8 100644 --- a/sys/lib/libsa/ufs.c +++ b/sys/lib/libsa/ufs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ufs.c,v 1.13 2002/03/14 01:27:07 millert Exp $ */ +/* $OpenBSD: ufs.c,v 1.14 2003/06/01 17:00:33 deraadt Exp $ */ /* $NetBSD: ufs.c,v 1.16 1996/09/30 16:01:22 ws Exp $ */ /*- @@ -35,30 +35,30 @@ * 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. - * + * * * Copyright (c) 1990, 1991 Carnegie Mellon University * All Rights Reserved. * * Author: David Golub - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * + * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * + * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. */ @@ -125,8 +125,8 @@ read_inode(inumber, f) buf = alloc(fs->fs_bsize); twiddle(); rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, - fsbtodb(fs, ino_to_fsba(fs, inumber)), fs->fs_bsize, - buf, &rsize); + fsbtodb(fs, ino_to_fsba(fs, inumber)), fs->fs_bsize, + buf, &rsize); if (rc) goto out; if (rsize != (size_t)fs->fs_bsize) { @@ -153,7 +153,7 @@ read_inode(inumber, f) } out: free(buf, fs->fs_bsize); - return (rc); + return (rc); } /* @@ -232,13 +232,11 @@ block_map(f, file_block, disk_block_p) if (fp->f_blkno[level] != ind_block_num) { if (fp->f_blk[level] == (char *)0) fp->f_blk[level] = - alloc(fs->fs_bsize); + alloc(fs->fs_bsize); twiddle(); rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, - fsbtodb(fp->f_fs, ind_block_num), - fs->fs_bsize, - fp->f_blk[level], - &fp->f_blksize[level]); + fsbtodb(fp->f_fs, ind_block_num), fs->fs_bsize, + fp->f_blk[level], &fp->f_blksize[level]); if (rc) return (rc); if (fp->f_blksize[level] != (size_t)fs->fs_bsize) @@ -298,8 +296,8 @@ buf_read_file(f, buf_p, size_p) } else { twiddle(); rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, - fsbtodb(fs, disk_block), - block_size, fp->f_buf, &fp->f_buf_size); + fsbtodb(fs, disk_block), + block_size, fp->f_buf, &fp->f_buf_size); if (rc) return (rc); } @@ -404,7 +402,7 @@ ufs_open(path, f) fp->f_fs = fs; twiddle(); rc = (f->f_dev->dv_strategy)(f->f_devdata, F_READ, - SBLOCK, SBSIZE, (char *)fs, &buf_size); + SBLOCK, SBSIZE, (char *)fs, &buf_size); if (rc) goto out; @@ -507,7 +505,7 @@ ufs_open(path, f) if (link_len < fs->fs_maxsymlinklen) { bcopy(fp->f_di.di_shortlink, namebuf, - (unsigned) link_len); + (unsigned) link_len); } else { /* * Read file for symbolic link @@ -521,11 +519,11 @@ ufs_open(path, f) rc = block_map(f, (daddr_t)0, &disk_block); if (rc) goto out; - + twiddle(); rc = (f->f_dev->dv_strategy)(f->f_devdata, - F_READ, fsbtodb(fs, disk_block), - fs->fs_bsize, buf, &buf_size); + F_READ, fsbtodb(fs, disk_block), + fs->fs_bsize, buf, &buf_size); if (rc) goto out; @@ -707,7 +705,7 @@ ufs_readdir(f, name) while (dp < edp && dp->d_ino == (ino_t)0) dp = (struct direct *)((char *)dp + dp->d_reclen); fp->f_seekp += buf_size - - ((u_int8_t *)edp - (u_int8_t *)dp); + ((u_int8_t *)edp - (u_int8_t *)dp); } while (dp >= edp); #if BYTE_ORDER == LITTLE_ENDIAN diff --git a/sys/lib/libsa/unixdev.c b/sys/lib/libsa/unixdev.c index 396ddb3510e..52ae1130e33 100644 --- a/sys/lib/libsa/unixdev.c +++ b/sys/lib/libsa/unixdev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: unixdev.c,v 1.4 1998/05/25 18:37:30 mickey Exp $ */ +/* $OpenBSD: unixdev.c,v 1.5 2003/06/01 17:00:33 deraadt Exp $ */ /* * Copyright (c) 1996-1998 Michael Shalayeff @@ -18,8 +18,8 @@ * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 @@ -56,11 +56,11 @@ unixstrategy(devdata, rw, blk, size, buf, rsize) #ifdef UNIX_DEBUG printf("unixstrategy: %s %d bytes @ %d\n", - (rw==F_READ?"reading":"writing"), size, blk); + (rw==F_READ?"reading":"writing"), size, blk); #endif if ((rc = ulseek((int)devdata, blk * DEV_BSIZE, 0)) >= 0) - rc = rw==F_READ? uread((int)devdata, buf, size) : - uwrite((int)devdata, buf, size); + rc = (rw==F_READ) ? uread((int)devdata, buf, size) : + uwrite((int)devdata, buf, size); if (rc >= 0) { *rsize = (size_t)rc; @@ -88,7 +88,8 @@ unixopen(struct open_file *f, ...) if (strncmp("/dev/", *file, 5) == 0) { /* p = strchr(p + 5, '/') */ - for (p = *file + 5; *p != '\0' && *p != '/'; p++); + for (p = *file + 5; *p != '\0' && *p != '/'; p++) + ; if (*p == '/') *p = '\0'; } @@ -99,7 +100,7 @@ unixopen(struct open_file *f, ...) if (p != NULL) *p = '/'; - return fd<0? -1: 0; + return fd < 0 ? -1 : 0; } int @@ -171,6 +172,7 @@ unix_getc(dev) return 1; } else { char c; + return uread(0, &c, 1)<1? -1: c; } } diff --git a/sys/lib/libsa/unixdev.h b/sys/lib/libsa/unixdev.h index 126cccd336b..033c0315571 100644 --- a/sys/lib/libsa/unixdev.h +++ b/sys/lib/libsa/unixdev.h @@ -1,4 +1,4 @@ -/* $OpenBSD: unixdev.h,v 1.4 2002/03/14 01:27:07 millert Exp $ */ +/* $OpenBSD: unixdev.h,v 1.5 2003/06/01 17:00:33 deraadt Exp $ */ /* * Copyright (c) 1996 Michael Shalayeff @@ -18,8 +18,8 @@ * 4. The name of the author may not be used to endorse or promote products * derived from this software without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 diff --git a/sys/lib/libsa/write.c b/sys/lib/libsa/write.c index ead77c74710..0cb9e540ae3 100644 --- a/sys/lib/libsa/write.c +++ b/sys/lib/libsa/write.c @@ -1,4 +1,4 @@ -/* $OpenBSD: write.c,v 1.3 1996/12/08 15:15:59 niklas Exp $ */ +/* $OpenBSD: write.c,v 1.4 2003/06/01 17:00:33 deraadt Exp $ */ /* $NetBSD: write.c,v 1.7 1996/06/21 20:29:30 pk Exp $ */ /*- @@ -37,30 +37,30 @@ * SUCH DAMAGE. * * @(#)write.c 8.1 (Berkeley) 6/11/93 - * + * * * Copyright (c) 1989, 1990, 1991 Carnegie Mellon University * All Rights Reserved. * * Author: Alessandro Forin - * + * * Permission to use, copy, modify and distribute this software and its * documentation is hereby granted, provided that both the copyright * notice and this permission notice appear in all copies of the * software, derivative works or modified versions, and any portions * thereof, and that both notices appear in supporting documentation. - * + * * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. - * + * * Carnegie Mellon requests users of this software to return to - * + * * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU * School of Computer Science * Carnegie Mellon University * Pittsburgh PA 15213-3890 - * + * * any improvements or extensions that they make and grant Carnegie the * rights to redistribute these changes. */ @@ -84,7 +84,7 @@ write(fd, dest, bcount) if (f->f_flags & F_RAW) { twiddle(); errno = (f->f_dev->dv_strategy)(f->f_devdata, F_WRITE, - btodb(f->f_offset), bcount, dest, &resid); + btodb(f->f_offset), bcount, dest, &resid); if (errno) return (-1); f->f_offset += resid; |