Improve documentation, update man

This commit is contained in:
senhuang42 2020-08-27 17:57:20 -04:00
parent 7e867ad61f
commit 01828b27e2
2 changed files with 14 additions and 6 deletions

View File

@ -791,13 +791,18 @@ static void FIO_adjustMemLimitForPatchFromMode(FIO_prefs_t* const prefs,
/* FIO_removeMultiFilesWarning() : /* FIO_removeMultiFilesWarning() :
* Returns 1 if the console should abort, 0 if console should proceed. * 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 * This function handles logic when processing multiple files with -o, displaying the appropriate warnings/prompts.
* function may print a warning message, a user prompt, both, or none. *
* 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) static int FIO_removeMultiFilesWarning(const FIO_prefs_t* const prefs, int displayLevelCutoff, const char* outFileName)
{ {
int error; int error = 0;
error = 0;
if (prefs->nbFiles > 1 && !prefs->overwrite) { if (prefs->nbFiles > 1 && !prefs->overwrite) {
if (g_display_prefs.displayLevel <= displayLevelCutoff) { if (g_display_prefs.displayLevel <= displayLevelCutoff) {
if (prefs->removeSrcFile) { if (prefs->removeSrcFile) {
@ -810,8 +815,10 @@ static int FIO_removeMultiFilesWarning(const FIO_prefs_t* const prefs, int displ
} else { } else {
DISPLAYLEVEL(2, "zstd: WARNING: all input files will be processed and concatenated into a single output file: %s ", outFileName); 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"); error = g_display_prefs.displayLevel > displayLevelCutoff && UTIL_requireUserConfirmation("Proceed? (y/n): ", "Aborting...", "yY");
}
DISPLAY("\n"); DISPLAY("\n");
} }
} }

View File

@ -213,7 +213,8 @@ the last one takes effect.
and disabled when output is stdout. and disabled when output is stdout.
This setting overrides default and can force sparse mode over stdout. This setting overrides default and can force sparse mode over stdout.
* `--rm`: * `--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`: * `-k`, `--keep`:
keep source file(s) after successful compression or decompression. keep source file(s) after successful compression or decompression.
This is the default behavior. This is the default behavior.