diff --git a/programs/fileio.c b/programs/fileio.c index 572e9c9a..78fb9a26 100644 --- a/programs/fileio.c +++ b/programs/fileio.c @@ -227,6 +227,9 @@ static FILE* FIO_openDstFile(const char* dstFileName) DISPLAYLEVEL(4, "Sparse File Support is automatically disabled on stdout ; try --sparse \n"); } } else { + if (g_sparseFileSupport == 1) { + g_sparseFileSupport = ZSTD_SPARSE_DEFAULT; + } if (!g_overwrite && strcmp (dstFileName, nulmark)) { /* Check if destination file already exists */ f = fopen( dstFileName, "rb" ); if (f != 0) { /* dest file exists, prompt for overwrite authorization */ diff --git a/programs/platform.h b/programs/platform.h index ee781951..74412cde 100644 --- a/programs/platform.h +++ b/programs/platform.h @@ -138,6 +138,14 @@ static __inline int IS_CONSOLE(FILE* stdStream) #endif +#ifndef ZSTD_SPARSE_DEFAULT +# if (defined(__APPLE__) && defined(__MACH__)) +# define ZSTD_SPARSE_DEFAULT 0 +# else +# define ZSTD_SPARSE_DEFAULT 1 +# endif +#endif + #if defined (__cplusplus) } diff --git a/programs/zstdcli.c b/programs/zstdcli.c index e2709ec8..0cf8cacd 100644 --- a/programs/zstdcli.c +++ b/programs/zstdcli.c @@ -137,7 +137,11 @@ static int usage_advanced(const char* programName) #endif #ifndef ZSTD_NODECOMPRESS DISPLAY( "--test : test compressed file integrity \n"); +#if ZSTD_SPARSE_DEFAULT DISPLAY( "--[no-]sparse : sparse mode (default:enabled on file, disabled on stdout)\n"); +#else + DISPLAY( "--[no-]sparse : sparse mode (default:disabled)\n"); +#endif #endif DISPLAY( " -M# : Set a memory usage limit for decompression \n"); DISPLAY( "-- : All arguments after \"--\" are treated as files \n");