]> jfr.im git - irc/evilnet/x3.git/commitdiff
srvx sync: When MAIN_LOG is NULL, report to stderr
authorsirvulcan <redacted>
Tue, 22 Sep 2009 06:55:05 +0000 (06:55 +0000)
committersirvulcan <redacted>
Tue, 22 Sep 2009 06:55:05 +0000 (06:55 +0000)
ChangeLog
src/recdb.c

index 75840d5817373fc4dfd16e50797344a731cb13e8..f38619d43234b93f3f6de3bb02c93b3e1603a8d7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,12 @@
 /***********************************************************************
 X3 ChangeLog
 
+2009-09-22  Neil Spierling  <sirvulcan@sirvulcan.co.nz>
+
+       * Srvx sync. Author: Michael Poole.
+
+       * src/recdb.c (explain_failure): When MAIN_LOG is NULL, report to stderr.
+
 2009-09-19  Neil Spierling  <sirvulcan@sirvulcan.co.nz>
 
        * Srvx sync. Author: Michael Poole.
index f42284cdb30770a2ac07897c78df9d71d7cd0cdc..4fc9e3c2c9e1f59e7c9f91e6470d654fae97125a 100644 (file)
@@ -572,9 +572,16 @@ failure_reason(int code)
 void
 explain_failure(RECDB *recdb, int code)
 {
-    log_module(MAIN_LOG, LOG_ERROR, "%s (got '%c') at %s line %d column %d.",
-               failure_reason(code), code & 255,
-               recdb->source, recdb->ctx.line, recdb->ctx.col);
+    static char msg[1024];
+    snprintf(msg, sizeof(msg), "%s (got '%c') at %s line %d column %d.",
+             failure_reason(code), code & 255,
+             recdb->source, recdb->ctx.line, recdb->ctx.col);
+    if (MAIN_LOG == NULL) {
+        fputs(msg, stderr);
+        fputc('\n', stderr);
+        fflush(stderr);
+    } else
+        log_module(MAIN_LOG, LOG_ERROR, "%s", msg);
 }
 
 const char *