aubinator: only use program_invocation_short_name with glibc/cygwin

program_invocation_short_name is a gnu extension.  Limit use of it
to glibc and cygwin and otherwise use getprogname() which is available
on BSD and OS X.

Signed-off-by: Jonathan Gray <jsg@jsg.id.au>
Reviewed-by: Kristian Høgsberg <krh@bitplanet.net>
Reviewed-by: Emil Velikov <emil.velikov@collabora.com>
This commit is contained in:
Jonathan Gray
2016-09-02 03:12:26 +10:00
committed by Emil Velikov
parent 2d3ebb474c
commit d50c56f868

View File

@@ -1014,6 +1014,12 @@ setup_pager(void)
static void static void
print_help(FILE *file) print_help(FILE *file)
{ {
const char *progname;
#if defined(__GLIBC__) || defined(__CYGWIN__)
progname = program_invocation_short_name;
#else
progname = getprogname();
#endif
fprintf(file, fprintf(file,
"Usage: %s [OPTION]... FILE\n" "Usage: %s [OPTION]... FILE\n"
"Decode aub file contents.\n\n" "Decode aub file contents.\n\n"
@@ -1025,7 +1031,7 @@ print_help(FILE *file)
" if omitted), 'always', or 'never'\n" " if omitted), 'always', or 'never'\n"
" --no-pager don't launch pager\n" " --no-pager don't launch pager\n"
" --no-offsets don't print instruction offsets\n", " --no-offsets don't print instruction offsets\n",
basename(program_invocation_name)); basename(progname));
} }
static bool static bool