/* 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) {
} 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");
}
}
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.