summaryrefslogtreecommitdiff
path: root/tar/bsdtar.c
diff options
context:
space:
mode:
authorJean-Yves Migeon <jeanyves.migeon@free.fr>2013-09-06 17:17:57 +0200
committerJean-Yves Migeon <jeanyves.migeon@free.fr>2013-09-06 17:17:57 +0200
commitdc207e4669c73203f2fe834294157616a82d6287 (patch)
tree60330e1588e6f7994d6a12555dad94215cbad4fd /tar/bsdtar.c
parent7ba6dff66d176a7ee299258eef1489d0b9ffd225 (diff)
downloadlibarchive-dc207e4669c73203f2fe834294157616a82d6287.tar.gz
Hide *lafe_progname and provide getter/setter instead.
This factorizes some code between binaries like bsdtar, bsdcpio, and the soon-to-be mtree.
Diffstat (limited to 'tar/bsdtar.c')
-rw-r--r--tar/bsdtar.c21
1 files changed, 5 insertions, 16 deletions
diff --git a/tar/bsdtar.c b/tar/bsdtar.c
index 47267579..8b05b401 100644
--- a/tar/bsdtar.c
+++ b/tar/bsdtar.c
@@ -178,21 +178,10 @@ main(int argc, char **argv)
}
#endif
-
- /* Need lafe_progname before calling lafe_warnc. */
+ /* Set lafe_progname before calling lafe_warnc. */
if (*argv == NULL)
- lafe_progname = "bsdtar";
- else {
-#if defined(_WIN32) && !defined(__CYGWIN__)
- lafe_progname = strrchr(*argv, '\\');
- if (strrchr(*argv, '/') > lafe_progname)
-#endif
- lafe_progname = strrchr(*argv, '/');
- if (lafe_progname != NULL)
- lafe_progname++;
- else
- lafe_progname = *argv;
- }
+ *argv = "bsdtar";
+ lafe_setprogname(*argv);
#if HAVE_SETLOCALE
if (setlocale(LC_ALL, "") == NULL)
@@ -844,7 +833,7 @@ usage(void)
{
const char *p;
- p = lafe_progname;
+ p = lafe_getprogname();
fprintf(stderr, "Usage:\n");
fprintf(stderr, " List: %s -tf <archive-filename>\n", p);
@@ -904,7 +893,7 @@ long_help(void)
const char *prog;
const char *p;
- prog = lafe_progname;
+ prog = lafe_getprogname();
fflush(stderr);