diff options
-rw-r--r-- | difftool/options.c | 2 | ||||
-rw-r--r-- | include/common.h | 9 | ||||
-rw-r--r-- | lib/common/print_version.c | 6 | ||||
-rw-r--r-- | mkfs/options.c | 10 | ||||
-rw-r--r-- | tar/sqfs2tar.c | 2 | ||||
-rw-r--r-- | tar/tar2sqfs.c | 2 | ||||
-rw-r--r-- | unpack/options.c | 10 |
7 files changed, 15 insertions, 26 deletions
diff --git a/difftool/options.c b/difftool/options.c index 37465e8..0540cf7 100644 --- a/difftool/options.c +++ b/difftool/options.c @@ -102,7 +102,7 @@ void process_options(sqfsdiff_t *sd, int argc, char **argv) fputs(usagestr, stdout); exit(0); case 'V': - print_version(); + print_version("sqfsdiff"); exit(0); default: goto fail_arg; diff --git a/include/common.h b/include/common.h index 676dd6a..93bbb26 100644 --- a/include/common.h +++ b/include/common.h @@ -157,12 +157,7 @@ int pushdn(const char *path, size_t len); /* Returns 0 on success. On failure, prints error message to stderr. */ int popd(void); -/* - A common implementation of the '--version' command line flag. - - Prints out version information. The program name is extracted from the - BSD style __progname global variable. -*/ -void print_version(void); +/* A common implementation of the '--version' command line flag. */ +void print_version(const char *progname); #endif /* COMMON_H */ diff --git a/lib/common/print_version.c b/lib/common/print_version.c index 6e36614..0c7fe5c 100644 --- a/lib/common/print_version.c +++ b/lib/common/print_version.c @@ -12,8 +12,6 @@ #define LICENSE_LONG "GNU GPL version 3 or later" #define LICENSE_URL "https://gnu.org/licenses/gpl.html" -extern char *__progname; - static const char *version_string = "%s (%s) %s\n" "Copyright (c) 2019 David Oberhollenzer et al\n" @@ -21,7 +19,7 @@ static const char *version_string = "This is free software: you are free to change and redistribute it.\n" "There is NO WARRANTY, to the extent permitted by law.\n"; -void print_version(void) +void print_version(const char *progname) { - printf(version_string, __progname, PACKAGE_NAME, PACKAGE_VERSION); + printf(version_string, progname, PACKAGE_NAME, PACKAGE_VERSION); } diff --git a/mkfs/options.c b/mkfs/options.c index d741d1a..83f1bae 100644 --- a/mkfs/options.c +++ b/mkfs/options.c @@ -40,10 +40,8 @@ static const char *short_opts = "F:D:X:c:b:B:d:j:Q:kxoefqhV" #endif ; -extern char *__progname; - static const char *help_string = -"Usage: %s [OPTIONS...] <squashfs-file>\n" +"Usage: gensquashfs [OPTIONS...] <squashfs-file>\n" "\n" "Possible options:\n" "\n" @@ -231,13 +229,13 @@ void process_command_line(options_t *opt, int argc, char **argv) break; #endif case 'h': - printf(help_string, __progname, + printf(help_string, SQFS_DEFAULT_BLOCK_SIZE, SQFS_DEVBLK_SIZE); fputs(help_details, stdout); compressor_print_available(); exit(EXIT_SUCCESS); case 'V': - print_version(); + print_version("gensquashfs"); exit(EXIT_SUCCESS); default: goto fail_arg; @@ -269,6 +267,6 @@ void process_command_line(options_t *opt, int argc, char **argv) opt->cfg.filename = argv[optind++]; return; fail_arg: - fprintf(stderr, "Try `%s --help' for more information.\n", __progname); + fputs("Try `gensquashfs --help' for more information.\n", stderr); exit(EXIT_FAILURE); } diff --git a/tar/sqfs2tar.c b/tar/sqfs2tar.c index af116b8..8eac991 100644 --- a/tar/sqfs2tar.c +++ b/tar/sqfs2tar.c @@ -126,7 +126,7 @@ static void process_args(int argc, char **argv) fputs(usagestr, stdout); goto out_success; case 'V': - print_version(); + print_version("sqfs2tar"); goto out_success; default: goto fail_arg; diff --git a/tar/tar2sqfs.c b/tar/tar2sqfs.c index 4634364..94168fc 100644 --- a/tar/tar2sqfs.c +++ b/tar/tar2sqfs.c @@ -163,7 +163,7 @@ static void process_args(int argc, char **argv) compressor_print_available(); exit(EXIT_SUCCESS); case 'V': - print_version(); + print_version("tar2sqfs"); exit(EXIT_SUCCESS); default: goto fail_arg; diff --git a/unpack/options.c b/unpack/options.c index 7a96123..b9d4744 100644 --- a/unpack/options.c +++ b/unpack/options.c @@ -38,7 +38,7 @@ static const char *short_opts = ; static const char *help_string = -"Usage: %s [OPTIONS] <squashfs-file>\n" +"Usage: rdsquashfs [OPTIONS] <squashfs-file>\n" "\n" "View or extract the contents of a squashfs image.\n" "\n" @@ -83,8 +83,6 @@ static const char *help_string = " --version, -V Print version information and exit.\n" "\n"; -extern const char *__progname; - static char *get_path(char *old, const char *arg) { char *path; @@ -183,11 +181,11 @@ void process_command_line(options_t *opt, int argc, char **argv) opt->flags |= UNPACK_QUIET; break; case 'h': - printf(help_string, __progname); + fputs(help_string, stdout); free(opt->cmdpath); exit(EXIT_SUCCESS); case 'V': - print_version(); + print_version("rdsquashfs"); free(opt->cmdpath); exit(EXIT_SUCCESS); default: @@ -212,7 +210,7 @@ void process_command_line(options_t *opt, int argc, char **argv) opt->image_name = argv[optind++]; return; fail_arg: - fprintf(stderr, "Try `%s --help' for more information.\n", __progname); + fputs("Try `rdsquashfs --help' for more information.\n", stderr); free(opt->cmdpath); exit(EXIT_FAILURE); } |