diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-04-21 23:47:39 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-04-21 23:47:39 +0000 |
commit | 882e83ccf31fca22178b290a6753a605bb52044c (patch) | |
tree | e2e6ec6ef7e162fd03a03e5c71bc96ce90d1c105 /lib | |
parent | 67d88b0a9910a68bb666b448d2dac29cb4d3d8c2 (diff) |
sync to netbsd 960418
Diffstat (limited to 'lib')
35 files changed, 722 insertions, 408 deletions
diff --git a/lib/libarch/alpha/Makefile b/lib/libarch/alpha/Makefile deleted file mode 100644 index d2822fd6bfd..00000000000 --- a/lib/libarch/alpha/Makefile +++ /dev/null @@ -1,8 +0,0 @@ -# $OpenBSD: Makefile,v 1.1 1996/03/19 23:14:54 niklas Exp $ -# $NetBSD: Makefile,v 1.1 1996/02/21 02:45:40 jtk Exp $ - -#.PATH: ${LIBC}/i386 - -SRCS+= alpha_mmclock_gettime.c alpha_mmclock_init.c gettimeofday.c - -.include <bsd.lib.mk> diff --git a/lib/libarch/alpha/alpha_mmclock_gettime.c b/lib/libarch/alpha/alpha_mmclock_gettime.c deleted file mode 100644 index ca56c77bfcf..00000000000 --- a/lib/libarch/alpha/alpha_mmclock_gettime.c +++ /dev/null @@ -1,55 +0,0 @@ -/* $NetBSD: alpha_mmclock_gettime.c,v 1.1 1995/12/20 12:54:24 cgd Exp $ */ - -/* - * Copyright (c) 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * 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. - */ - -#include <sys/types.h> -#include <sys/fcntl.h> -#include <sys/mman.h> -#include <sys/syscall.h> -#include <machine/sysarch.h> - -#include "libalpha.h" - -void -alpha_mmclock_gettime(tdp) - struct alpha_timedata *tdp; -{ - u_long npcc, pccdiff; - - do { - tdp->td_tv.tv_usec = alpha_mmclockdata->td_tv.tv_usec; - tdp->td_tv.tv_sec = alpha_mmclockdata->td_tv.tv_sec; - tdp->td_cc = alpha_mmclockdata->td_cc; - } while (tdp->td_tv.tv_usec != alpha_mmclockdata->td_tv.tv_usec || - tdp->td_tv.tv_sec != alpha_mmclockdata->td_tv.tv_sec); - - npcc = rpcc() & 0x00000000ffffffffUL; - if (npcc < tdp->td_cc) - npcc += 0x0000000100000000UL; - tdp->td_cc = npcc - tdp->td_cc; -} diff --git a/lib/libarch/alpha/alpha_mmclock_init.c b/lib/libarch/alpha/alpha_mmclock_init.c deleted file mode 100644 index 5a83f2750ce..00000000000 --- a/lib/libarch/alpha/alpha_mmclock_init.c +++ /dev/null @@ -1,68 +0,0 @@ -/* $NetBSD: alpha_mmclock_init.c,v 1.1 1995/12/20 12:55:21 cgd Exp $ */ - -/* - * Copyright (c) 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * 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. - */ - -#include <sys/types.h> -#include <sys/fcntl.h> -#include <sys/mman.h> -#include <machine/sysarch.h> - -#include "libalpha.h" - -volatile struct alpha_timedata *alpha_mmclockdata; -u_long alpha_cycles_per_second; - -int __alpha_mmclock_init_failed; - -volatile struct alpha_timedata * -alpha_mmclock_init() -{ - int fd; - - if (alpha_mmclockdata != NULL) - return (alpha_mmclockdata); - - fd = open("/dev/mmclock", O_RDONLY, 0); - if (fd == -1) - goto fail; - - alpha_mmclockdata = (struct alpha_timedata *) - mmap(NULL, getpagesize(), PROT_READ, MAP_FILE, fd, 0); - close(fd); - if (alpha_mmclockdata == NULL) - goto fail; - - alpha_cycles_per_second = alpha_mmclockdata->td_cpc; - - __alpha_mmclock_init_failed = 0; - return (alpha_mmclockdata); - -fail: - __alpha_mmclock_init_failed = 1; - return (NULL); -} diff --git a/lib/libarch/alpha/gettimeofday.c b/lib/libarch/alpha/gettimeofday.c deleted file mode 100644 index 6ef009b37b4..00000000000 --- a/lib/libarch/alpha/gettimeofday.c +++ /dev/null @@ -1,82 +0,0 @@ -/* $NetBSD: gettimeofday.c,v 1.1 1995/12/20 12:56:06 cgd Exp $ */ - -/* - * Copyright (c) 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * 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. - */ - -#include <sys/types.h> -#include <sys/fcntl.h> -#include <sys/mman.h> -#include <sys/syscall.h> -#include <machine/sysarch.h> - -#include "libalpha.h" - -int -gettimeofday(tvp, tzp) - struct timeval *tvp; - struct timezone *tzp; -{ - u_long opcc, npcc, pccdiff; - static struct timeval lasttime; - - if (tzp == NULL && alpha_mmclockdata == NULL && - !__alpha_mmclock_init_failed) - alpha_mmclockdata = alpha_mmclock_init(); - if (tzp != NULL || alpha_mmclockdata == NULL) - return (syscall(SYS_gettimeofday, tvp, tzp)); - - if (tvp == NULL) - return 0; - - do { - tvp->tv_usec = alpha_mmclockdata->td_tv.tv_usec; - tvp->tv_sec = alpha_mmclockdata->td_tv.tv_sec; - opcc = alpha_mmclockdata->td_cc; - } while (tvp->tv_usec != alpha_mmclockdata->td_tv.tv_usec || - tvp->tv_sec != alpha_mmclockdata->td_tv.tv_sec); - - npcc = rpcc() & 0x00000000ffffffffUL; - if (npcc < opcc) - npcc += 0x0000000100000000UL; - pccdiff = npcc - opcc; - - tvp->tv_usec += (pccdiff * 1000000) / alpha_cycles_per_second; - if (tvp->tv_usec > 1000000) { - tvp->tv_sec++; - tvp->tv_usec -= 1000000; - } - - if ((tvp->tv_sec == lasttime.tv_sec && - tvp->tv_usec <= lasttime.tv_usec) && - (tvp->tv_usec = lasttime.tv_usec + 1) > 1000000) { - tvp->tv_sec++; - tvp->tv_usec -= 1000000; - } - - lasttime = *tvp; - return 0; -} diff --git a/lib/libarch/alpha/libalpha.h b/lib/libarch/alpha/libalpha.h deleted file mode 100644 index 358f2ec3cbe..00000000000 --- a/lib/libarch/alpha/libalpha.h +++ /dev/null @@ -1,30 +0,0 @@ -/* $NetBSD: libalpha.h,v 1.1 1995/12/20 12:56:44 cgd Exp $ */ - -/* - * Copyright (c) 1995 Carnegie-Mellon University. - * All rights reserved. - * - * Author: Chris G. Demetriou - * - * 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. - */ - -extern int __alpha_mmclock_init_failed; diff --git a/lib/libc/arch/ns32k/gen/Makefile.inc b/lib/libc/arch/ns32k/gen/Makefile.inc index ed6ccce6f18..01633096cf5 100644 --- a/lib/libc/arch/ns32k/gen/Makefile.inc +++ b/lib/libc/arch/ns32k/gen/Makefile.inc @@ -1,5 +1,7 @@ -# $NetBSD: Makefile.inc,v 1.4 1995/05/03 03:25:11 phil Exp $ +# $OpenBSD: Makefile.inc,v 1.2 1996/04/21 23:38:37 deraadt Exp $ +# $NetBSD: Makefile.inc,v 1.5 1996/04/05 00:23:05 phil Exp $ SRCS+= __main.c _setjmp.S alloca.S fabs.S frexp.S infinity.c isinf.c SRCS+= ldexp.S modf.S setjmp.S sigsetjmp.S -SRCS+= flt_rounds.c fpgetround.c fpsetround.c +SRCS+= flt_rounds.c fpgetmask.c fpgetround.c fpgetsticky.c fpsetmask.c \ + fpsetround.c fpsetsticky.c diff --git a/lib/libc/arch/ns32k/gen/fpgetmask.c b/lib/libc/arch/ns32k/gen/fpgetmask.c new file mode 100644 index 00000000000..64b26fe3977 --- /dev/null +++ b/lib/libc/arch/ns32k/gen/fpgetmask.c @@ -0,0 +1,21 @@ +/* $OpenBSD: fpgetmask.c,v 1.1 1996/04/21 23:38:40 deraadt Exp $ */ + +/* + * Written by J.T. Conklin, Apr 10, 1995 + * Public domain. + */ + +#include <ieeefp.h> +#include <machine/cpufunc.h> +#include <machine/fpu.h> + +fp_except +fpgetmask() +{ + fp_except x; + fp_except ebits = FPC_IEN | FPC_OVE | FPC_IVE | FPC_DZE | FPC_UNDE; + + sfsr(x); + + return x & ebits; +} diff --git a/lib/libc/arch/ns32k/gen/fpgetsticky.c b/lib/libc/arch/ns32k/gen/fpgetsticky.c new file mode 100644 index 00000000000..86771541ab6 --- /dev/null +++ b/lib/libc/arch/ns32k/gen/fpgetsticky.c @@ -0,0 +1,27 @@ +/* $OpenBSD: fpgetsticky.c,v 1.1 1996/04/21 23:38:41 deraadt Exp $ */ + +/* + * Written by J.T. Conklin, Apr 11, 1995 + * Public domain. + */ + +#include <ieeefp.h> +#include <machine/cpufunc.h> +#include <machine/fpu.h> + +fp_except +fpgetsticky() +{ + fp_except x; + fp_except ebits = FPC_IEN | FPC_OVE | FPC_IVE | FPC_DZE | FPC_UNDE; + + sfsr(x); + /* Map FPC_UF to soft underflow enable */ + if (x & FPC_UF) + x |= FPC_UNDE << 1; + else + x &= ~(FPC_UNDE << 1); + x >>= 1; + + return x & ebits; +} diff --git a/lib/libc/arch/ns32k/gen/fpsetmask.c b/lib/libc/arch/ns32k/gen/fpsetmask.c new file mode 100644 index 00000000000..34c4034c10d --- /dev/null +++ b/lib/libc/arch/ns32k/gen/fpsetmask.c @@ -0,0 +1,29 @@ +/* $OpenBSD: fpsetmask.c,v 1.1 1996/04/21 23:38:44 deraadt Exp $ */ + +/* + * Written by J.T. Conklin, Apr 10, 1995 + * Public domain. + */ + +#include <ieeefp.h> +#include <machine/cpufunc.h> +#include <machine/fpu.h> + +fp_except +fpsetmask(mask) + fp_except mask; +{ + fp_except old; + fp_except new; + fp_except ebits = FPC_IEN | FPC_OVE | FPC_IVE | FPC_DZE | FPC_UNDE; + + sfsr(old); + + new = old; + new &= ~ebits; + new |= mask & ebits; + + lfsr(new); + + return old & ebits; +} diff --git a/lib/libc/arch/ns32k/gen/fpsetsticky.c b/lib/libc/arch/ns32k/gen/fpsetsticky.c new file mode 100644 index 00000000000..1bfc6ff763b --- /dev/null +++ b/lib/libc/arch/ns32k/gen/fpsetsticky.c @@ -0,0 +1,42 @@ +/* $OpenBSD: fpsetsticky.c,v 1.1 1996/04/21 23:38:47 deraadt Exp $ */ + +/* + * Written by J.T. Conklin, Apr 10, 1995 + * Public domain. + */ + +#include <ieeefp.h> +#include <machine/cpufunc.h> +#include <machine/fpu.h> + +fp_except +fpsetsticky(sticky) + fp_except sticky; +{ + fp_except old; + fp_except new; + fp_except ebits = FPC_IEN | FPC_OVE | FPC_IVE | FPC_DZE | FPC_UEN | FPC_UNDE; + + if (sticky & FPC_UNDE) { + sticky |= FPC_UEN; + sticky &= ~FPC_UNDE; + } + + sfsr(old); + + new = old; + new &= ebits; + new |= (sticky & ebits) << 1; + + lfsr(new); + + /* Map FPC_UF to soft underflow enable */ + if (old & FPC_UF) { + old |= FPC_UNDE << 1; + old &= FPC_UF; + } else + old &= ~(FPC_UNDE << 1); + old >>= 1; + + return old & ebits; +} diff --git a/lib/libc/arch/ns32k/gen/infinity.c b/lib/libc/arch/ns32k/gen/infinity.c index 39c4979b3f5..7033c6485f8 100644 --- a/lib/libc/arch/ns32k/gen/infinity.c +++ b/lib/libc/arch/ns32k/gen/infinity.c @@ -1,5 +1,7 @@ +/* $OpenBSD: infinity.c,v 1.2 1996/04/21 23:38:49 deraadt Exp $ */ + #ifndef lint -static char rcsid[] = "$Id: infinity.c,v 1.1 1995/10/18 08:41:37 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: infinity.c,v 1.2 1996/04/21 23:38:49 deraadt Exp $"; #endif /* not lint */ /* infinity.c */ @@ -7,4 +9,4 @@ static char rcsid[] = "$Id: infinity.c,v 1.1 1995/10/18 08:41:37 deraadt Exp $"; #include <math.h> /* bytes for +Infinity on a ns32k */ -char __infinity[] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0x7f }; +char __infinity[] = { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f }; diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc index d980d3e0746..bdbc4b2fb1d 100644 --- a/lib/libc/gen/Makefile.inc +++ b/lib/libc/gen/Makefile.inc @@ -1,11 +1,12 @@ -# $NetBSD: Makefile.inc,v 1.70 1995/04/25 00:06:17 jtc Exp $ +# $OpenBSD: Makefile.inc,v 1.2 1996/04/21 23:39:01 deraadt Exp $ +# $NetBSD: Makefile.inc,v 1.71 1996/04/15 23:44:53 jtc Exp $ # @(#)Makefile.inc 8.3 (Berkeley) 4/16/94 # gen sources .PATH: ${.CURDIR}/arch/${MACHINE_ARCH}/gen ${.CURDIR}/gen SRCS+= alarm.c assert.c clock.c closedir.c confstr.c ctermid.c \ - ctype_.c daemon.c devname.c disklabel.c err.c errlist.c \ + ctype_.c daemon.c devname.c disklabel.c err.c errx.c errlist.c \ errno.c exec.c fnmatch.c fstab.c ftok.c fts.c getbsize.c getcap.c \ getcwd.c getdomainname.c getgrent.c getgrouplist.c gethostname.c \ getloadavg.c getlogin.c getmntinfo.c getnetgrent.c getpagesize.c \ @@ -17,7 +18,7 @@ SRCS+= alarm.c assert.c clock.c closedir.c confstr.c ctermid.c \ sigsetops.c sleep.c sysconf.c sysctl.c syslog.c telldir.c \ time.c times.c timezone.c tolower_.c ttyname.c ttyslot.c toupper_.c \ ualarm.c uname.c unvis.c usleep.c utime.c valloc.c vis.c wait.c \ - wait3.c waitpid.c + wait3.c waitpid.c warn.c warnx.c vwarn.c vwarnx.c verr.c verrx.c # indirect reference stubs, to be removed soon. SRCS+= _err.c _errx.c _sys_errlist.c _sys_nerr.c _sys_siglist.c \ diff --git a/lib/libc/gen/_err.c b/lib/libc/gen/_err.c index 60f679dfa71..032ee4b1bfd 100644 --- a/lib/libc/gen/_err.c +++ b/lib/libc/gen/_err.c @@ -1,3 +1,5 @@ +/* $OpenBSD: _err.c,v 1.2 1996/04/21 23:39:04 deraadt Exp $ */ + /* * J.T. Conklin, December 12, 1994 * Public Domain @@ -10,13 +12,6 @@ __indr_reference(_err, err); #else #define _err err -#define _errx errx -#define _warn warn -#define _warnx warnx -#define _verr verr -#define _verrx verrx -#define _vwarn vwarn -#define _vwarnx vwarnx #define rcsid _rcsid #include "err.c" diff --git a/lib/libc/gen/_errx.c b/lib/libc/gen/_errx.c index 6b03fbaa60a..739ed17ec60 100644 --- a/lib/libc/gen/_errx.c +++ b/lib/libc/gen/_errx.c @@ -1,3 +1,5 @@ +/* $OpenBSD: _errx.c,v 1.2 1996/04/21 23:39:05 deraadt Exp $ */ + /* * J.T. Conklin, December 12, 1994 * Public Domain @@ -7,4 +9,10 @@ #ifdef __indr_reference __indr_reference(_errx, errx); +#else + +#define _errx errx +#define rcsid _rcsid +#include "errx.c" + #endif diff --git a/lib/libc/gen/_verr.c b/lib/libc/gen/_verr.c index b747c98c41c..3ff3d8a5fdc 100644 --- a/lib/libc/gen/_verr.c +++ b/lib/libc/gen/_verr.c @@ -1,3 +1,5 @@ +/* $OpenBSD: _verr.c,v 1.2 1996/04/21 23:39:07 deraadt Exp $ */ + /* * J.T. Conklin, December 12, 1994 * Public Domain @@ -7,4 +9,10 @@ #ifdef __indr_reference __indr_reference(_verr, verr); +#else + +#define _verr verr +#define rcsid _rcsid +#include "verr.c" + #endif diff --git a/lib/libc/gen/_verrx.c b/lib/libc/gen/_verrx.c index ff8342d512f..5d2acd4bdfc 100644 --- a/lib/libc/gen/_verrx.c +++ b/lib/libc/gen/_verrx.c @@ -1,3 +1,5 @@ +/* $OpenBSD: _verrx.c,v 1.2 1996/04/21 23:39:08 deraadt Exp $ */ + /* * J.T. Conklin, December 12, 1994 * Public Domain @@ -7,4 +9,10 @@ #ifdef __indr_reference __indr_reference(_verrx, verrx); +#else + +#define _verrx verrx +#define rcsid _rcsid +#include "verrx.c" + #endif diff --git a/lib/libc/gen/_vwarn.c b/lib/libc/gen/_vwarn.c index 11d4ff6a5fe..b8fcf397622 100644 --- a/lib/libc/gen/_vwarn.c +++ b/lib/libc/gen/_vwarn.c @@ -1,3 +1,5 @@ +/* $OpenBSD: _vwarn.c,v 1.2 1996/04/21 23:39:10 deraadt Exp $ */ + /* * J.T. Conklin, December 12, 1994 * Public Domain @@ -7,4 +9,10 @@ #ifdef __indr_reference __indr_reference(_vwarn, vwarn); +#else + +#define _vwarn vwarn +#define rcsid _rcsid +#include "vwarn.c" + #endif diff --git a/lib/libc/gen/_vwarnx.c b/lib/libc/gen/_vwarnx.c index 463ce58ce80..532a93b57c6 100644 --- a/lib/libc/gen/_vwarnx.c +++ b/lib/libc/gen/_vwarnx.c @@ -1,3 +1,5 @@ +/* $OpenBSD: _vwarnx.c,v 1.2 1996/04/21 23:39:12 deraadt Exp $ */ + /* * J.T. Conklin, December 12, 1994 * Public Domain @@ -7,4 +9,10 @@ #ifdef __indr_reference __indr_reference(_vwarnx, vwarnx); +#else + +#define _vwarnx vwarnx +#define rcsid _rcsid +#include "vwarnx.c" + #endif diff --git a/lib/libc/gen/_warn.c b/lib/libc/gen/_warn.c index 4e42eaf31bb..9776e82379d 100644 --- a/lib/libc/gen/_warn.c +++ b/lib/libc/gen/_warn.c @@ -1,3 +1,5 @@ +/* $OpenBSD: _warn.c,v 1.2 1996/04/21 23:39:14 deraadt Exp $ */ + /* * J.T. Conklin, December 12, 1994 * Public Domain @@ -7,4 +9,10 @@ #ifdef __indr_reference __indr_reference(_warn, warn); +#else + +#define _warn warn +#define rcsid _rcsid +#include "warn.c" + #endif diff --git a/lib/libc/gen/_warnx.c b/lib/libc/gen/_warnx.c index 74b9715dcba..007e41d573a 100644 --- a/lib/libc/gen/_warnx.c +++ b/lib/libc/gen/_warnx.c @@ -1,3 +1,5 @@ +/* $OpenBSD: _warnx.c,v 1.2 1996/04/21 23:39:15 deraadt Exp $ */ + /* * J.T. Conklin, December 12, 1994 * Public Domain @@ -7,4 +9,10 @@ #ifdef __indr_reference __indr_reference(_warnx, warnx); +#else + +#define _warnx warnx +#define rcsid _rcsid +#include "warnx.c" + #endif diff --git a/lib/libc/gen/err.c b/lib/libc/gen/err.c index bc825899183..094ea952a98 100644 --- a/lib/libc/gen/err.c +++ b/lib/libc/gen/err.c @@ -1,4 +1,5 @@ -/* $NetBSD: err.c,v 1.12 1995/02/25 17:19:26 cgd Exp $ */ +/* $OpenBSD: err.c,v 1.2 1996/04/21 23:39:17 deraadt Exp $ */ +/* $NetBSD: err.c,v 1.13 1996/04/15 23:45:29 jtc Exp $ */ /*- * Copyright (c) 1993 @@ -37,15 +38,11 @@ #if 0 static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 6/4/93"; #else -static char rcsid[] = "$NetBSD: err.c,v 1.12 1995/02/25 17:19:26 cgd Exp $"; +static char rcsid[] = "$NetBSD: err.c,v 1.13 1996/04/15 23:45:29 jtc Exp $"; #endif #endif /* LIBC_SCCS and not lint */ #include <err.h> -#include <errno.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> #ifdef __STDC__ #include <stdarg.h> @@ -53,26 +50,6 @@ static char rcsid[] = "$NetBSD: err.c,v 1.12 1995/02/25 17:19:26 cgd Exp $"; #include <varargs.h> #endif -extern char *__progname; /* Program name, from crt0. */ - -__dead void -_verr(eval, fmt, ap) - int eval; - const char *fmt; - va_list ap; -{ - int sverrno; - - sverrno = errno; - (void)fprintf(stderr, "%s: ", __progname); - if (fmt != NULL) { - (void)vfprintf(stderr, fmt, ap); - (void)fprintf(stderr, ": "); - } - (void)fprintf(stderr, "%s\n", strerror(sverrno)); - exit(eval); -} - __dead void #ifdef __STDC__ _err(int eval, const char *fmt, ...) @@ -95,109 +72,3 @@ _err(va_alist) _verr(eval, fmt, ap); va_end(ap); } - -__dead void -_verrx(eval, fmt, ap) - int eval; - const char *fmt; - va_list ap; -{ - (void)fprintf(stderr, "%s: ", __progname); - if (fmt != NULL) - (void)vfprintf(stderr, fmt, ap); - (void)fprintf(stderr, "\n"); - exit(eval); -} - -__dead void -#if __STDC__ -_errx(int eval, const char *fmt, ...) -#else -_errx(va_alist) - va_dcl -#endif -{ - va_list ap; -#if __STDC__ - va_start(ap, fmt); -#else - int eval; - const char *fmt; - - va_start(ap); - eval = va_arg(ap, int); - fmt = va_arg(ap, const char *); -#endif - _verrx(eval, fmt, ap); - va_end(ap); -} - - -void -_vwarn(fmt, ap) - const char *fmt; - va_list ap; -{ - int sverrno; - - sverrno = errno; - (void)fprintf(stderr, "%s: ", __progname); - if (fmt != NULL) { - (void)vfprintf(stderr, fmt, ap); - (void)fprintf(stderr, ": "); - } - (void)fprintf(stderr, "%s\n", strerror(sverrno)); -} - -void -#if __STDC__ -_warn(const char *fmt, ...) -#else -_warn(va_alist) - va_dcl -#endif -{ - va_list ap; -#if __STDC__ - va_start(ap, fmt); -#else - const char *fmt; - - va_start(ap); - fmt = va_arg(ap, const char *); -#endif - _vwarn(fmt, ap); - va_end(ap); -} - -void -_vwarnx(fmt, ap) - const char *fmt; - va_list ap; -{ - (void)fprintf(stderr, "%s: ", __progname); - if (fmt != NULL) - (void)vfprintf(stderr, fmt, ap); - (void)fprintf(stderr, "\n"); -} - -void -#ifdef __STDC__ -_warnx(const char *fmt, ...) -#else -_warnx(va_alist) - va_dcl -#endif -{ - va_list ap; -#ifdef __STDC__ - va_start(ap, fmt); -#else - const char *fmt; - - va_start(ap); - fmt = va_arg(ap, const char *); -#endif - _vwarnx(fmt, ap); - va_end(ap); -} diff --git a/lib/libc/gen/errx.c b/lib/libc/gen/errx.c new file mode 100644 index 00000000000..7f9dd6a38c3 --- /dev/null +++ b/lib/libc/gen/errx.c @@ -0,0 +1,74 @@ +/* $OpenBSD: errx.c,v 1.1 1996/04/21 23:39:18 deraadt Exp $ */ +/* $NetBSD: errx.c,v 1.1 1996/04/15 23:45:32 jtc 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +#if 0 +static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 6/4/93"; +#else +static char rcsid[] = "$NetBSD: errx.c,v 1.1 1996/04/15 23:45:32 jtc Exp $"; +#endif +#endif /* LIBC_SCCS and not lint */ + +#include <err.h> + +#ifdef __STDC__ +#include <stdarg.h> +#else +#include <varargs.h> +#endif + +__dead void +#if __STDC__ +_errx(int eval, const char *fmt, ...) +#else +_errx(va_alist) + va_dcl +#endif +{ + va_list ap; +#if __STDC__ + va_start(ap, fmt); +#else + int eval; + const char *fmt; + + va_start(ap); + eval = va_arg(ap, int); + fmt = va_arg(ap, const char *); +#endif + _verrx(eval, fmt, ap); + va_end(ap); +} diff --git a/lib/libc/gen/fstab.c b/lib/libc/gen/fstab.c index cc131dd54d7..bc1e3646d0f 100644 --- a/lib/libc/gen/fstab.c +++ b/lib/libc/gen/fstab.c @@ -1,4 +1,5 @@ -/* $NetBSD: fstab.c,v 1.7 1995/02/27 04:34:44 cgd Exp $ */ +/* $OpenBSD: fstab.c,v 1.2 1996/04/21 23:39:19 deraadt Exp $ */ +/* $NetBSD: fstab.c,v 1.8 1996/04/03 19:48:56 jtc Exp $ */ /* * Copyright (c) 1980, 1988, 1993 @@ -37,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)fstab.c 8.1 (Berkeley) 6/4/93"; #else -static char rcsid[] = "$NetBSD: fstab.c,v 1.7 1995/02/27 04:34:44 cgd Exp $"; +static char rcsid[] = "$NetBSD: fstab.c,v 1.8 1996/04/03 19:48:56 jtc Exp $"; #endif #endif /* LIBC_SCCS and not lint */ @@ -53,10 +54,10 @@ static char rcsid[] = "$NetBSD: fstab.c,v 1.7 1995/02/27 04:34:44 cgd Exp $"; static FILE *_fs_fp; static struct fstab _fs_fstab; -static error __P((int)); -static fstabscan __P((void)); +static void error __P((int)); +static int fstabscan __P((void)); -static +static int fstabscan() { register char *cp; @@ -176,6 +177,7 @@ getfsfile(name) return((struct fstab *)NULL); } +int setfsent() { if (_fs_fp) { @@ -197,7 +199,7 @@ endfsent() } } -static +static void error(err) int err; { diff --git a/lib/libc/gen/gethostname.3 b/lib/libc/gen/gethostname.3 index ff8717eb84a..63f4dd0e443 100644 --- a/lib/libc/gen/gethostname.3 +++ b/lib/libc/gen/gethostname.3 @@ -1,4 +1,5 @@ -.\" $NetBSD: gethostname.3,v 1.3 1996/02/11 16:15:40 neil Exp $ +.\" $OpenBSD: gethostname.3,v 1.3 1996/04/21 23:39:21 deraadt Exp $ +.\" $NetBSD: gethostname.3,v 1.4 1996/04/08 20:56:38 jtc Exp $ .\" .\" Copyright (c) 1983, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -84,8 +85,8 @@ invalid address. The caller tried to set the hostname and was not the super-user. .El .Sh SEE ALSO -.Xr sysctl 3 -.Xr gethostid 3 +.Xr sysctl 3 , +.Xr gethostid 3 , .Xr sysctl 8 .Sh BUGS Host names are limited to diff --git a/lib/libc/gen/getttyent.3 b/lib/libc/gen/getttyent.3 index 94adb769aff..39c2e04f6e4 100644 --- a/lib/libc/gen/getttyent.3 +++ b/lib/libc/gen/getttyent.3 @@ -1,4 +1,5 @@ -.\" $NetBSD: getttyent.3,v 1.6 1995/02/27 04:13:16 cgd Exp $ +.\" $OpenBSD: getttyent.3,v 1.2 1996/04/21 23:39:22 deraadt Exp $ +.\" $NetBSD: getttyent.3,v 1.7 1996/03/17 19:36:53 christos Exp $ .\" .\" Copyright (c) 1989, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -104,6 +105,9 @@ Allow users with a uid of 0 to login on this terminal. .It Dv TTY_LOCAL If the terminal port's driver supports it, cause the line to be treated as ``local.'' +.It Dv TTY_MDMBUF +If the terminal port's driver supports it, use +DTR/DCD hardware flow control on the line by default. .It Dv TTY_RTSCTS If the terminal port's driver supports it, use full-duplex RTS/CTS hardware flow control on the line diff --git a/lib/libc/gen/setmode.c b/lib/libc/gen/setmode.c index 0d6eb4eeb4d..37c111a21c9 100644 --- a/lib/libc/gen/setmode.c +++ b/lib/libc/gen/setmode.c @@ -1,4 +1,5 @@ -/* $NetBSD: setmode.c,v 1.12 1995/03/23 19:51:13 jtc Exp $ */ +/* $OpenBSD: setmode.c,v 1.3 1996/04/21 23:39:25 deraadt Exp $ */ +/* $NetBSD: setmode.c,v 1.13 1996/04/03 19:49:01 jtc Exp $ */ /* * Copyright (c) 1989, 1993, 1994 @@ -40,7 +41,7 @@ #if 0 static char sccsid[] = "@(#)setmode.c 8.2 (Berkeley) 3/25/94"; #else -static char rcsid[] = "$NetBSD: setmode.c,v 1.12 1995/03/23 19:51:13 jtc Exp $"; +static char rcsid[] = "$NetBSD: setmode.c,v 1.13 1996/04/03 19:49:01 jtc Exp $"; #endif #endif /* LIBC_SCCS and not lint */ diff --git a/lib/libc/gen/siginterrupt.c b/lib/libc/gen/siginterrupt.c index a8b0c25e730..cc075f49859 100644 --- a/lib/libc/gen/siginterrupt.c +++ b/lib/libc/gen/siginterrupt.c @@ -1,4 +1,5 @@ -/* $NetBSD: siginterrupt.c,v 1.6 1995/03/04 01:56:00 cgd Exp $ */ +/* $OpenBSD: siginterrupt.c,v 1.2 1996/04/21 23:39:27 deraadt Exp $ */ +/* $NetBSD: siginterrupt.c,v 1.7 1996/04/03 19:49:03 jtc Exp $ */ /* * Copyright (c) 1989, 1993 @@ -37,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)siginterrupt.c 8.1 (Berkeley) 6/4/93"; #else -static char rcsid[] = "$NetBSD: siginterrupt.c,v 1.6 1995/03/04 01:56:00 cgd Exp $"; +static char rcsid[] = "$NetBSD: siginterrupt.c,v 1.7 1996/04/03 19:49:03 jtc Exp $"; #endif #endif /* LIBC_SCCS and not lint */ @@ -47,6 +48,7 @@ static char rcsid[] = "$NetBSD: siginterrupt.c,v 1.6 1995/03/04 01:56:00 cgd Exp * Set signal state to prevent restart of system calls * after an instance of the indicated signal. */ +int siginterrupt(sig, flag) int sig, flag; { diff --git a/lib/libc/gen/signal.3 b/lib/libc/gen/signal.3 index dd9c82b255b..260d4945760 100644 --- a/lib/libc/gen/signal.3 +++ b/lib/libc/gen/signal.3 @@ -1,4 +1,5 @@ -.\" $NetBSD: signal.3,v 1.5 1995/02/27 05:51:12 cgd Exp $ +.\" $OpenBSD: signal.3,v 1.2 1996/04/21 23:39:28 deraadt Exp $ +.\" $NetBSD: signal.3,v 1.6 1996/03/26 02:05:55 jtc Exp $ .\" .\" Copyright (c) 1980, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -42,11 +43,11 @@ .Sh SYNOPSIS .Fd #include <signal.h> .Ft void -.Fn *signal sig func\*(lp\*(rp -.Ft void -.\" can not do this with .Fn yet +.\" can not do this with just .Fn yet .br -\*(lp\|\*(fN*func\*(rp\*(lp\|\*(rp\fR +.Po +.Fn *signal "int sig" "void (*func)()" +.Pc Ns \*(lp\*(rp .Sh DESCRIPTION This .Fn signal diff --git a/lib/libc/gen/sysctl.3 b/lib/libc/gen/sysctl.3 index 1c28f23dbe1..07973bc965f 100644 --- a/lib/libc/gen/sysctl.3 +++ b/lib/libc/gen/sysctl.3 @@ -1,3 +1,4 @@ +.\" $OpenBSD: sysctl.3,v 1.2 1996/04/21 23:39:30 deraadt Exp $ .\" $NetBSD: sysctl.3,v 1.7 1995/09/30 07:03:54 thorpej Exp $ .\" .\" Copyright (c) 1993 @@ -40,6 +41,7 @@ .Nm sysctl .Nd get or set system information .Sh SYNOPSIS +.Fd #include <sys/param.h> .Fd #include <sys/sysctl.h> .Ft int .Fn sysctl "int *name" "u_int namelen" "void *oldp" "size_t *oldlenp" "void *newp" "size_t newlen" diff --git a/lib/libc/gen/verr.c b/lib/libc/gen/verr.c new file mode 100644 index 00000000000..fba24377e51 --- /dev/null +++ b/lib/libc/gen/verr.c @@ -0,0 +1,75 @@ +/* $OpenBSD: verr.c,v 1.1 1996/04/21 23:39:32 deraadt Exp $ */ +/* $NetBSD: verr.c,v 1.1 1996/04/15 23:45:35 jtc 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +#if 0 +static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 6/4/93"; +#else +static char rcsid[] = "$NetBSD: verr.c,v 1.1 1996/04/15 23:45:35 jtc Exp $"; +#endif +#endif /* LIBC_SCCS and not lint */ + +#include <err.h> +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +#ifdef __STDC__ +#include <stdarg.h> +#else +#include <varargs.h> +#endif + +extern char *__progname; /* Program name, from crt0. */ + +__dead void +_verr(eval, fmt, ap) + int eval; + const char *fmt; + va_list ap; +{ + int sverrno; + + sverrno = errno; + (void)fprintf(stderr, "%s: ", __progname); + if (fmt != NULL) { + (void)vfprintf(stderr, fmt, ap); + (void)fprintf(stderr, ": "); + } + (void)fprintf(stderr, "%s\n", strerror(sverrno)); + exit(eval); +} diff --git a/lib/libc/gen/verrx.c b/lib/libc/gen/verrx.c new file mode 100644 index 00000000000..23a4e4e417a --- /dev/null +++ b/lib/libc/gen/verrx.c @@ -0,0 +1,68 @@ +/* $OpenBSD: verrx.c,v 1.1 1996/04/21 23:39:33 deraadt Exp $ */ +/* $NetBSD: verrx.c,v 1.1 1996/04/15 23:45:36 jtc 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +#if 0 +static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 6/4/93"; +#else +static char rcsid[] = "$NetBSD: verrx.c,v 1.1 1996/04/15 23:45:36 jtc Exp $"; +#endif +#endif /* LIBC_SCCS and not lint */ + +#include <err.h> +#include <stdio.h> +#include <stdlib.h> + +#ifdef __STDC__ +#include <stdarg.h> +#else +#include <varargs.h> +#endif + +extern char *__progname; /* Program name, from crt0. */ + +__dead void +_verrx(eval, fmt, ap) + int eval; + const char *fmt; + va_list ap; +{ + (void)fprintf(stderr, "%s: ", __progname); + if (fmt != NULL) + (void)vfprintf(stderr, fmt, ap); + (void)fprintf(stderr, "\n"); + exit(eval); +} diff --git a/lib/libc/gen/vwarn.c b/lib/libc/gen/vwarn.c new file mode 100644 index 00000000000..7c4c8a2a78d --- /dev/null +++ b/lib/libc/gen/vwarn.c @@ -0,0 +1,72 @@ +/* $OpenBSD: vwarn.c,v 1.1 1996/04/21 23:39:34 deraadt Exp $ */ +/* $NetBSD: vwarn.c,v 1.1 1996/04/15 23:45:38 jtc 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +#if 0 +static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 6/4/93"; +#else +static char rcsid[] = "$NetBSD: vwarn.c,v 1.1 1996/04/15 23:45:38 jtc Exp $"; +#endif +#endif /* LIBC_SCCS and not lint */ + +#include <err.h> +#include <errno.h> +#include <stdio.h> +#include <string.h> + +#ifdef __STDC__ +#include <stdarg.h> +#else +#include <varargs.h> +#endif + +extern char *__progname; /* Program name, from crt0. */ + +void +_vwarn(fmt, ap) + const char *fmt; + va_list ap; +{ + int sverrno; + + sverrno = errno; + (void)fprintf(stderr, "%s: ", __progname); + if (fmt != NULL) { + (void)vfprintf(stderr, fmt, ap); + (void)fprintf(stderr, ": "); + } + (void)fprintf(stderr, "%s\n", strerror(sverrno)); +} diff --git a/lib/libc/gen/vwarnx.c b/lib/libc/gen/vwarnx.c new file mode 100644 index 00000000000..b1d16a688d8 --- /dev/null +++ b/lib/libc/gen/vwarnx.c @@ -0,0 +1,65 @@ +/* $OpenBSD: vwarnx.c,v 1.1 1996/04/21 23:39:35 deraadt Exp $ */ +/* $NetBSD: vwarnx.c,v 1.1 1996/04/15 23:45:40 jtc 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +#if 0 +static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 6/4/93"; +#else +static char rcsid[] = "$NetBSD: vwarnx.c,v 1.1 1996/04/15 23:45:40 jtc Exp $"; +#endif +#endif /* LIBC_SCCS and not lint */ + +#include <err.h> +#include <stdio.h> + +#ifdef __STDC__ +#include <stdarg.h> +#else +#include <varargs.h> +#endif + +extern char *__progname; /* Program name, from crt0. */ + +void +_vwarnx(fmt, ap) + const char *fmt; + va_list ap; +{ + (void)fprintf(stderr, "%s: ", __progname); + if (fmt != NULL) + (void)vfprintf(stderr, fmt, ap); + (void)fprintf(stderr, "\n"); +} diff --git a/lib/libc/gen/warn.c b/lib/libc/gen/warn.c new file mode 100644 index 00000000000..4f0fa6f693e --- /dev/null +++ b/lib/libc/gen/warn.c @@ -0,0 +1,72 @@ +/* $OpenBSD: warn.c,v 1.1 1996/04/21 23:39:37 deraadt Exp $ */ +/* $NetBSD: warn.c,v 1.1 1996/04/15 23:45:42 jtc 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +#if 0 +static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 6/4/93"; +#else +static char rcsid[] = "$NetBSD: warn.c,v 1.1 1996/04/15 23:45:42 jtc Exp $"; +#endif +#endif /* LIBC_SCCS and not lint */ + +#include <err.h> + +#ifdef __STDC__ +#include <stdarg.h> +#else +#include <varargs.h> +#endif + +void +#ifdef __STDC__ +_warn(const char *fmt, ...) +#else +_warn(va_alist) + va_dcl +#endif +{ + va_list ap; +#if __STDC__ + va_start(ap, fmt); +#else + const char *fmt; + + va_start(ap); + fmt = va_arg(ap, const char *); +#endif + _vwarn(fmt, ap); + va_end(ap); +} diff --git a/lib/libc/gen/warnx.c b/lib/libc/gen/warnx.c new file mode 100644 index 00000000000..9b1e8d5a940 --- /dev/null +++ b/lib/libc/gen/warnx.c @@ -0,0 +1,72 @@ +/* $OpenBSD: warnx.c,v 1.1 1996/04/21 23:39:38 deraadt Exp $ */ +/* $NetBSD: warnx.c,v 1.1 1996/04/15 23:45:44 jtc 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. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +#if 0 +static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 6/4/93"; +#else +static char rcsid[] = "$NetBSD: warnx.c,v 1.1 1996/04/15 23:45:44 jtc Exp $"; +#endif +#endif /* LIBC_SCCS and not lint */ + +#include <err.h> + +#ifdef __STDC__ +#include <stdarg.h> +#else +#include <varargs.h> +#endif + +void +#ifdef __STDC__ +_warnx(const char *fmt, ...) +#else +_warnx(va_alist) + va_dcl +#endif +{ + va_list ap; +#ifdef __STDC__ + va_start(ap, fmt); +#else + const char *fmt; + + va_start(ap); + fmt = va_arg(ap, const char *); +#endif + _vwarnx(fmt, ap); + va_end(ap); +} |