diff options
Diffstat (limited to 'src/bfstd.c')
-rw-r--r-- | src/bfstd.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/bfstd.c b/src/bfstd.c index 0e8ba5f..1f4bbb2 100644 --- a/src/bfstd.c +++ b/src/bfstd.c @@ -143,6 +143,21 @@ char *xgetdelim(FILE *file, char delim) { } } +const char *xgetprogname(void) { + const char *cmd = NULL; +#if __GLIBC__ + cmd = program_invocation_short_name; +#elif BSD + cmd = getprogname(); +#endif + + if (!cmd) { + cmd = BFS_COMMAND; + } + + return cmd; +} + /** Compile and execute a regular expression for xrpmatch(). */ static int xrpregex(nl_item item, const char *response) { const char *pattern = nl_langinfo(item); |