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 <stdarg.h>
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 );