From 0c4161ce8533b834f854b341def78a18b857f094 Mon Sep 17 00:00:00 2001 From: Jonathan Moore Liles Date: Mon, 8 Apr 2013 20:57:43 -0700 Subject: [PATCH] nonlib: Use GNU extension program_invocation_short_name to get module name for debug output. --- nonlib/debug.C | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/nonlib/debug.C b/nonlib/debug.C index f5275be..fe64e7e 100644 --- a/nonlib/debug.C +++ b/nonlib/debug.C @@ -23,6 +23,8 @@ #include #include +extern char * program_invocation_short_name; + void warnf ( warning_t level, const char *module, @@ -36,8 +38,10 @@ warnf ( warning_t level, "assertion", "\033[1;31m" }; + module = program_invocation_short_name; + if ( module ) - fprintf( stderr, "[%s] ", module ); + fprintf( stderr, "[\033[1;30m%s\033[0m] ", module ); #ifndef NDEBUG if ( file ) fprintf( stderr, "%s", file );