#include <string.h>
#include <signal.h>
#include <errno.h>
-#include <libgen.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
}
static void
-print_help(FILE *file)
+print_help(const char *progname, FILE *file)
{
- const char *progname;
-#if defined(__GLIBC__) || defined(__CYGWIN__)
- progname = program_invocation_short_name;
-#else
- progname = getprogname();
-#endif
fprintf(file,
"Usage: %s [OPTION]... FILE\n"
"Decode aub file contents.\n\n"
" if omitted), 'always', or 'never'\n"
" --no-pager don't launch pager\n"
" --no-offsets don't print instruction offsets\n",
- basename(progname));
+ progname);
}
static bool
char gen_file[256], gen_val[24];
if (argc == 1) {
- print_help(stderr);
+ print_help(argv[0], stderr);
exit(EXIT_FAILURE);
}
exit(EXIT_FAILURE);
}
} else if (strcmp(argv[i], "--help") == 0) {
- print_help(stdout);
+ print_help(argv[0], stdout);
exit(EXIT_SUCCESS);
} else {
if (argv[i][0] == '-') {
disasm = gen_disasm_create(pci_id);
if (argv[i] == NULL) {
- print_help(stderr);
+ print_help(argv[0], stderr);
exit(EXIT_FAILURE);
} else {
file = aub_file_open(argv[i]);