FIO_removeMultiFilesWarning() : * Returns 1 if the console should abort, 0 if console should proceed. * 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
| 850 | * However, if the output is stdout, we will always abort rather than displaying the warning prompt. |
| 851 | */ |
| 852 | static int FIO_removeMultiFilesWarning(FIO_ctx_t* const fCtx, const FIO_prefs_t* const prefs, const char* outFileName, int displayLevelCutoff) |
| 853 | { |
| 854 | int error = 0; |
| 855 | if (fCtx->nbFilesTotal > 1 && !prefs->overwrite) { |
| 856 | if (g_display_prefs.displayLevel <= displayLevelCutoff) { |
| 857 | if (prefs->removeSrcFile) { |
| 858 | DISPLAYLEVEL(1, "zstd: Aborting... not deleting files and processing into dst: %s", outFileName); |
| 859 | error = 1; |
| 860 | } |
| 861 | } else { |
| 862 | if (!strcmp(outFileName, stdoutmark)) { |
| 863 | DISPLAYLEVEL(2, "zstd: WARNING: all input files will be processed and concatenated into stdout. "); |
| 864 | } else { |
| 865 | DISPLAYLEVEL(2, "zstd: WARNING: all input files will be processed and concatenated into a single output file: %s ", outFileName); |
| 866 | } |
| 867 | DISPLAYLEVEL(2, "\nThe concatenated output CANNOT regenerate the original directory tree. ") |
| 868 | if (prefs->removeSrcFile) { |
| 869 | if (fCtx->hasStdoutOutput) { |
| 870 | DISPLAYLEVEL(1, "\nAborting. Use -f if you really want to delete the files and output to stdout"); |
| 871 | error = 1; |
| 872 | } else { |
| 873 | error = g_display_prefs.displayLevel > displayLevelCutoff && UTIL_requireUserConfirmation("This is a destructive operation. Proceed? (y/n): ", "Aborting...", "yY", fCtx->hasStdinInput); |
| 874 | } |
| 875 | } |
| 876 | } |
| 877 | DISPLAY("\n"); |
| 878 | } |
| 879 | return error; |
| 880 | } |
| 881 | |
| 882 | #ifndef ZSTD_NOCOMPRESS |
| 883 |
no test coverage detected