summaryrefslogtreecommitdiff
path: root/devel/bmake/files/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'devel/bmake/files/util.c')
-rw-r--r--devel/bmake/files/util.c97
1 files changed, 92 insertions, 5 deletions
diff --git a/devel/bmake/files/util.c b/devel/bmake/files/util.c
index cb6b055e6d7..89210546bf3 100644
--- a/devel/bmake/files/util.c
+++ b/devel/bmake/files/util.c
@@ -1,18 +1,18 @@
-/* $NetBSD: util.c,v 1.1.1.8 2010/09/07 14:12:10 joerg Exp $ */
+/* $NetBSD: util.c,v 1.1.1.9 2011/06/18 22:18:10 bsiegert Exp $ */
/*
* Missing stuff from OS's
*
- * $Id: util.c,v 1.1.1.8 2010/09/07 14:12:10 joerg Exp $
+ * $Id: util.c,v 1.1.1.9 2011/06/18 22:18:10 bsiegert Exp $
*/
#include "make.h"
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: util.c,v 1.1.1.8 2010/09/07 14:12:10 joerg Exp $";
+static char rcsid[] = "$NetBSD: util.c,v 1.1.1.9 2011/06/18 22:18:10 bsiegert Exp $";
#else
#ifndef lint
-__RCSID("$NetBSD: util.c,v 1.1.1.8 2010/09/07 14:12:10 joerg Exp $");
+__RCSID("$NetBSD: util.c,v 1.1.1.9 2011/06/18 22:18:10 bsiegert Exp $");
#endif
#endif
@@ -47,7 +47,7 @@ findenv(const char *name, int *offset)
char *p, *q;
for (i = 0; (q = environ[i]); i++) {
- char *p = strchr(q, '=');
+ p = strchr(q, '=');
if (p == NULL)
continue;
if (strncmp(name, q, len = p - q) == 0) {
@@ -526,3 +526,90 @@ killpg(int pid, int sig)
}
#endif
#endif
+
+#if !defined(HAVE_WARNX)
+static void
+vwarnx(const char *fmt, va_list args)
+{
+ fprintf(stderr, "%s: ", progname);
+ if ((fmt)) {
+ vfprintf(stderr, fmt, args);
+ fprintf(stderr, ": ");
+ }
+}
+#endif
+
+#if !defined(HAVE_WARN)
+static void
+vwarn(const char *fmt, va_list args)
+{
+ vwarnx(fmt, args);
+ fprintf(stderr, "%s\n", strerror(errno));
+}
+#endif
+
+#if !defined(HAVE_ERR)
+static void
+verr(int eval, const char *fmt, va_list args)
+{
+ vwarn(fmt, args);
+ exit(eval);
+}
+#endif
+
+#if !defined(HAVE_ERRX)
+static void
+verrx(int eval, const char *fmt, va_list args)
+{
+ vwarnx(fmt, args);
+ exit(eval);
+}
+#endif
+
+#if !defined(HAVE_ERR)
+void
+err(int eval, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ verr(eval, fmt, ap);
+ va_end(ap);
+}
+#endif
+
+#if !defined(HAVE_ERRX)
+void
+errx(int eval, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ verrx(eval, fmt, ap);
+ va_end(ap);
+}
+#endif
+
+#if !defined(HAVE_WARN)
+void
+warn(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vwarn(fmt, ap);
+ va_end(ap);
+}
+#endif
+
+#if !defined(HAVE_WARNX)
+void
+warnx(const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ vwarnx(fmt, ap);
+ va_end(ap);
+}
+#endif