nonlib: Use GNU extension program_invocation_short_name to get module name for debug output.
This commit is contained in:
parent
c794617b30
commit
0c4161ce85
|
@ -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 );
|
||||||
|
|
Loading…
Reference in New Issue