sbase

suckless unix tools
git clone git://git.2f30.org/sbase.git
Log | Files | Refs | README | LICENSE

commit f4847603ef900ca74ecb62557d8c5665c6c777c9
parent 5ed8e31658898433f6748d9059737b339f1d9476
Author: FRIGN <dev@frign.de>
Date:   Sun Apr  5 00:34:58 +0200

Remove DEBUG-define for eprintf.c

Prepend program name only when fmt doesn't begin with "usage".

Diffstat:
config.mk | 2+-
libutil/eprintf.c | 10++++------
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/config.mk b/config.mk @@ -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 @@ -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); @@ -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);