]> Dogcows Code - chaz/tar/commitdiff
Warn about existing files in keep-old-files mode (complements 8f390db9).
authorSergey Poznyakoff <gray@gnu.org.ua>
Thu, 17 Nov 2011 20:19:05 +0000 (22:19 +0200)
committerSergey Poznyakoff <gray@gnu.org.ua>
Thu, 17 Nov 2011 20:19:05 +0000 (22:19 +0200)
This is controlled by "existing-file" warning code, which is off
by default.

* src/common.h (WARN_EXISTING_FILE): New warning code.
(WARN_VERBOSE_WARNINGS): Add WARN_EXISTING_FILE.
* src/extract.c (maybe_recoverable): warn about existing file
if WARN_EXISTING_FILE is set.
* src/warning.c: New warning type: "existing-file"

src/common.h
src/extract.c
src/warning.c

index c29ffc0d5d5fa878cd8e84dd32674399786fce90..b60c4a0730c45f53c16da92a92fe49bbcc7e9158 100644 (file)
@@ -810,11 +810,12 @@ void checkpoint_run (bool do_write);
 #define WARN_UNKNOWN_KEYWORD     0x00020000
 #define WARN_XDEV                0x00040000
 #define WARN_DECOMPRESS_PROGRAM  0x00080000
+#define WARN_EXISTING_FILE       0x00100000
 
 /* The warnings composing WARN_VERBOSE_WARNINGS are enabled by default
    in verbose mode */
 #define WARN_VERBOSE_WARNINGS    (WARN_RENAME_DIRECTORY|WARN_NEW_DIRECTORY|\
-                                 WARN_DECOMPRESS_PROGRAM)
+                                 WARN_DECOMPRESS_PROGRAM|WARN_EXISTING_FILE)
 #define WARN_ALL                 (~WARN_VERBOSE_WARNINGS)
 
 void set_warning_option (const char *arg);
index d24f98f605e12137c893099b21b724c44c63f661..60ec747f72a9e94d192ab30a31e4da91adf4f1a3 100644 (file)
@@ -643,6 +643,8 @@ maybe_recoverable (char *file_name, bool regular, bool *interdir_made)
       switch (old_files_option)
        {
        case KEEP_OLD_FILES:
+         WARNOPT (WARN_EXISTING_FILE,
+                  (0, 0, _("%s: skipping existing file"), file_name));
          return RECOVER_SKIP;
 
        case KEEP_NEWER_FILES:
index 5d1bcabc64ee163c010562f56035266e348e0bfb..102364d515b200879b51becabd615a807dbd82bf 100644 (file)
@@ -42,6 +42,7 @@ static char const *const warning_args[] = {
   "unknown-keyword",
   "xdev",
   "decompress-program",
+  "existing-file",
   NULL
 };
 
@@ -66,7 +67,8 @@ static int warning_types[] = {
   WARN_UNKNOWN_CAST,
   WARN_UNKNOWN_KEYWORD,
   WARN_XDEV,
-  WARN_DECOMPRESS_PROGRAM
+  WARN_DECOMPRESS_PROGRAM,
+  WARN_EXISTING_FILE
 };
 
 ARGMATCH_VERIFY (warning_args, warning_types);
This page took 0.031607 seconds and 4 git commands to generate.