PSARC/2006/662 Make err/warn part of Solaris's libc
authorvk199839
Sat, 18 Aug 2007 10:07:23 -0700
changeset 4891 f4f971e9574d
parent 4890 b668449f8001
child 4892 5fe372d29888
PSARC/2006/662 Make err/warn part of Solaris's libc 6495220 add err() et al. to libc
usr/src/cmd/acctadm/utils.c
usr/src/cmd/acctadm/utils.h
usr/src/cmd/newgrp/newgrp.c
usr/src/cmd/prctl/utils.c
usr/src/cmd/prctl/utils.h
usr/src/cmd/rcap/common/utils.c
usr/src/cmd/rcap/common/utils.h
usr/src/cmd/rctladm/utils.c
usr/src/cmd/rctladm/utils.h
usr/src/cmd/ypcmd/stdhosts.c
usr/src/head/Makefile
usr/src/head/err.h
usr/src/lib/common/inc/c_synonyms.h
usr/src/lib/libc/amd64/Makefile
usr/src/lib/libc/i386/Makefile.com
usr/src/lib/libc/inc/synonyms.h
usr/src/lib/libc/port/gen/err.c
usr/src/lib/libc/port/gen/getopt_long.c
usr/src/lib/libc/port/llib-lc
usr/src/lib/libc/port/mapfile-vers
usr/src/lib/libc/sparc/Makefile
usr/src/lib/libc/sparcv9/Makefile
usr/src/lib/libipsecutil/Makefile
usr/src/lib/libipsecutil/Makefile.com
usr/src/lib/libipsecutil/common/err.c
usr/src/lib/libipsecutil/common/err.h
usr/src/lib/libipsecutil/common/errfp.h
usr/src/lib/libipsecutil/common/ipsec_util.h
usr/src/lib/libipsecutil/common/mapfile-vers
usr/src/lib/libnsl/nsl/_data2.c
usr/src/pkgdefs/SUNWhea/prototype_com
usr/src/pkgdefs/etc/exception_list_i386
usr/src/pkgdefs/etc/exception_list_sparc
--- a/usr/src/cmd/acctadm/utils.c	Sat Aug 18 06:36:15 2007 -0700
+++ b/usr/src/cmd/acctadm/utils.c	Sat Aug 18 10:07:23 2007 -0700
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
  *
  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  * or http://www.opensolaris.org/os/licensing.
@@ -20,8 +19,8 @@
  * CDDL HEADER END
  */
 /*
- * Copyright (c) 1999-2000 by Sun Microsystems, Inc.
- * All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -43,7 +42,7 @@
 
 /*PRINTFLIKE1*/
 void
-warn(char *format, ...)
+warn(const char *format, ...)
 {
 	int err = errno;
 	va_list alist;
--- a/usr/src/cmd/acctadm/utils.h	Sat Aug 18 06:36:15 2007 -0700
+++ b/usr/src/cmd/acctadm/utils.h	Sat Aug 18 10:07:23 2007 -0700
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
  *
  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  * or http://www.opensolaris.org/os/licensing.
@@ -20,8 +19,8 @@
  * CDDL HEADER END
  */
 /*
- * Copyright (c) 1999-2000 by Sun Microsystems, Inc.
- * All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 
 #ifndef	_UTILS_H
@@ -39,7 +38,7 @@
 #define	E_ERROR		1		/* Exit status for error */
 #define	E_USAGE		2		/* Exit status for usage error */
 
-extern void warn(char *, ...);
+extern void warn(const char *, ...);
 extern void die(char *, ...);
 extern char *setprogname(char *);
 extern int valid_abspath(char *);
--- a/usr/src/cmd/newgrp/newgrp.c	Sat Aug 18 06:36:15 2007 -0700
+++ b/usr/src/cmd/newgrp/newgrp.c	Sat Aug 18 10:07:23 2007 -0700
@@ -73,7 +73,7 @@
 char *supath = SUPATH;
 
 void error(char *s) __NORETURN;
-void warn(char *s);
+static void warn(char *s);
 void usage(void);
 
 int
@@ -190,7 +190,7 @@
 	return (1);
 }
 
-void
+static void
 warn(char *s)
 {
 	(void) fprintf(stderr, "%s\n", gettext(s));
@@ -273,6 +273,6 @@
 usage(void)
 {
 	(void) fprintf(stderr, gettext(
-		"usage: newgrp [-l | -] [group]\n"));
+	    "usage: newgrp [-l | -] [group]\n"));
 	exit(2);
 }
--- a/usr/src/cmd/prctl/utils.c	Sat Aug 18 06:36:15 2007 -0700
+++ b/usr/src/cmd/prctl/utils.c	Sat Aug 18 10:07:23 2007 -0700
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
  *
  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  * or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -59,7 +58,7 @@
 
 /*PRINTFLIKE1*/
 void
