X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=src%2Ftar.c;h=7d87f80159909f0a34b7c3ff493a0496dee6d5cb;hb=02a275c6ac80029c692614e6f9d6896777089b96;hp=69ec97cf6cce192c861489de2c2e25e70c4e084c;hpb=17afd0438f6d86686e9bc6df80e538b3201b889e;p=chaz%2Ftar diff --git a/src/tar.c b/src/tar.c index 69ec97c..7d87f80 100644 --- a/src/tar.c +++ b/src/tar.c @@ -1,7 +1,7 @@ /* A tar (tape archiver) program. - Copyright 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001 Free - Software Foundation, Inc. + Copyright (C) 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001 + Free Software Foundation, Inc. Written by John Gilmore, starting 1985-08-25. @@ -36,6 +36,7 @@ #define GLOBAL #include "common.h" +#include #include #include #include @@ -139,6 +140,7 @@ enum NO_WILDCARDS_MATCH_SLASH_OPTION, NULL_OPTION, OVERWRITE_OPTION, + OVERWRITE_DIR_OPTION, OWNER_OPTION, POSIX_OPTION, PRESERVE_OPTION, @@ -235,6 +237,7 @@ static struct option long_options[] = {"old-archive", no_argument, 0, 'o'}, {"one-file-system", no_argument, 0, 'l'}, {"overwrite", no_argument, 0, OVERWRITE_OPTION}, + {"overwrite-dir", no_argument, 0, OVERWRITE_DIR_OPTION}, {"owner", required_argument, 0, OWNER_OPTION}, {"portability", no_argument, 0, 'o'}, {"posix", no_argument, 0, POSIX_OPTION}, @@ -322,6 +325,7 @@ Operation modifiers:\n\ --remove-files remove files after adding them to the archive\n\ -k, --keep-old-files don't replace existing files when extracting\n\ --overwrite overwrite existing files when extracting\n\ + --overwrite-dir overwrite directory metadata when extracting\n\ -U, --unlink-first remove each file prior to extracting over it\n\ --recursive-unlink empty hierarchies prior to extracting directory\n\ -S, --sparse handle sparse files efficiently\n\ @@ -959,6 +963,10 @@ decode_options (int argc, char **argv) old_files_option = OVERWRITE_OLD_FILES; break; + case OVERWRITE_DIR_OPTION: + old_files_option = OVERWRITE_OLD_DIRS; + break; + case OWNER_OPTION: if (! (strlen (optarg) < UNAME_FIELD_SIZE && uname_to_uid (optarg, &owner_option))) @@ -1122,13 +1130,15 @@ decode_options (int argc, char **argv) if (show_version) { - printf ("tar (GNU %s) %s\n%s\n%s\n%s\n", PACKAGE, VERSION, - "Copyright 2001 Free Software Foundation, Inc.", - _("\ + printf ("tar (GNU %s) %s\n", PACKAGE, VERSION); + print_copyright ("2001 Free Software Foundation, Inc."); + puts (_("\ This program comes with NO WARRANTY, to the extent permitted by law.\n\ You may redistribute it under the terms of the GNU General Public License;\n\ -see the file named COPYING for details."), - _("Written by John Gilmore and Jay Fenlason.")); +see the file named COPYING for details.")); + + puts (_("Written by John Gilmore and Jay Fenlason.")); + exit (TAREXIT_SUCCESS); }