[hackers] [sbase] Remove DEBUG-define for eprintf.c || FRIGN

From: <git_AT_suckless.org>
Date: Sun, 5 Apr 2015 10:14:04 +0200 (CEST)

commit 3eee8e15096956564305edd28a9ccdbf7f166864
Author: FRIGN <dev_AT_frign.de>
Date: Sun Apr 5 00:34:58 2015 +0200

    Remove DEBUG-define for eprintf.c
    
    Prepend program name only when fmt doesn't begin with "usage".

diff --git a/config.mk b/config.mk
index ba43212..8d4dbe3 100644
--- a/config.mk
+++ b/config.mk
_AT_@ -11,6 +11,6 @@ AR = ar
 RANLIB = ranlib
 
 # For NetBSD add -D_NETBSD_SOURCE
-CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -DDEBUG
+CPPFLAGS = -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700
 CFLAGS = -std=c99 -Wall -pedantic
 LDFLAGS = -s # -lrt
diff --git a/libutil/eprintf.c b/libutil/eprintf.c
index 407c502..4d8f726 100644
--- a/libutil/eprintf.c
+++ b/libutil/eprintf.c
_AT_@ -33,9 +33,8 @@ enprintf(int status, const char *fmt, ...)
 void
 venprintf(int status, const char *fmt, va_list ap)
 {
-#ifdef DEBUG
- fprintf(stderr, "%s: ", argv0);
-#endif
+ if (strncmp(fmt, "usage", strlen("usage")))
+ fprintf(stderr, "%s: ", argv0);
 
         vfprintf(stderr, fmt, ap);
 
_AT_@ -52,9 +51,8 @@ weprintf(const char *fmt, ...)
 {
         va_list ap;
 
-#ifdef DEBUG
- fprintf(stderr, "%s: ", argv0);
-#endif
+ if (strncmp(fmt, "usage", strlen("usage")))
+ fprintf(stderr, "%s: ", argv0);
 
         va_start(ap, fmt);
         vfprintf(stderr, fmt, ap);
Received on Sun Apr 05 2015 - 10:14:04 CEST

This archive was generated by hypermail 2.3.0 : Sun Apr 05 2015 - 10:24:15 CEST