summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--usr.bin/make/util.c18
-rw-r--r--usr.bin/make/util.h6
2 files changed, 24 insertions, 0 deletions
diff --git a/usr.bin/make/util.c b/usr.bin/make/util.c
index ba11f4b..e0dbfdc 100644
--- a/usr.bin/make/util.c
+++ b/usr.bin/make/util.c
@@ -86,6 +86,24 @@ Debug(const char *fmt, ...)
}
/*-
+ * Print a debugging message given its format and append the current
+ * errno description. Terminate with a newline.
+ */
+/* VARARGS */
+void
+DebugM(const char *fmt, ...)
+{
+ va_list ap;
+ int e = errno;
+
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ fprintf(stderr, ": %s\n", strerror(e));
+ va_end(ap);
+ fflush(stderr);
+}
+
+/*-
* Error --
* Print an error message given its format.
*
diff --git a/usr.bin/make/util.h b/usr.bin/make/util.h
index 1d65db0..84fc6b9 100644
--- a/usr.bin/make/util.h
+++ b/usr.bin/make/util.h
@@ -70,11 +70,17 @@ do { \
Debug args ; \
} \
} while (0)
+#define DEBUGM(module, args) do { \
+ if (DEBUG(module)) { \
+ DebugM args; \
+ } \
+ } while (0)
#define ISDOT(c) ((c)[0] == '.' && (((c)[1] == '\0') || ((c)[1] == '/')))
#define ISDOTDOT(c) ((c)[0] == '.' && ISDOT(&((c)[1])))
void Debug(const char *, ...);
+void DebugM(const char *, ...);
void Error(const char *, ...);
void Fatal(const char *, ...) __dead2;
void Punt(const char *, ...) __dead2;
OpenPOWER on IntegriCloud