nonlib: Use GNU extension program_invocation_short_name to get module name for debug output.

This commit is contained in:
Jonathan Moore Liles 2013-04-08 20:57:43 -07:00
parent c794617b30
commit 0c4161ce85
1 changed files with 5 additions and 1 deletions

View File

@ -23,6 +23,8 @@
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
extern char * program_invocation_short_name;
void void
warnf ( warning_t level, warnf ( warning_t level,
const char *module, const char *module,
@ -36,8 +38,10 @@ warnf ( warning_t level,
"assertion", "\033[1;31m" "assertion", "\033[1;31m"
}; };
module = program_invocation_short_name;
if ( module ) if ( module )
fprintf( stderr, "[%s] ", module ); fprintf( stderr, "[\033[1;30m%s\033[0m] ", module );
#ifndef NDEBUG #ifndef NDEBUG
if ( file ) if ( file )
fprintf( stderr, "%s", file ); fprintf( stderr, "%s", file );