diff options
author | kientzle <kientzle@FreeBSD.org> | 2004-08-07 03:24:49 +0000 |
---|---|---|
committer | kientzle <kientzle@FreeBSD.org> | 2004-08-07 03:24:49 +0000 |
commit | a34feb1b97eeddad92bc8a7aab3be391247ff685 (patch) | |
tree | 8cd1365aae2daecf40fb6ba0c152ff1f524aa6c6 /usr.bin/tar/bsdtar.c | |
parent | 237a0ce1f8117c40c606f8734ead347261516646 (diff) | |
download | FreeBSD-src-a34feb1b97eeddad92bc8a7aab3be391247ff685.zip FreeBSD-src-a34feb1b97eeddad92bc8a7aab3be391247ff685.tar.gz |
Add "make distfile" capabilities to bsdtar, including informational
COPYING file and some conditional compilation cleanups.
Diffstat (limited to 'usr.bin/tar/bsdtar.c')
-rw-r--r-- | usr.bin/tar/bsdtar.c | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/usr.bin/tar/bsdtar.c b/usr.bin/tar/bsdtar.c index c4f00a7..aa9fc95 100644 --- a/usr.bin/tar/bsdtar.c +++ b/usr.bin/tar/bsdtar.c @@ -47,18 +47,29 @@ struct option { #define no_argument 0 #define required_argument 1 #endif -#ifdef HAVE_NL_LANGINFO_D_MD_ORDER +#ifdef HAVE_LANGINFO_H #include <langinfo.h> #endif #include <locale.h> +#ifdef HAVE_PATHS_H +#include <paths.h> +#endif #include <stdio.h> #include <stdlib.h> #include <string.h> #include <time.h> #include <unistd.h> +#if HAVE_ZLIB_H +#include <zlib.h> +#endif #include "bsdtar.h" +#ifndef _PATH_DEFTAPE +#define _PATH_DEFTAPE "/dev/tape" +#endif + + static int bsdtar_getopt(struct bsdtar *, const char *optstring, const struct option **poption); static void long_help(struct bsdtar *); @@ -171,7 +182,7 @@ main(int argc, char **argv) if (setlocale(LC_ALL, "") == NULL) bsdtar_warnc(bsdtar, 0, "Failed to set default locale"); -#ifdef HAVE_NL_LANGINFO_D_MD_ORDER +#if defined(HAVE_NL_LANGINFO) && defined(HAVE_D_MD_ORDER) bsdtar->day_first = (*nl_langinfo(D_MD_ORDER) == 'd'); #endif mode = '\0'; @@ -269,11 +280,16 @@ main(int argc, char **argv) optarg); break; case 'j': /* GNU tar */ +#if HAVE_LIBBZ2 if (bsdtar->create_compression != '\0') bsdtar_errc(bsdtar, 1, 0, "Can't specify both -%c and -%c", opt, bsdtar->create_compression); bsdtar->create_compression = opt; +#else + bsdtar_warnc(bsdtar, 0, "-j compression not supported by this version of bsdtar"); + usage(bsdtar); +#endif break; case 'k': /* GNU tar */ bsdtar->extract_flags |= ARCHIVE_EXTRACT_NO_OVERWRITE; @@ -395,11 +411,16 @@ main(int argc, char **argv) mode = opt; break; case 'y': /* FreeBSD version of GNU tar */ +#if HAVE_LIBBZ2 if (bsdtar->create_compression != '\0') bsdtar_errc(bsdtar, 1, 0, "Can't specify both -%c and -%c", opt, bsdtar->create_compression); bsdtar->create_compression = opt; +#else + bsdtar_warnc(bsdtar, 0, "-y compression not supported by this version of bsdtar"); + usage(bsdtar); +#endif break; case 'Z': /* GNU tar */ if (bsdtar->create_compression != '\0') @@ -409,13 +430,19 @@ main(int argc, char **argv) bsdtar->create_compression = opt; break; case 'z': /* GNU tar, star, many others */ +#if HAVE_LIBZ if (bsdtar->create_compression != '\0') bsdtar_errc(bsdtar, 1, 0, "Can't specify both -%c and -%c", opt, bsdtar->create_compression); bsdtar->create_compression = opt; +#else + bsdtar_warnc(bsdtar, 0, "-z compression not supported by this version of bsdtar"); + usage(bsdtar); +#endif break; default: + bsdtar_warnc(bsdtar, 0, "Unrecognized option -c", optopt); usage(bsdtar); } } @@ -682,8 +709,8 @@ long_help(struct bsdtar *bsdtar) } else putchar(*p); } - printf("\n"); - version(); + fprintf(stdout, "\n%s %s\n", PACKAGE_NAME, PACKAGE_VERSION); + fprintf(stdout, "%s\n", archive_version()); } static int |