Module Name: src
Committed By: christos
Date: Thu Jan 16 17:21:38 UTC 2014
Modified Files:
src/lib/libc: shlib_version
src/lib/libc/gen: Makefile.inc err.3 verr.c vwarn.c
Added Files:
src/lib/libc/gen: _errc.c _verrc.c _vwarnc.c _warnc.c errc.c verrc.c
vwarnc.c warnc.c
Log Message:
Add the {v,}{err,warn}c flavors, from FreeBSD.
To generate a diff of this commit:
cvs rdiff -u -r1.247 -r1.248 src/lib/libc/shlib_version
cvs rdiff -u -r1.185 -r1.186 src/lib/libc/gen/Makefile.inc
cvs rdiff -u -r0 -r1.1 src/lib/libc/gen/_errc.c src/lib/libc/gen/_verrc.c \
src/lib/libc/gen/_vwarnc.c src/lib/libc/gen/_warnc.c \
src/lib/libc/gen/errc.c src/lib/libc/gen/verrc.c \
src/lib/libc/gen/vwarnc.c src/lib/libc/gen/warnc.c
cvs rdiff -u -r1.20 -r1.21 src/lib/libc/gen/err.3
cvs rdiff -u -r1.15 -r1.16 src/lib/libc/gen/verr.c src/lib/libc/gen/vwarn.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/shlib_version
diff -u src/lib/libc/shlib_version:1.247 src/lib/libc/shlib_version:1.248
--- src/lib/libc/shlib_version:1.247 Tue Jan 14 12:20:57 2014
+++ src/lib/libc/shlib_version Thu Jan 16 12:21:38 2014
@@ -1,4 +1,4 @@
-# $NetBSD: shlib_version,v 1.247 2014/01/14 17:20:57 joerg Exp $
+# $NetBSD: shlib_version,v 1.248 2014/01/16 17:21:38 christos Exp $
# Remember to update distrib/sets/lists/base/shl.* when changing
#
# things we wish to do on next major version bump:
@@ -40,4 +40,4 @@
# - consolidate ownership with crt0.o and avoid common symbols
# - redo stdin/stdout/stderr to not require copy relocations
major=12
-minor=188
+minor=189
Index: src/lib/libc/gen/Makefile.inc
diff -u src/lib/libc/gen/Makefile.inc:1.185 src/lib/libc/gen/Makefile.inc:1.186
--- src/lib/libc/gen/Makefile.inc:1.185 Sat Nov 3 15:39:21 2012
+++ src/lib/libc/gen/Makefile.inc Thu Jan 16 12:21:38 2014
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile.inc,v 1.185 2012/11/03 19:39:21 christos Exp $
+# $NetBSD: Makefile.inc,v 1.186 2014/01/16 17:21:38 christos Exp $
# from: @(#)Makefile.inc 8.6 (Berkeley) 5/4/95
# gen sources
@@ -8,7 +8,7 @@ SRCS+= _errno.c alarm.c alphasort.c arc
closedir.c closefrom.c \
confstr.c ctermid.c ctype_.c daemon.c \
dehumanize_number.c devname.c dirname.c disklabel.c err.c errx.c \
- errlist.c errno.c execl.c execle.c execlp.c execv.c execvp.c \
+ errc.c errlist.c errno.c execl.c execle.c execlp.c execv.c execvp.c \
extattr.c fmtcheck.c fmtmsg.c fnmatch.c fstab.c ftok.c \
fts.c ftw.c getbsize.c getcap.c getcwd.c \
getdevmajor.c getdomainname.c getgrent.c \
@@ -32,11 +32,12 @@ SRCS+= _errno.c alarm.c alphasort.c arc
times.c toascii.c tolower_.c ttyname.c ttyslot.c toupper_.c ualarm.c \
ulimit.c uname.c unvis.c usleep.c utime.c utimens.c utmp.c \
utmpx.c valloc.c vis.c wait.c wait3.c waitpid.c warn.c warnx.c \
- vwarn.c vwarnx.c verr.c verrx.c wordexp.c
+ warnc.c vwarn.c vwarnx.c vwarnc.c verr.c verrx.c verrc.c wordexp.c
# indirect reference stubs, to be removed soon.
-SRCS+= _err.c _errx.c \
- _sysconf.c _verr.c _verrx.c _vwarn.c _vwarnx.c _warn.c _warnx.c
+SRCS+= _err.c _errx.c _errc.c \
+ _sysconf.c _verr.c _verrx.c _verrc.c _vwarn.c _vwarnx.c _vwarnc.c \
+ _warn.c _warnx.c _warnc.c
# uses alloca
COPTS.execvp.c = -Wno-stack-protector
@@ -96,7 +97,8 @@ MLINKS+=endutxent.3 getutxent.3 endutxen
endutxent.3 getutxline.3 endutxent.3 pututxline.3 \
endutxent.3 setutxent.3
MLINKS+=err.3 verr.3 err.3 errx.3 err.3 verrx.3 err.3 warn.3 err.3 vwarn.3 \
- err.3 warnx.3 err.3 vwarnx.3
+ err.3 warnx.3 err.3 vwarnx.3 err.3 errc.3 err.3 verrc.3 err.3 warnc.3 \
+ err.3 vwarnc.3
MLINKS+=exec.3 execl.3 exec.3 execle.3 exec.3 execlp.3 exec.3 execv.3 \
exec.3 execvp.3 exec.3 exect.3
MLINKS+=extattr_namespace_to_string.3 extattr_string_to_namespace.3 \
Index: src/lib/libc/gen/err.3
diff -u src/lib/libc/gen/err.3:1.20 src/lib/libc/gen/err.3:1.21
--- src/lib/libc/gen/err.3:1.20 Mon Mar 22 15:30:53 2010
+++ src/lib/libc/gen/err.3 Thu Jan 16 12:21:38 2014
@@ -1,4 +1,4 @@
-.\" $NetBSD: err.3,v 1.20 2010/03/22 19:30:53 joerg Exp $
+.\" $NetBSD: err.3,v 1.21 2014/01/16 17:21:38 christos Exp $
.\"
.\" Copyright (c) 1993
.\" The Regents of the University of California. All rights reserved.
@@ -29,7 +29,7 @@
.\"
.\" @(#)err.3 8.1 (Berkeley) 6/9/93
.\"
-.Dd March 21, 2001
+.Dd January 16, 2014
.Dt ERR 3
.Os
.Sh NAME
@@ -37,10 +37,14 @@
.Nm verr ,
.Nm errx ,
.Nm verrx ,
+.Nm errc ,
+.Nm verrc ,
.Nm warn ,
.Nm vwarn ,
.Nm warnx ,
-.Nm vwarnx
+.Nm vwarnx ,
+.Nm warnc ,
+.Nm vwarnc
.Nd formatted error messages
.Sh LIBRARY
.Lb libc
@@ -55,6 +59,10 @@
.Ft void
.Fn verrx "int status" "const char *fmt" "va_list args"
.Ft void
+.Fn errc "int status" "int code" "const char *fmt" "..."
+.Ft void
+.Fn verrc "int status" "int code" "const char *fmt" "va_list args"
+.Ft void
.Fn warn "const char *fmt" "..."
.Ft void
.Fn vwarn "const char *fmt" "va_list args"
@@ -62,6 +70,10 @@
.Fn warnx "const char *fmt" "..."
.Ft void
.Fn vwarnx "const char *fmt" "va_list args"
+.Ft void
+.Fn warnc "int code" "const char *fmt" "..."
+.Ft void
+.Fn vwarnc "int code" "const char *fmt" "va_list args"
.Sh DESCRIPTION
The
.Fn err
@@ -91,6 +103,17 @@ is not
.Dv NULL .
In all cases, the output is followed by a newline character.
The
+.Fn errc ,
+.Fn verrc ,
+.Fn warnc ,
+and
+.Fn vwarnc
+functions take an additional
+.Ar code
+argument to be used as the error number instead of using the global
+.Va errno
+variable.
+The
.Fn errx ,
.Fn verrx ,
.Fn warnx ,
@@ -151,6 +174,14 @@ and
.Fn warn
functions first appeared in
.Bx 4.4 .
+The
+.Fn errc
+and
+.Fn warnc
+functions first appeared in
+.Fx 3.0
+and
+.Nx 7.0 .
.Sh CAVEATS
It is important never to pass a string with user-supplied data as a
format without using
Index: src/lib/libc/gen/verr.c
diff -u src/lib/libc/gen/verr.c:1.15 src/lib/libc/gen/verr.c:1.16
--- src/lib/libc/gen/verr.c:1.15 Sun Jul 17 16:54:34 2011
+++ src/lib/libc/gen/verr.c Thu Jan 16 12:21:38 2014
@@ -1,8 +1,11 @@
-/* $NetBSD: verr.c,v 1.15 2011/07/17 20:54:34 joerg Exp $ */
+/* $NetBSD: verr.c,v 1.16 2014/01/16 17:21:38 christos Exp $ */
/*-
- * Copyright (c) 1993
- * The Regents of the University of California. All rights reserved.
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -12,21 +15,18 @@
* 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. 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.
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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 HAVE_NBTOOL_CONFIG_H
@@ -35,20 +35,12 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: verr.c,v 1.15 2011/07/17 20:54:34 joerg Exp $");
-#endif
+__RCSID("$NetBSD: verr.c,v 1.16 2014/01/16 17:21:38 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
#include <err.h>
#include <errno.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#ifdef __weak_alias
__weak_alias(verr, _verr)
@@ -58,15 +50,6 @@ __weak_alias(verr, _verr)
__dead void
verr(int eval, const char *fmt, va_list ap)
{
- int sverrno;
-
- sverrno = errno;
- (void)fprintf(stderr, "%s: ", getprogname());
- if (fmt != NULL) {
- (void)vfprintf(stderr, fmt, ap);
- (void)fprintf(stderr, ": ");
- }
- (void)fprintf(stderr, "%s\n", strerror(sverrno));
- exit(eval);
+ verrc(eval, errno, fmt, ap);
}
#endif
Index: src/lib/libc/gen/vwarn.c
diff -u src/lib/libc/gen/vwarn.c:1.15 src/lib/libc/gen/vwarn.c:1.16
--- src/lib/libc/gen/vwarn.c:1.15 Sun Jul 17 16:54:34 2011
+++ src/lib/libc/gen/vwarn.c Thu Jan 16 12:21:38 2014
@@ -1,8 +1,11 @@
-/* $NetBSD: vwarn.c,v 1.15 2011/07/17 20:54:34 joerg Exp $ */
+/* $NetBSD: vwarn.c,v 1.16 2014/01/16 17:21:38 christos Exp $ */
/*-
- * Copyright (c) 1993
- * The Regents of the University of California. All rights reserved.
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Christos Zoulas.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -12,21 +15,18 @@
* 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. 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.
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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 HAVE_NBTOOL_CONFIG_H
@@ -35,20 +35,12 @@
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
-#if 0
-static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 6/4/93";
-#else
-__RCSID("$NetBSD: vwarn.c,v 1.15 2011/07/17 20:54:34 joerg Exp $");
-#endif
+__RCSID("$NetBSD: vwarn.c,v 1.16 2014/01/16 17:21:38 christos Exp $");
#endif /* LIBC_SCCS and not lint */
#include "namespace.h"
#include <err.h>
#include <errno.h>
-#include <stdarg.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
#ifdef __weak_alias
__weak_alias(vwarn, _vwarn)
@@ -58,14 +50,6 @@ __weak_alias(vwarn, _vwarn)
void
vwarn(const char *fmt, va_list ap)
{
- int sverrno;
-
- sverrno = errno;
- (void)fprintf(stderr, "%s: ", getprogname());
- if (fmt != NULL) {
- (void)vfprintf(stderr, fmt, ap);
- (void)fprintf(stderr, ": ");
- }
- (void)fprintf(stderr, "%s\n", strerror(sverrno));
+ vwarnc(errno, fmt, ap);
}
#endif
Added files:
Index: src/lib/libc/gen/_errc.c
diff -u /dev/null src/lib/libc/gen/_errc.c:1.1
--- /dev/null Thu Jan 16 12:21:38 2014
+++ src/lib/libc/gen/_errc.c Thu Jan 16 12:21:38 2014
@@ -0,0 +1,30 @@
+/* $NetBSD: _errc.c,v 1.1 2014/01/16 17:21:38 christos Exp $ */
+
+/*
+ * J.T. Conklin, December 12, 1994
+ * Public Domain
+ */
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: _errc.c,v 1.1 2014/01/16 17:21:38 christos Exp $");
+#endif /* LIBC_SCCS and not lint */
+
+#if defined(__indr_reference)
+__indr_reference(_errc, errc)
+#else
+
+#include <stdarg.h>
+
+__dead void _verrc(int eval, int code, const char *, va_list);
+
+__dead void
+errc(int eval, int code, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ _verr(eval, code, fmt, ap);
+ va_end(ap);
+}
+#endif
Index: src/lib/libc/gen/_verrc.c
diff -u /dev/null src/lib/libc/gen/_verrc.c:1.1
--- /dev/null Thu Jan 16 12:21:38 2014
+++ src/lib/libc/gen/_verrc.c Thu Jan 16 12:21:38 2014
@@ -0,0 +1,27 @@
+/* $NetBSD: _verrc.c,v 1.1 2014/01/16 17:21:38 christos Exp $ */
+
+/*
+ * J.T. Conklin, December 12, 1994
+ * Public Domain
+ */
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: _verrc.c,v 1.1 2014/01/16 17:21:38 christos Exp $");
+#endif /* LIBC_SCCS and not lint */
+
+#include <stdarg.h>
+
+#if defined(__indr_reference)
+__indr_reference(_verrc, verrc)
+#else
+
+__dead void _verrc(int, int, const char *, va_list);
+
+void
+verrc(int eval, int code, const char *fmt, va_list ap)
+{
+ _verrc(eval, code, fmt, ap);
+}
+
+#endif
Index: src/lib/libc/gen/_vwarnc.c
diff -u /dev/null src/lib/libc/gen/_vwarnc.c:1.1
--- /dev/null Thu Jan 16 12:21:38 2014
+++ src/lib/libc/gen/_vwarnc.c Thu Jan 16 12:21:38 2014
@@ -0,0 +1,27 @@
+/* $NetBSD: _vwarnc.c,v 1.1 2014/01/16 17:21:38 christos Exp $ */
+
+/*
+ * J.T. Conklin, December 12, 1994
+ * Public Domain
+ */
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: _vwarnc.c,v 1.1 2014/01/16 17:21:38 christos Exp $");
+#endif /* LIBC_SCCS and not lint */
+
+#include <stdarg.h>
+
+#if defined(__indr_reference)
+__indr_reference(_vwarnc, vwarnc)
+#else
+
+void _vwarnc(int code, const char *, va_list);
+
+void
+vwarnc(int code, const char *fmt, va_list ap)
+{
+ _vwarnc(code, fmt, ap);
+}
+
+#endif
Index: src/lib/libc/gen/_warnc.c
diff -u /dev/null src/lib/libc/gen/_warnc.c:1.1
--- /dev/null Thu Jan 16 12:21:38 2014
+++ src/lib/libc/gen/_warnc.c Thu Jan 16 12:21:38 2014
@@ -0,0 +1,30 @@
+/* $NetBSD: _warnc.c,v 1.1 2014/01/16 17:21:38 christos Exp $ */
+
+/*
+ * J.T. Conklin, December 12, 1994
+ * Public Domain
+ */
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: _warnc.c,v 1.1 2014/01/16 17:21:38 christos Exp $");
+#endif /* LIBC_SCCS and not lint */
+
+#if defined(__indr_reference)
+__indr_reference(_warnc, warnc)
+#else
+
+#include <stdarg.h>
+
+void _vwarnc(int, const char *, va_list);
+
+void
+warnc(int code, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ _vwarnc(code, fmt, ap);
+ va_end(ap);
+}
+#endif
Index: src/lib/libc/gen/errc.c
diff -u /dev/null src/lib/libc/gen/errc.c:1.1
--- /dev/null Thu Jan 16 12:21:38 2014
+++ src/lib/libc/gen/errc.c Thu Jan 16 12:21:38 2014
@@ -0,0 +1,59 @@
+/* $NetBSD: errc.c,v 1.1 2014/01/16 17:21:38 christos 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. 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 HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+__RCSID("$NetBSD: errc.c,v 1.1 2014/01/16 17:21:38 christos Exp $");
+#endif /* LIBC_SCCS and not lint */
+
+#include "namespace.h"
+#include <err.h>
+#include <stdarg.h>
+
+#ifdef __weak_alias
+__weak_alias(errc, _errc)
+#endif
+
+#if !HAVE_ERR_H
+__dead void
+errc(int eval, int code, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ verrc(eval, code, fmt, ap);
+ va_end(ap);
+}
+#endif
Index: src/lib/libc/gen/verrc.c
diff -u /dev/null src/lib/libc/gen/verrc.c:1.1
--- /dev/null Thu Jan 16 12:21:38 2014
+++ src/lib/libc/gen/verrc.c Thu Jan 16 12:21:38 2014
@@ -0,0 +1,68 @@
+/* $NetBSD: verrc.c,v 1.1 2014/01/16 17:21:38 christos 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. 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 HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: verrc.c,v 1.1 2014/01/16 17:21:38 christos Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include "namespace.h"
+#include <err.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef __weak_alias
+__weak_alias(verrc, _verrc)
+#endif
+
+#if !HAVE_ERR_H
+__dead void
+verrc(int eval, int code, const char *fmt, va_list ap)
+{
+ (void)fprintf(stderr, "%s: ", getprogname());
+ if (fmt != NULL) {
+ (void)vfprintf(stderr, fmt, ap);
+ (void)fprintf(stderr, ": ");
+ }
+ (void)fprintf(stderr, "%s\n", strerror(code));
+ exit(eval);
+}
+#endif
Index: src/lib/libc/gen/vwarnc.c
diff -u /dev/null src/lib/libc/gen/vwarnc.c:1.1
--- /dev/null Thu Jan 16 12:21:38 2014
+++ src/lib/libc/gen/vwarnc.c Thu Jan 16 12:21:38 2014
@@ -0,0 +1,67 @@
+/* $NetBSD: vwarnc.c,v 1.1 2014/01/16 17:21:38 christos 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. 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 HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: vwarnc.c,v 1.1 2014/01/16 17:21:38 christos Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include "namespace.h"
+#include <err.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef __weak_alias
+__weak_alias(vwarnc, _vwarnc)
+#endif
+
+#if !HAVE_ERR_H
+void
+vwarnc(int code, const char *fmt, va_list ap)
+{
+ (void)fprintf(stderr, "%s: ", getprogname());
+ if (fmt != NULL) {
+ (void)vfprintf(stderr, fmt, ap);
+ (void)fprintf(stderr, ": ");
+ }
+ (void)fprintf(stderr, "%s\n", strerror(code));
+}
+#endif
Index: src/lib/libc/gen/warnc.c
diff -u /dev/null src/lib/libc/gen/warnc.c:1.1
--- /dev/null Thu Jan 16 12:21:38 2014
+++ src/lib/libc/gen/warnc.c Thu Jan 16 12:21:38 2014
@@ -0,0 +1,63 @@
+/* $NetBSD: warnc.c,v 1.1 2014/01/16 17:21:38 christos 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. 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 HAVE_NBTOOL_CONFIG_H
+#include "nbtool_config.h"
+#endif
+
+#include <sys/cdefs.h>
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 6/4/93";
+#else
+__RCSID("$NetBSD: warnc.c,v 1.1 2014/01/16 17:21:38 christos Exp $");
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+#include "namespace.h"
+#include <err.h>
+#include <stdarg.h>
+
+#ifdef __weak_alias
+__weak_alias(warnc, _warnc)
+#endif
+
+#if !HAVE_ERR_H
+void
+warnc(int code, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vwarnc(code, fmt, ap);
+ va_end(ap);
+}
+#endif