-warn(char *format, ...)
+warn(const char *format, ...)
 {
 	int err = errno;
 	va_list alist;
--- a/usr/src/cmd/prctl/utils.h	Sat Aug 18 06:36:15 2007 -0700
+++ b/usr/src/cmd/prctl/utils.h	Sat Aug 18 10:07:23 2007 -0700
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
  *
  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  * or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -35,7 +34,7 @@
 
 #include <sys/types.h>
 
-extern void warn(char *, ...);
+extern void warn(const char *, ...);
 extern char *setprogname(char *);
 
 /*
--- a/usr/src/cmd/rcap/common/utils.c	Sat Aug 18 06:36:15 2007 -0700
+++ b/usr/src/cmd/rcap/common/utils.c	Sat Aug 18 10:07:23 2007 -0700
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -58,7 +58,7 @@
 
 /*PRINTFLIKE2*/
 void
-vdprintfe(int level, char *format, va_list alist)
+vdprintfe(int level, const char *format, va_list alist)
 {
 	char buf[LINELEN];
 	char *c;
@@ -111,7 +111,7 @@
 
 /*PRINTFLIKE1*/
 void
-warn(char *format, ...)
+warn(const char *format, ...)
 {
 	va_list alist;
 
--- a/usr/src/cmd/rcap/common/utils.h	Sat Aug 18 06:36:15 2007 -0700
+++ b/usr/src/cmd/rcap/common/utils.h	Sat Aug 18 10:07:23 2007 -0700
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -94,9 +94,9 @@
 extern rcm_level_t set_message_priority(rcm_level_t);
 extern rcm_dst_t set_message_destination(rcm_dst_t);
 extern char *setprogname(char *);
-extern void warn(char *, ...);
+extern void warn(const char *, ...);
 extern int valid_abspath(char *);
-extern void vdprintfe(int, char *, va_list);
+extern void vdprintfe(int, const char *, va_list);
 extern void dprintfe(int, char *, ...);
 extern void hrt2ts(hrtime_t, timestruc_t *);
 extern int xatoi(char *);
--- a/usr/src/cmd/rctladm/utils.c	Sat Aug 18 06:36:15 2007 -0700
+++ b/usr/src/cmd/rctladm/utils.c	Sat Aug 18 10:07:23 2007 -0700
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
  *
  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  * or http://www.opensolaris.org/os/licensing.
@@ -20,8 +19,8 @@
  * CDDL HEADER END
  */
 /*
- * Copyright (c) 1999-2001 by Sun Microsystems, Inc.
- * All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
  */
 
 #pragma ident	"%Z%%M%	%I%	%E% SMI"
@@ -43,7 +42,7 @@
 
 /*PRINTFLIKE1*/
 void
-warn(char *format, ...)
+warn(const char *format, ...)
 {
 	int err = errno;
 	va_list alist;
--- a/usr/src/cmd/rctladm/utils.h	Sat Aug 18 06:36:15 2007 -0700
+++ b/usr/src/cmd/rctladm/utils.h	Sat Aug 18 10:07:23 2007 -0700
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
  *
  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  * or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -43,7 +42,7 @@
 #define	E_ERROR		1		/* Exit status for error */
 #define	E_USAGE		2		/* Exit status for usage error */
 
-extern void warn(char *, ...);
+extern void warn(const char *, ...);
 extern void die(char *, ...) __NORETURN;
 extern char *setprogname(char *);
 
--- a/usr/src/cmd/ypcmd/stdhosts.c	Sat Aug 18 06:36:15 2007 -0700
+++ b/usr/src/cmd/ypcmd/stdhosts.c	Sat Aug 18 10:07:23 2007 -0700
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -53,7 +53,7 @@
 
 static int ipv4 = -1;
 static char *cmd;
-int warn = 0;
+int warning = 0;
 
 static void verify_and_output(const char *key, char *value, int lineno);
 
@@ -91,7 +91,7 @@
 	while ((c = getopt(argc, argv, "v:wn")) != -1) {
 		switch (c) {
 		case 'w':	/* Send warning messages to stderr */
-			warn = 1;
+			warning = 1;
 			break;
 		case 'n':
 			ipv4 = 0;
@@ -143,7 +143,7 @@
 			 * Catch long lines but not if this is a short
 			 * line with no '\n' at the end of the input.
 			 */
-			if (warn)
+			if (warning)
 				fprintf(stderr,
 				    "%s: Warning: more than %d "
 				    "bytes on line %d, ignored\n",
@@ -166,7 +166,7 @@
 		}
 
 		if ((trailer = strpbrk(line, " \t")) == NULL) {
-			if (warn)
+			if (warning)
 				fprintf(stderr,
 				    "%s: Warning: no host names on line %d, "
 				    "ignored\n", cmd, lineno);
@@ -201,7 +201,7 @@
 				    nadr, sizeof (nadr));
 			}
 			if (nadrp == NULL) { /* Invalid IPv6 too */
-				if (warn)
+				if (warning)
 					fprintf(stderr,
 					    "%s: Warning: malformed"
 					    " address on"
@@ -245,7 +245,7 @@
 	if (key) {		/* Just in case key is NULL */
 		n = strlen(key);
 		if (n > OUTPUTSIZ) {
-			if (warn)
+			if (warning)
 				fprintf(stderr,
 				    "%s: address too long on "
 				    "line %d, line discarded\n",
@@ -274,7 +274,7 @@
 
 			names++;
 			if (names > (MAXALIASES+1)) { /* cname + MAXALIASES */
-				if (warn)
+				if (warning)
 					fprintf(stderr,
 					    "%s: Warning: too many "
 					    "host names on line %d, "
@@ -291,7 +291,7 @@
 			n += namelen + 1; /* single white space + name */
 			*p = '\0';	   /* Terminate the name string */
 			if (n > OUTPUTSIZ) {
-				if (warn)
+				if (warning)
 					fprintf(stderr,
 					    "%s: Warning: %d byte ndbm limit "
 					    "reached on line %d, truncating\n",
@@ -317,7 +317,7 @@
 		fputs(tmpbuf, stdout);
 		fputc('\n', stdout);
 	} else {
-		if (warn)
+		if (warning)
 			fprintf(stderr,
 			    "%s: Warning: no host names on line %d, "
 			    "ignored\n", cmd, lineno);
--- a/usr/src/head/Makefile	Sat Aug 18 06:36:15 2007 -0700
+++ b/usr/src/head/Makefile	Sat Aug 18 10:07:23 2007 -0700
@@ -61,6 +61,7 @@
 	dlfcn.h		\
 	door.h		\
 	elf.h		\
+	err.h		\
 	errno.h		\
 	euc.h		\
 	exacct.h	\
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/head/err.h	Sat Aug 18 10:07:23 2007 -0700
@@ -0,0 +1,52 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_ERR_H
+#define	_ERR_H
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+#include <stdarg.h>
+
+/* Program exit and warning calls */
+void err(int, const char *, ...);
+void verr(int, const char *, va_list);
+void errx(int, const char *, ...);
+void verrx(int, const char *, va_list);
+void warn(const char *, ...);
+void vwarn(const char *, va_list);
+void warnx(const char *, ...);
+void vwarnx(const char *, va_list);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif	/* _ERR_H */
--- a/usr/src/lib/common/inc/c_synonyms.h	Sat Aug 18 06:36:15 2007 -0700
+++ b/usr/src/lib/common/inc/c_synonyms.h	Sat Aug 18 10:07:23 2007 -0700
@@ -265,6 +265,8 @@
 #define	endutxent			_endutxent
 #define	environ				_environ
 #define	erand48				_erand48
+#define	err				_err
+#define	errx				_errx
 #define	execle				_execle
 #define	execl				_execl
 #define	execlp				_execlp
@@ -985,6 +987,8 @@
 #define	utmpname			_utmpname
 #define	utmpxname			_utmpxname
 #define	utssys				_utssys
+#define	verr				_verr
+#define	verrx				_verrx
 #define	vfork				_vfork
 #define	vforkx				_vforkx
 #define	vfscanf				_vfscanf
@@ -992,11 +996,15 @@
 #define	vscanf				_vscanf
 #define	vsscanf				_vsscanf
 #define	vsyslog				_vsyslog
+#define	vwarn				_vwarn
+#define	vwarnx				_vwarnx
 #define	wait3				_wait3
 #define	waitid				_waitid
 #define	waitpid				_waitpid
 #define	wait				_wait
 #define	walkcontext			_walkcontext
+#define	warn				_warn
+#define	warnx				_warnx
 #define	wctomb				_wctomb
 #define	wracct				_wracct
 #define	writev				_writev
--- a/usr/src/lib/libc/amd64/Makefile	Sat Aug 18 06:36:15 2007 -0700
+++ b/usr/src/lib/libc/amd64/Makefile	Sat Aug 18 10:07:23 2007 -0700
@@ -385,6 +385,7 @@
 	drand48.o		\
 	dup2.o			\
 	env_data.o		\
+	err.o			\
 	errno.o			\
 	euclen.o		\
 	event_port.o		\
--- a/usr/src/lib/libc/i386/Makefile.com	Sat Aug 18 06:36:15 2007 -0700
+++ b/usr/src/lib/libc/i386/Makefile.com	Sat Aug 18 10:07:23 2007 -0700
@@ -417,6 +417,7 @@
 	drand48.o		\
 	dup2.o			\
 	env_data.o		\
+	err.o			\
 	errno.o			\
 	euclen.o		\
 	event_port.o		\
--- a/usr/src/lib/libc/inc/synonyms.h	Sat Aug 18 06:36:15 2007 -0700
+++ b/usr/src/lib/libc/inc/synonyms.h	Sat Aug 18 10:07:23 2007 -0700
@@ -310,6 +310,8 @@
 #define	endutxent		_endutxent
 #define	environ			_environ
 #define	erand48			_erand48
+#define	err			_err
+#define	errx			_errx
 #define	etext			_etext
 #define	execle			_execle
 #define	execl			_execl
@@ -1128,6 +1130,8 @@
 #define	utssys			_utssys
 #define	uucopy			_uucopy
 #define	uucopystr		_uucopystr
+#define	verr			_verr
+#define	verrx			_verrx
 #define	vfork			_vfork
 #define	vforkx			_vforkx
 #define	vfscanf			_vfscanf
@@ -1137,11 +1141,15 @@
 #define	vscanf			_vscanf
 #define	vsscanf			_vsscanf
 #define	vsyslog			_vsyslog
+#define	vwarn			_vwarn
+#define	vwarnx			_vwarnx
 #define	wait3			_wait3
 #define	waitid			_waitid
 #define	waitpid			_waitpid
 #define	wait			_wait
 #define	walkcontext		_walkcontext
+#define	warn			_warn
+#define	warnx			_warnx
 #define	wcscat			_wcscat
 #define	wcschr			_wcschr
 #define	wcscmp			_wcscmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/lib/libc/port/gen/err.c	Sat Aug 18 10:07:23 2007 -0700
@@ -0,0 +1,229 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+#pragma weak err = _err
+#pragma weak errx = _errx
+#pragma weak verr = _verr
+#pragma weak verrx = _verrx
+#pragma weak warn = _warn
+#pragma weak warnx = _warnx
+#pragma weak vwarn = _vwarn
+#pragma weak vwarnx = _vwarnx
+
+#include "synonyms.h"
+#include <sys/types.h>
+#include <err.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <errno.h>
+
+/* Function exit/warning functions and global variables. */
+
+static const char *progname;
+
+/*
+ * warncore() is the workhorse of these functions.  Everything else has
+ * a warncore() component in it.
+ */
+static void
+warncore(FILE *fp, const char *fmt, va_list args)
+{
+	flockfile(fp);
+	if (progname == NULL) {
+		progname = strrchr(getexecname(), '/');
+		if (progname == NULL)
+			progname = getexecname();
+		else
+			progname++;
+	}
+
+	(void) fprintf(fp, "%s: ", progname);
+
+	if (fmt != NULL) {
+		(void) vfprintf(fp, fmt, args);
+	}
+}
+
+/* Finish a warning with a newline and a flush of stderr. */
+static void
+warnfinish(FILE *fp)
+{
+	(void) fputc('\n', fp);
+	(void) fflush(fp);
+	funlockfile(fp);
+}
+
+void
+_vwarnxfp(FILE *fp, const char *fmt, va_list args)
+{
+	warncore(fp, fmt, args);
+	warnfinish(fp);
+}
+
+void
+vwarnx(const char *fmt, va_list args)
+{
+	_vwarnxfp(stderr, fmt, args);
+}
+
+void
+_vwarnfp(FILE *fp, const char *fmt, va_list args)
+{
+	int tmperr = errno;	/* Capture errno now. */
+
+	warncore(fp, fmt, args);
+	if (fmt != NULL) {
+		(void) fputc(':', fp);
+		(void) fputc(' ', fp);
+	}
+	(void) fputs(strerror(tmperr), fp);
+	warnfinish(fp);
+}
+
+void
+vwarn(const char *fmt, va_list args)
+{
+	_vwarnfp(stderr, fmt, args);
+}
+
+/* PRINTFLIKE1 */
+void
+warnx(const char *fmt, ...)
+{
+	va_list args;
+
+	va_start(args, fmt);
+	vwarnx(fmt, args);
+	va_end(args);
+}
+
+void
+_warnfp(FILE *fp, const char *fmt, ...)
+{
+	va_list args;
+
+	va_start(args, fmt);
+	_vwarnfp(fp, fmt, args);
+	va_end(args);
+}
+
+void
+_warnxfp(FILE *fp, const char *fmt, ...)
+{
+	va_list args;
+
+	va_start(args, fmt);
+	_vwarnxfp(fp, fmt, args);
+	va_end(args);
+}
+
+/* PRINTFLIKE1 */
+void
+warn(const char *fmt, ...)
+{
+	va_list args;
+
+	va_start(args, fmt);
+	vwarn(fmt, args);
+	va_end(args);
+}
+
+/* PRINTFLIKE2 */
+void
+err(int status, const char *fmt, ...)
+{
+	va_list args;
+
+	va_start(args, fmt);
+	vwarn(fmt, args);
+	va_end(args);
+	exit(status);
+}
+
+void
+_errfp(FILE *fp, int status, const char *fmt, ...)
+{
+	va_list args;
+
+	va_start(args, fmt);
+	_vwarnfp(fp, fmt, args);
+	va_end(args);
+	exit(status);
+}
+
+void
+verr(int status, const char *fmt, va_list args)
+{
+	vwarn(fmt, args);
+	exit(status);
+}
+
+void
+_verrfp(FILE *fp, int status, const char *fmt, va_list args)
+{
+	_vwarnfp(fp, fmt, args);
+	exit(status);
+}
+
+/* PRINTFLIKE2 */
+void
+errx(int status, const char *fmt, ...)
+{
+	va_list args;
+
+	va_start(args, fmt);
+	vwarnx(fmt, args);
+	va_end(args);
+	exit(status);
+}
+
+void
+_errxfp(FILE *fp, int status, const char *fmt, ...)
+{
+	va_list args;
+
+	va_start(args, fmt);
+	_vwarnxfp(fp, fmt, args);
+	va_end(args);
+	exit(status);
+}
+
+void
+verrx(int status, const char *fmt, va_list args)
+{
+	vwarnx(fmt, args);
+	exit(status);
+}
+
+void
+_verrxfp(FILE *fp, int status, const char *fmt, va_list args)
+{
+	_vwarnxfp(fp, fmt, args);
+	exit(status);
+}
--- a/usr/src/lib/libc/port/gen/getopt_long.c	Sat Aug 18 06:36:15 2007 -0700
+++ b/usr/src/lib/libc/port/gen/getopt_long.c	Sat Aug 18 10:07:23 2007 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -125,13 +125,13 @@
  * Generalized error message output.
  *
  * NOTE ON ERROR MESSAGES: All the error messages in this file
- * use %s (not %c) because they are all routed through warnx(),
+ * use %s (not %c) because they are all routed through warnx_getopt(),
  * which takes a string argument. Character arguments passed
  * to warnxchar() are converted to strings automatically before
- * being passed to warnx().
+ * being passed to warnx_getopt().
  */
 static void
-warnx(const char *argv0, const char *msg, const char *arg) {
+warnx_getopt(const char *argv0, const char *msg, const char *arg) {
 	char errbuf[256];
 	(void) snprintf(errbuf, sizeof (errbuf), msg, argv0, arg);
 	(void) write(2, errbuf, strlen(errbuf));
@@ -146,7 +146,7 @@
 	char charbuf[2];
 	charbuf[0] = c;
 	charbuf[1] = '\0';
-	warnx(argv0, msg, charbuf);
+	warnx_getopt(argv0, msg, charbuf);
 }
 
 /*
@@ -157,7 +157,7 @@
 	char argbuf[256];
 	(void) strncpy(argbuf, arg, argLen);
 	argbuf[argLen < (sizeof (argbuf)-1)? argLen:(sizeof (argbuf)-1)] = '\0';
-	warnx(argv0, msg, argbuf);
+	warnx_getopt(argv0, msg, argbuf);
 }
 
 /*
@@ -290,7 +290,7 @@
 								!= NULL));
 
 			if ((!equivFound) && (PRINT_ERROR)) {
-				warnx(nargv[0],
+				warnx_getopt(nargv[0],
 					_libc_gettext(
 				"%s: equivalent short option required -- %s"),
 					long_options[long_i].name);
@@ -335,7 +335,7 @@
 
 		/* find matching long option */
 		if (strncmp(current_argv, long_options[i].name,
-						current_argv_len) != 0) {
+		    current_argv_len) != 0) {
 			continue;	/* no match  */
 		}
 		long_option_len = strlen(long_options[i].name);
@@ -363,7 +363,7 @@
 			if (PRINT_ERROR) {
 				warnxlen(nargv[0],
 				    _libc_gettext(
-					"%s: ambiguous option -- %s"),
+				    "%s: ambiguous option -- %s"),
 				    (int)current_argv_len,
 				    current_argv);
 			}
@@ -376,10 +376,10 @@
 		    (argv_equal_ptr != NULL)) {
 			if (PRINT_ERROR) {
 				warnxlen(nargv[0],
-					_libc_gettext(
+				    _libc_gettext(
 				"%s: option doesn't take an argument -- %s"),
-					(int)current_argv_len,
-					current_argv);
+				    (int)current_argv_len,
+				    current_argv);
 			}
 			/*
 			 * XXX: GNU sets optopt to val regardless of flag
@@ -397,7 +397,7 @@
 			} else if (LONGOPT_REQUIRES_ARG(long_options[match])) {
 				/* The next argv must be the option argument */
 				if (optind < nargc) {
-				    optarg = nargv[optind];
+					optarg = nargv[optind];
 				}
 				++optind; /* code below depends on this */
 			}
@@ -409,10 +409,10 @@
 			 * should be generated.
 			 */
 			if (PRINT_ERROR) {
-				warnx(nargv[0],
-					_libc_gettext(
+				warnx_getopt(nargv[0],
+				    _libc_gettext(
 				"%s: option requires an argument -- %s"),
-					current_argv);
+				    current_argv);
 			}
 			/*
 			 * XXX: GNU sets optopt to val regardless of flag
@@ -430,9 +430,9 @@
 			return (-1);
 		}
 		if (PRINT_ERROR) {
-			warnx(nargv[0],
-				_libc_gettext("%s: illegal option -- %s"),
-				current_argv);
+			warnx_getopt(nargv[0],
+			    _libc_gettext("%s: illegal option -- %s"),
+			    current_argv);
 		}
 		optopt = 0;
 		return (BADCH);
@@ -494,9 +494,9 @@
 	} /* if FLAG_PLUS_DASH_START */
 
 	if (posixly_correct) {
-	    flags &= ~FLAG_PERMUTE;
-	    flags &= ~FLAG_ALLARGS;
-	    flags &= ~FLAG_OPTIONAL_ARGS;
+		flags &= ~FLAG_PERMUTE;
+		flags &= ~FLAG_ALLARGS;
+		flags &= ~FLAG_OPTIONAL_ARGS;
 	}
 
 	/*
@@ -523,12 +523,12 @@
 	 * Sun's CLIP specification (11/12/02).
 	 */
 	if ((optind == 1) && FLAG_IS_SET(FLAG_REQUIRE_EQUIVALENTS)) {
-	    if (verify_short_long_equivalents(
-			nargc, nargv, options, long_options, flags) < 0) {
-		/* function printed any necessary messages */
-		errno = EINVAL;		/* invalid argument */
-		return (-1);
-	    }
+		if (verify_short_long_equivalents(
+		    nargc, nargv, options, long_options, flags) < 0) {
+			/* function printed any necessary messages */
+			errno = EINVAL;		/* invalid argument */
+			return (-1);
+		}
 	}
 
 start:
@@ -623,7 +623,7 @@
 			short_too = 1;		/* could be short option too */
 
 		optchar = parse_long_options(nargc, nargv, options,
-				long_options, idx, short_too, flags);
+		    long_options, idx, short_too, flags);
 		if (optchar != -1) {
 			place = EMSG;
 			return (optchar);
@@ -643,8 +643,8 @@
 			++optind;
 		if (PRINT_ERROR)
 			warnxchar(nargv[0],
-				_libc_gettext("%s: illegal option -- %s"),
-				optchar);
+			    _libc_gettext("%s: illegal option -- %s"),
+			    optchar);
 		optopt = optchar;
 		return (BADCH);
 	}
@@ -658,16 +658,16 @@
 			place = EMSG;
 			if (PRINT_ERROR)
 				warnxchar(nargv[0],
-					_libc_gettext(
+				    _libc_gettext(
 				"%s: option requires an argument -- %s"),
-					optchar);
+				    optchar);
 			optopt = optchar;
 			return (BADARG);
 		} else {			/* white space */
 			place = nargv[optind];
 		}
 		optchar = parse_long_options(
-				nargc, nargv, options, long_options,
+		    nargc, nargv, options, long_options,
 		    idx, 0, flags);
 
 		/*
@@ -689,16 +689,16 @@
 			optarg = place;
 		/* XXX: disable test for :: if PC? (GNU doesn't) */
 		} else if (!(FLAG_IS_SET(FLAG_OPTIONAL_ARGS) &&
-			    (oli[1] == ':'))) {
+		    (oli[1] == ':'))) {
 			/* arg is required (not optional) */
 
 			if (++optind >= nargc) {	/* no arg */
 				place = EMSG;
 				if (PRINT_ERROR) {
 					warnxchar(nargv[0],
-						_libc_gettext(
+					    _libc_gettext(
 				"%s: option requires an argument -- %s"),
-						optchar);
+					    optchar);
 				}
 				optopt = optchar;
 				return (BADARG);
@@ -727,12 +727,12 @@
 {
 
 	return (getopt_internal(
-		nargc, nargv, optstring, long_options, long_index,
-		FLAG_PERMUTE
-		| FLAG_OPTIONAL_ARGS
-		| FLAG_ABBREV
-		| FLAG_W_SEMICOLON
-		| FLAG_PLUS_DASH_START));
+	    nargc, nargv, optstring, long_options, long_index,
+	    FLAG_PERMUTE
+	    | FLAG_OPTIONAL_ARGS
+	    | FLAG_ABBREV
+	    | FLAG_W_SEMICOLON
+	    | FLAG_PLUS_DASH_START));
 } /* getopt_long() */
 
 /*
@@ -748,13 +748,13 @@
 {
 
 	return (getopt_internal(
-		nargc, nargv, optstring, long_options, long_index,
-		FLAG_PERMUTE
-		| FLAG_OPTIONAL_ARGS
-		| FLAG_ABBREV
-		| FLAG_W_SEMICOLON
-		| FLAG_PLUS_DASH_START
-		| FLAG_LONGONLY));
+	    nargc, nargv, optstring, long_options, long_index,
+	    FLAG_PERMUTE
+	    | FLAG_OPTIONAL_ARGS
+	    | FLAG_ABBREV
+	    | FLAG_W_SEMICOLON
+	    | FLAG_PLUS_DASH_START
+	    | FLAG_LONGONLY));
 } /* getopt_long_only() */
 
 /*
@@ -787,7 +787,7 @@
 		const struct option *long_options, int *long_index)
 {
 	return getopt_internal(
-		nargc, nargv, optstring, long_options, long_index,
+	    nargc, nargv, optstring, long_options, long_index,
 		/*
 		 * no permutation,
 		 * no optional args,
@@ -796,6 +796,6 @@
 		 * no support for +- at start of optstring
 		 * yes support for "W;" in optstring
 		 */
-		FLAG_W_SEMICOLON
-		| FLAG_REQUIRE_EQUIVALENTS);
+	    FLAG_W_SEMICOLON
+	    | FLAG_REQUIRE_EQUIVALENTS);
 } /* getopt_clip() */
--- a/usr/src/lib/libc/port/llib-lc	Sat Aug 18 06:36:15 2007 -0700
+++ b/usr/src/lib/libc/port/llib-lc	Sat Aug 18 10:07:23 2007 -0700
@@ -37,6 +37,7 @@
 #include <dirent.h>
 #include <dlfcn.h>
 #include <door.h>
+#include <err.h>
 #include <sys/errno.h>
 #include <euc.h>
 #include <fcntl.h>
@@ -374,6 +375,16 @@
 char *fcvt(double value, int ndigit, int *_RESTRICT_KYWD decpt,
 	int *_RESTRICT_KYWD sign);
 
+/* err.c */
+void _errfp(FILE *, int, const char *, ...);
+void _verrfp(FILE *, int, const char *, va_list);
+void _errxfp(FILE *, int, const char *, ...);
+void _verrxfp(FILE *, int, const char *, va_list);
+void _warnfp(FILE *, const char *, ...);
+void _vwarnfp(FILE *, const char *, va_list);
+void _warnxfp(FILE *, const char *, ...);
+void _vwarnxfp(FILE *, const char *, va_list);
+
 /* errlst.c */
 
 /* euclen.c */
--- a/usr/src/lib/libc/port/mapfile-vers	Sat Aug 18 06:36:15 2007 -0700
+++ b/usr/src/lib/libc/port/mapfile-vers	Sat Aug 18 10:07:23 2007 -0700
@@ -60,6 +60,8 @@
 	door_setparam;
 	door_ucred;
 	door_unbind;
+	err;
+	errx;
 	fdatasync;
 	forkallx;
 	forkx;
@@ -124,6 +126,12 @@
 	uucopy;
 	uucopystr;
 	vforkx;
+	verr;
+	verrx;
+	vwarn;
+	vwarnx;
+	warn;
+	warnx;
 } SUNW_1.22.2;
 
 SUNW_1.22.2 {
@@ -1492,6 +1500,10 @@
 	_endutxent;
 	__environ_lock = NODIRECT;
 	_erand48;
+	_err;
+	_errfp;
+	_errx;
+	_errxfp;
 	__eucpctowc_gen;
 	exportfs;
 	_exportfs;
@@ -2190,12 +2202,24 @@
 	_utmpxname;
 	utssys;
 	_utssys;
+	_verr;
+	_verrfp;
+	_verrx;
+	_verrxfp;
 	_vfork;
 	_vforkx;
 	_vhangup;
 	_vsyslog;
+	_vwarn;
+	_vwarnfp;
+	_vwarnx;
+	_vwarnxfp;
 	_wait3;
 	_walkcontext;
+	_warn;
+	_warnfp;
+	_warnx;
+	_warnxfp;
 	__wcrtomb_dense;
 	__wcrtomb_euc;
 	__wcrtomb_sb;
--- a/usr/src/lib/libc/sparc/Makefile	Sat Aug 18 06:36:15 2007 -0700
+++ b/usr/src/lib/libc/sparc/Makefile	Sat Aug 18 10:07:23 2007 -0700
@@ -441,6 +441,7 @@
 	drand48.o		\
 	dup2.o			\
 	env_data.o		\
+	err.o			\
 	errno.o			\
 	euclen.o		\
 	event_port.o		\
--- a/usr/src/lib/libc/sparcv9/Makefile	Sat Aug 18 06:36:15 2007 -0700
+++ b/usr/src/lib/libc/sparcv9/Makefile	Sat Aug 18 10:07:23 2007 -0700
@@ -403,6 +403,7 @@
 	drand48.o		\
 	dup2.o			\
 	env_data.o		\
+	err.o			\
 	errno.o			\
 	euclen.o		\
 	event_port.o		\
--- a/usr/src/lib/libipsecutil/Makefile	Sat Aug 18 06:36:15 2007 -0700
+++ b/usr/src/lib/libipsecutil/Makefile	Sat Aug 18 10:07:23 2007 -0700
@@ -27,7 +27,7 @@
 
 include ../Makefile.lib
 
-HDRS =		ipsec_util.h ikedoor.h err.h
+HDRS =		ipsec_util.h ikedoor.h errfp.h
 HDRDIR =	common
 SUBDIRS	=	$(MACH)
 
--- a/usr/src/lib/libipsecutil/Makefile.com	Sat Aug 18 06:36:15 2007 -0700
+++ b/usr/src/lib/libipsecutil/Makefile.com	Sat Aug 18 10:07:23 2007 -0700
@@ -19,7 +19,7 @@
 # CDDL HEADER END
 #
 #
-# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -27,14 +27,13 @@
 
 LIBRARY =	libipsecutil.a
 VERS =		.1
-OBJECTS =	ipsec_util.o algs.o err.o
+OBJECTS =	ipsec_util.o algs.o
 
 include ../../Makefile.lib
 
 LIBS +=		$(DYNLIB) $(LINTLIB)
 
 SRCDIR =	../common
-SRCS = 		$(SRCDIR)/ipsec_util.c $(SRCDIR)/algs.c $(SRCDIR)/err.c
 
 $(LINTLIB):=	SRCS = $(SRCDIR)/$(LINTSRC)
 LDLIBS +=	-lsocket -lnsl -lc
@@ -48,8 +47,4 @@
 
 lint: lintcheck
 
-objs/%.o pics/%.o: $(SRCDIR)/%.c
-	$(COMPILE.c) -o $@ $<
-	$(POST_PROCESS_O)
-
 include ../../Makefile.targ
--- a/usr/src/lib/libipsecutil/common/err.c	Sat Aug 18 06:36:15 2007 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,183 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
- */
-
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <libgen.h>
-#include <libintl.h>
-#include <errno.h>
-
-#include "ipsec_util.h"
-
-/* Function exit/warning functions and global variables. */
-
-static const char *progname;
-
-/*
- * warncore() is the workhorse of these functions.  Everything else has
- * a warncore() component in it.
- */
-static void
-warncore(FILE *fp, const char *fmt, va_list args)
-{
-	if (progname == NULL) {
-		progname = strrchr(getexecname(), '/');
-		if (progname == NULL)
-			progname = getexecname();
-		else
-			progname++;
-	}
-
-	(void) fputs(progname, fp);
-
-	if (fmt != NULL) {
-		(void) fputc(':', fp);
-		(void) fputc(' ', fp);
-		(void) vfprintf(fp, fmt, args);
-	}
-}
-
-/* Finish a warning with a newline and a flush of stderr. */
-static void
-warnfinish(FILE *fp)
-{
-	(void) fputc('\n', fp);
-	(void) fflush(fp);
-}
-
-void
-vwarnxfp(FILE *fp, const char *fmt, va_list args)
-{
-	warncore(fp, fmt, args);
-	warnfinish(fp);
-}
-
-void
-vwarnfp(FILE *fp, const char *fmt, va_list args)
-{
-	int tmperr = errno;	/* Capture errno now. */
-
-	warncore(fp, fmt, args);
-	(void) fputc(':', fp);
-	(void) fputc(' ', fp);
-	(void) fputs(strerror(tmperr), fp);
-	warnfinish(fp);
-}
-
-void
-vwarnx(const char *fmt, va_list args)
-{
-	vwarnxfp(stderr, fmt, args);
-}
-
-void
-vwarn(const char *fmt, va_list args)
-{
-	vwarnfp(stderr, fmt, args);
-}
-
-/* PRINTFLIKE1 */
-void
-warnx(const char *fmt, ...)
-{
-	va_list args;
-
-	va_start(args, fmt);
-	vwarnx(fmt, args);
-	va_end(args);
-}
-
-/* PRINTFLIKE1 */
-void
-warn(const char *fmt, ...)
-{
-	va_list args;
-
-	va_start(args, fmt);
-	vwarn(fmt, args);
-	va_end(args);
-}
-
-void
-warnxfp(FILE *fp, const char *fmt, ...)
-{
-	va_list args;
-
-	va_start(args, fmt);
-	vwarnxfp(fp, fmt, args);
-	va_end(args);
-}
-
-void
-warnfp(FILE *fp, const char *fmt, ...)
-{
-	va_list args;
-
-	va_start(args, fmt);
-	vwarnfp(fp, fmt, args);
-	va_end(args);
-}
-
-/* PRINTFLIKE2 */
-void
-err(int status, const char *fmt, ...)
-{
-	va_list args;
-
-	va_start(args, fmt);
-	vwarn(fmt, args);
-	va_end(args);
-	exit(status);
-}
-
-void
-verr(int status, const char *fmt, va_list args)
-{
-	vwarn(fmt, args);
-	exit(status);
-}
-
-/* PRINTFLIKE2 */
-void
-errx(int status, const char *fmt, ...)
-{
-	va_list args;
-
-	va_start(args, fmt);
-	vwarnx(fmt, args);
-	va_end(args);
-	exit(status);
-}
-
-void
-verrx(int status, const char *fmt, va_list args)
-{
-	vwarnx(fmt, args);
-	exit(status);
-}
--- a/usr/src/lib/libipsecutil/common/err.h	Sat Aug 18 06:36:15 2007 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
- * CDDL HEADER START
- *
- * The contents of this file are subject to the terms of the
- * Common Development and Distribution License (the "License").
- * You may not use this file except in compliance with the License.
- *
- * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
- * or http://www.opensolaris.org/os/licensing.
- * See the License for the specific language governing permissions
- * and limitations under the License.
- *
- * When distributing Covered Code, include this CDDL HEADER in each
- * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
- * If applicable, add the following below this CDDL HEADER, with the
- * fields enclosed by brackets "[]" replaced with your own identifying
- * information: Portions Copyright [yyyy] [name of copyright owner]
- *
- * CDDL HEADER END
- */
-/*
- * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
- * Use is subject to license terms.
- */
-
-#ifndef	_ERR_H
-#define	_ERR_H
-
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
-/*
- * Headers and definitions for support functions that are shared by
- * the ipsec utilities ipseckey and ikeadm.
- */
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <stdarg.h>
-
-/*
- * Function Prototypes
- */
-
-/* Program exit and warning calls.   Thank you NetBSD. */
-void err(int, const char *, ...);
-void verr(int, const char *, va_list);
-void errx(int, const char *, ...);
-void verrx(int, const char *, va_list);
-void warn(const char *, ...);
-void warnfp(FILE *, const char *, ...);
-void vwarn(const char *, va_list);
-void vwarnfp(FILE *, const char *, va_list);
-void warnx(const char *, ...);
-void warnxfp(FILE *, const char *, ...);
-void vwarnx(const char *, va_list);
-void vwarnxfp(FILE *, const char *, va_list);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif	/* _ERR_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/lib/libipsecutil/common/errfp.h	Sat Aug 18 10:07:23 2007 -0700
@@ -0,0 +1,81 @@
+/*
+ * CDDL HEADER START
+ *
+ * The contents of this file are subject to the terms of the
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
+ *
+ * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+ * or http://www.opensolaris.org/os/licensing.
+ * See the License for the specific language governing permissions
+ * and limitations under the License.
+ *
+ * When distributing Covered Code, include this CDDL HEADER in each
+ * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+ * If applicable, add the following below this CDDL HEADER, with the
+ * fields enclosed by brackets "[]" replaced with your own identifying
+ * information: Portions Copyright [yyyy] [name of copyright owner]
+ *
+ * CDDL HEADER END
+ */
+/*
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
+ * Use is subject to license terms.
+ */
+
+#ifndef	_ERRFP_H
+#define	_ERRFP_H
+
+#pragma ident	"%Z%%M%	%I%	%E% SMI"
+
+/*
+ * Headers and definitions for support functions that are shared by
+ * the ipsec utilities ipseckey and ikeadm.
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+#include <stdarg.h>
+
+/*
+ * Function Prototypes
+ */
+
+#ifdef	__PRAGMA_REDEFINE_EXTNAME
+#pragma	redefine_extname	errfp		_errfp
+#pragma	redefine_extname	verrfp		_verrfp
+#pragma	redefine_extname	errxfp		_errxfp
+#pragma	redefine_extname	verrxfp		_verrxfp
+#pragma	redefine_extname	warnfp		_warnfp
+#pragma	redefine_extname	vwarnfp		_vwarnfp
+#pragma	redefine_extname	warnxfp		_warnxfp
+#pragma	redefine_extname	vwarnxfp	_vwarnxfp
+#else
+#define	errfp		_errfp
+#define	verrfp		_verrfp
+#define	errxfp		_errxfp
+#define	verrxfp		_verrxfp
+#define	warnfp		_warnfp
+#define	vwarnfp		_vwarnfp
+#define	warnxfp		_warnxfp
+#define	vwarnxfp	_vwarnxfp
+#endif
+
+/* Program exit and warning calls */
+extern void errfp(FILE *, int, const char *, ...);
+extern void verrfp(FILE *, int, const char *, va_list);
+extern void errxfp(FILE *, int, const char *, ...);
+extern void verrxfp(FILE *, int, const char *, va_list);
+extern void warnfp(FILE *, const char *, ...);
+extern void vwarnfp(FILE *, const char *, va_list);
+extern void warnxfp(FILE *, const char *, ...);
+extern void vwarnxfp(FILE *, const char *, va_list);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif	/* _ERRFP_H */
--- a/usr/src/lib/libipsecutil/common/ipsec_util.h	Sat Aug 18 06:36:15 2007 -0700
+++ b/usr/src/lib/libipsecutil/common/ipsec_util.h	Sat Aug 18 10:07:23 2007 -0700
@@ -45,6 +45,7 @@
 #include <setjmp.h>
 #include <stdio.h>
 #include <err.h>
+#include <errfp.h>
 #include <net/pfpolicy.h>
 
 #ifndef A_CNT
--- a/usr/src/lib/libipsecutil/common/mapfile-vers	Sat Aug 18 06:36:15 2007 -0700
+++ b/usr/src/lib/libipsecutil/common/mapfile-vers	Sat Aug 18 10:07:23 2007 -0700
@@ -44,8 +44,8 @@
 	dump_sadb_idtype;
 	dump_sockaddr;
 	env;
-	err;
-	errx;
+	_errfp = FUNCTION FILTER libc.so.1;
+	_errxfp = FUNCTION FILTER libc.so.1;
 	getipsecalgs;
 	getipsecprotos;
 	in_masktoprefix;
@@ -94,12 +94,12 @@
 	save_lifetime;
 	spdsock_diag;
 	spdsock_get_ext;
-	verr;
-	verrx;
-	vwarn;
-	vwarnx;
-	warn;
-	warnx;
+	_verrfp = FUNCTION FILTER libc.so.1;
+	_verrxfp = FUNCTION FILTER libc.so.1;
+	_vwarnfp = FUNCTION FILTER libc.so.1;
+	_vwarnxfp = FUNCTION FILTER libc.so.1;
+	_warnfp = FUNCTION FILTER libc.so.1;
+	_warnxfp = FUNCTION FILTER libc.so.1;
     local:
 	*;
 };
--- a/usr/src/lib/libnsl/nsl/_data2.c	Sat Aug 18 06:36:15 2007 -0700
+++ b/usr/src/lib/libnsl/nsl/_data2.c	Sat Aug 18 10:07:23 2007 -0700
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
  *
  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  * or http://www.opensolaris.org/os/licensing.
@@ -24,7 +23,7 @@
 
 
 /*
- * Copyright 1993-2003 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -41,7 +40,7 @@
  * State transition table for TLI/XTI user level states.
  */
 
-#define	err	T_BADSTATE	/* error state */
+#define	ers	T_BADSTATE	/* error state */
 
 char tiusr_statetbl[T_NOEVENTS][T_NOSTATES] = {
 
@@ -63,31 +62,31 @@
  *                       (0)  (1)  (2)  (3)  (4)  (5)  (6)  (7)  (8)
  */
 /* BEGIN CSTYLED */
-/* T_OPEN (0)        */ {  1, err, err, err, err, err, err, err, err},
-/* T_BIND (1)        */ {err,   2, err, err, err, err, err, err, err},
-/* T_OPTMGMT (2)     */ {err,   1,   2,   3,   4,   5,   6,   7, err},
-/* T_UNBIND (3)      */ {err, err,   1, err, err, err, err, err, err},
-/* T_CLOSE (4)       */ {err,   0, err, err, err, err, err, err, err},
-/* T_SNDUDATA (5)    */ {err, err,   2, err, err, err, err, err, err},
-/* T_RCVUDATA (6)    */ {err, err,   2, err, err, err, err, err, err},
-/* T_RCVUDERR (7)    */ {err, err,   2, err, err, err, err, err, err},
-/* T_CONNECT1 (8)    */ {err, err,   5, err, err, err, err, err, err},
-/* T_CONNECT2 (9)    */ {err, err,   3, err, err, err, err, err, err},
-/* T_RCVCONNECT (10) */ {err, err, err,   5, err, err, err, err, err},
-/* T_LISTN (11)      */ {err, err,   4, err,   4, err, err, err, err},
-/* T_ACCEPT1 (12)    */ {err, err, err, err,   5, err, err, err, err},
-/* T_ACCEPT2 (13)    */ {err, err, err, err,   2, err, err, err, err},
-/* T_ACCEPT3 (14)    */ {err, err, err, err,   4, err, err, err, err},
-/* T_SND (15)        */ {err, err, err, err, err,   5, err,   7, err},
-/* T_RCV (16)        */ {err, err, err, err, err,   5,   6, err, err},
-/* T_SNDDIS1 (17)    */ {err, err, err,   2,   2,   2,   2,   2, err},
-/* T_SNDDIS2 (18)    */ {err, err, err, err,   4, err, err, err, err},
-/* T_RCVDIS1 (19)    */ {err, err, err,   2, err,   2,   2,   2, err},
-/* T_RCVDIS2 (20)    */ {err, err, err, err,   2, err, err, err, err},
-/* T_RCVDIS3 (21)    */ {err, err, err, err,   4, err, err, err, err},
-/* T_SNDREL (22)     */ {err, err, err, err, err,   6, err,   2, err},
-/* T_RCVREL (23)     */ {err, err, err, err, err,   7,   2, err, err},
-/* T_PASSCON (24)    */ {err,   5,   5, err, err, err, err, err, err},
+/* T_OPEN (0)        */ {  1, ers, ers, ers, ers, ers, ers, ers, ers},
+/* T_BIND (1)        */ {ers,   2, ers, ers, ers, ers, ers, ers, ers},
+/* T_OPTMGMT (2)     */ {ers,   1,   2,   3,   4,   5,   6,   7, ers},
+/* T_UNBIND (3)      */ {ers, ers,   1, ers, ers, ers, ers, ers, ers},
+/* T_CLOSE (4)       */ {ers,   0, ers, ers, ers, ers, ers, ers, ers},
+/* T_SNDUDATA (5)    */ {ers, ers,   2, ers, ers, ers, ers, ers, ers},
+/* T_RCVUDATA (6)    */ {ers, ers,   2, ers, ers, ers, ers, ers, ers},
+/* T_RCVUDERR (7)    */ {ers, ers,   2, ers, ers, ers, ers, ers, ers},
+/* T_CONNECT1 (8)    */ {ers, ers,   5, ers, ers, ers, ers, ers, ers},
+/* T_CONNECT2 (9)    */ {ers, ers,   3, ers, ers, ers, ers, ers, ers},
+/* T_RCVCONNECT (10) */ {ers, ers, ers,   5, ers, ers, ers, ers, ers},
+/* T_LISTN (11)      */ {ers, ers,   4, ers,   4, ers, ers, ers, ers},
+/* T_ACCEPT1 (12)    */ {ers, ers, ers, ers,   5, ers, ers, ers, ers},
+/* T_ACCEPT2 (13)    */ {ers, ers, ers, ers,   2, ers, ers, ers, ers},
+/* T_ACCEPT3 (14)    */ {ers, ers, ers, ers,   4, ers, ers, ers, ers},
+/* T_SND (15)        */ {ers, ers, ers, ers, ers,   5, ers,   7, ers},
+/* T_RCV (16)        */ {ers, ers, ers, ers, ers,   5,   6, ers, ers},
+/* T_SNDDIS1 (17)    */ {ers, ers, ers,   2,   2,   2,   2,   2, ers},
+/* T_SNDDIS2 (18)    */ {ers, ers, ers, ers,   4, ers, ers, ers, ers},
+/* T_RCVDIS1 (19)    */ {ers, ers, ers,   2, ers,   2,   2,   2, ers},
+/* T_RCVDIS2 (20)    */ {ers, ers, ers, ers,   2, ers, ers, ers, ers},
+/* T_RCVDIS3 (21)    */ {ers, ers, ers, ers,   4, ers, ers, ers, ers},
+/* T_SNDREL (22)     */ {ers, ers, ers, ers, ers,   6, ers,   2, ers},
+/* T_RCVREL (23)     */ {ers, ers, ers, ers, ers,   7,   2, ers, ers},
+/* T_PASSCON (24)    */ {ers,   5,   5, ers, ers, ers, ers, ers, ers},
 
 /*
  * Following state transitions are as in printed specs but wrong
@@ -95,8 +94,8 @@
  * - The incorrect T_OPTMGMT state is what TLI historically implied
  * - The incorrect T_PASSCON state is from the XTI spec.
  *
- * T_OPTMGMT (2)        {err, err,   2, err, err, err, err, err,  err},
- * T_PASSCON (24)       {err, err,   5, err, err, err, err, err,  err},
+ * T_OPTMGMT (2)        {ers, ers,   2, ers, ers, ers, ers, ers,  ers},
+ * T_PASSCON (24)       {ers, ers,   5, ers, ers, ers, ers, ers,  ers},
  */
 
 /* END CSTYLED */
--- a/usr/src/pkgdefs/SUNWhea/prototype_com	Sat Aug 18 06:36:15 2007 -0700
+++ b/usr/src/pkgdefs/SUNWhea/prototype_com	Sat Aug 18 10:07:23 2007 -0700
@@ -206,6 +206,7 @@
 f none usr/include/dlfcn.h 644 root bin
 f none usr/include/door.h 644 root bin
 f none usr/include/elf.h 644 root bin
+f none usr/include/err.h 644 root bin
 f none usr/include/errno.h 644 root bin
 f none usr/include/eti.h 644 root bin
 f none usr/include/euc.h 644 root bin
--- a/usr/src/pkgdefs/etc/exception_list_i386	Sat Aug 18 06:36:15 2007 -0700
+++ b/usr/src/pkgdefs/etc/exception_list_i386	Sat Aug 18 10:07:23 2007 -0700
@@ -119,7 +119,7 @@
 #
 usr/include/ikedoor.h			i386
 usr/include/ipsec_util.h		i386
-usr/include/err.h			i386
+usr/include/errfp.h			i386
 usr/include/ike				i386
 usr/include/ike/certlib.h		i386
 usr/include/ike/pkcs11-glue.h		i386
--- a/usr/src/pkgdefs/etc/exception_list_sparc	Sat Aug 18 06:36:15 2007 -0700
+++ b/usr/src/pkgdefs/etc/exception_list_sparc	Sat Aug 18 10:07:23 2007 -0700
@@ -99,7 +99,7 @@
 #
 usr/include/ikedoor.h			sparc
 usr/include/ipsec_util.h		sparc
-usr/include/err.h			sparc
+usr/include/errfp.h			sparc
 usr/include/ike				sparc
 usr/include/ike/certlib.h		sparc
 usr/include/ike/pkcs11-glue.h		sparc