summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2014-01-16 17:21:38 +0000
committerchristos <christos@NetBSD.org>2014-01-16 17:21:38 +0000
commit49b1a97e5ddf5eddfc3cd593f7c204414fcba2f5 (patch)
treea13393b65862b8bf74f83b7e5dc829eac5dfedf5 /lib/libc
parent546adc0ceb273e39eed9d433e8c8154f6447d166 (diff)
Add the {v,}{err,warn}c flavors, from FreeBSD.
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/gen/Makefile.inc14
-rw-r--r--lib/libc/gen/_errc.c30
-rw-r--r--lib/libc/gen/_verrc.c27
-rw-r--r--lib/libc/gen/_vwarnc.c27
-rw-r--r--lib/libc/gen/_warnc.c30
-rw-r--r--lib/libc/gen/err.337
-rw-r--r--lib/libc/gen/errc.c59
-rw-r--r--lib/libc/gen/verr.c55
-rw-r--r--lib/libc/gen/verrc.c68
-rw-r--r--lib/libc/gen/vwarn.c54
-rw-r--r--lib/libc/gen/vwarnc.c67
-rw-r--r--lib/libc/gen/warnc.c63
-rw-r--r--lib/libc/shlib_version4
13 files changed, 453 insertions, 82 deletions
diff --git a/lib/libc/gen/Makefile.inc b/lib/libc/gen/Makefile.inc
index 074de096d7d..32368d437a2 100644
--- a/lib/libc/gen/Makefile.inc
+++ b/lib/libc/gen/Makefile.inc
@@ -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 arc4random.c assert.c basename.c clock.c \
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 arc4random.c assert.c basename.c clock.c \
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 endutxent.3 getutxid.3 \
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 \
diff --git a/lib/libc/gen/_errc.c b/lib/libc/gen/_errc.c
new file mode 100644
index 00000000000..c16df491f71
--- /dev/null
+++ b/lib/libc/gen/_errc.c
@@ -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
diff --git a/lib/libc/gen/_verrc.c b/lib/libc/gen/_verrc.c
new file mode 100644
index 00000000000..6e8bcfed87b
--- /dev/null
+++ b/lib/libc/gen/_verrc.c
@@ -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
diff --git a/lib/libc/gen/_vwarnc.c b/lib/libc/gen/_vwarnc.c
new file mode 100644
index 00000000000..0f70c404a7f
--- /dev/null
+++ b/lib/libc/gen/_vwarnc.c
@@ -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
diff --git a/lib/libc/gen/_warnc.c b/lib/libc/gen/_warnc.c
new file mode 100644
index 00000000000..015f720e4d1
--- /dev/null
+++ b/lib/libc/gen/_warnc.c
@@ -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
diff --git a/lib/libc/gen/err.3 b/lib/libc/gen/err.3
index 92f2629d972..b52ba962a36 100644
--- a/lib/libc/gen/err.3
+++ b/lib/libc/gen/err.3
@@ -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
diff --git a/lib/libc/gen/errc.c b/lib/libc/gen/errc.c
new file mode 100644
index 00000000000..a1503971dc2
--- /dev/null
+++ b/lib/libc/gen/errc.c
@@ -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
diff --git a/lib/libc/gen/verr.c b/lib/libc/gen/verr.c
index 2d431f0e0b0..bfa9b365aef 100644
--- a/lib/libc/gen/verr.c
+++ b/lib/libc/gen/verr.c
@@ -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
diff --git a/lib/libc/gen/verrc.c b/lib/libc/gen/verrc.c
new file mode 100644
index 00000000000..bcfe1384566
--- /dev/null
+++ b/lib/libc/gen/verrc.c
@@ -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
diff --git a/lib/libc/gen/vwarn.c b/lib/libc/gen/vwarn.c
index ba0598d015e..5a89358a384 100644
--- a/lib/libc/gen/vwarn.c
+++ b/lib/libc/gen/vwarn.c
@@ -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
diff --git a/lib/libc/gen/vwarnc.c b/lib/libc/gen/vwarnc.c
new file mode 100644
index 00000000000..56e00bf7dcf
--- /dev/null
+++ b/lib/libc/gen/vwarnc.c
@@ -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
diff --git a/lib/libc/gen/warnc.c b/lib/libc/gen/warnc.c
new file mode 100644
index 00000000000..7f90916db6d
--- /dev/null
+++ b/lib/libc/gen/warnc.c
@@ -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
diff --git a/lib/libc/shlib_version b/lib/libc/shlib_version
index 6a8871ac98c..20ba2d48c91 100644
--- a/lib/libc/shlib_version
+++ b/lib/libc/shlib_version
@@ -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