add support for program_invocation[_short]_name
this is a bit ugly, and the motivation for supporting it is questionable. however the main factors were: 1. it will be useful to have this for certain internal purposes anyway -- things like syslog. 2. applications can just save argv[0] in main, but it's hard to fix non-portable library code that's depending on being able to get the invocation name without the main application's help.
This commit is contained in:
parent
5c5ac810c3
commit
b4ea63856a
3 changed files with 18 additions and 2 deletions
|
|
@ -5,6 +5,8 @@
|
|||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include <features.h>
|
||||
|
||||
#include <bits/errno.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
|
@ -13,6 +15,10 @@ __attribute__((const))
|
|||
int *__errno_location(void);
|
||||
#define errno (*__errno_location())
|
||||
|
||||
#ifdef _GNU_SOURCE
|
||||
extern char *program_invocation_short_name, *program_invocation_name;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue