]> git.ipfire.org Git - thirdparty/zstd.git/commitdiff
Improve documentation, update man
authorsenhuang42 <senhuang96@fb.com>
Thu, 27 Aug 2020 21:57:20 +0000 (17:57 -0400)
committersenhuang42 <senhuang96@fb.com>
Thu, 27 Aug 2020 21:57:20 +0000 (17:57 -0400)
programs/fileio.c
programs/zstd.1.md

index 3eaa0455add86dd4b0a7dc8c813cb38055b3703d..03b282b8898699a47911211291e1806c7aaca0a9 100644 (file)
@@ -791,13 +791,18 @@ static void FIO_adjustMemLimitForPatchFromMode(FIO_prefs_t* const prefs,
 
 /* FIO_removeMultiFilesWarning() :
  * Returns 1 if the console should abort, 0 if console should proceed.
- * Based on displayLevelCutoff (typically == 1) and the global setting g_display_prefs.displayLevel, this
- * function may print a warning message, a user prompt, both, or none.
+ * This function handles logic when processing multiple files with -o, displaying the appropriate warnings/prompts.
+ * 
+ * If -f is specified, or there is just 1 file, zstd will always proceed as usual.
+ * If --rm is specified, there will be a prompt asking for user confirmation.
+ *         If -f is specified with --rm, zstd will proceed as usual
+ *         If -q is specified with --rm, zstd will abort pre-emptively
+ *         If neither flag is specified, zstd will prompt the user for confirmation to proceed.
+ * If --rm is not specified, then zstd may print a warning to the user.
  */
 static int FIO_removeMultiFilesWarning(const FIO_prefs_t* const prefs, int displayLevelCutoff, const char* outFileName)
 {
-    int error;
-    error = 0;
+    int error = 0;
     if (prefs->nbFiles > 1 && !prefs->overwrite) {
         if (g_display_prefs.displayLevel <= displayLevelCutoff) {
             if (prefs->removeSrcFile) {
@@ -810,8 +815,10 @@ static int FIO_removeMultiFilesWarning(const FIO_prefs_t* const prefs, int displ
             } else {
                 DISPLAYLEVEL(2, "zstd: WARNING: all input files will be processed and concatenated into a single output file: %s ", outFileName);
             }
-            if (prefs->removeSrcFile)
+            if (prefs->removeSrcFile) {
+                DISPLAYLEVEL(2, "\nThe concatenated output CANNOT regenerate the original directory tree. This is a destructive operation. ")
                 error = g_display_prefs.displayLevel > displayLevelCutoff && UTIL_requireUserConfirmation("Proceed? (y/n): ", "Aborting...", "yY");
+            }
             DISPLAY("\n");
         }
     }
index 5b90b2df08e660f9f1a6ef23743437e76529d751..e7fa9cd4ef5d0b4fac14e42710050dc0bca47fd3 100644 (file)
@@ -213,7 +213,8 @@ the last one takes effect.
     and disabled when output is stdout.
     This setting overrides default and can force sparse mode over stdout.
 * `--rm`:
-    remove source file(s) after successful compression or decompression
+    remove source file(s) after successful compression or decompression. If used in combination with
+    -o, will trigger a confirmation prompt (which can be silenced with -f), as this is a destructive operation. 
 * `-k`, `--keep`:
     keep source file(s) after successful compression or decompression.
     This is the default behavior.