1
0
mirror of https://github.com/facebook/zstd.git synced 2025-07-30 22:23:13 +03:00

Merge pull request #30 from jforberg/dev

Add `unzstd` program for decompression.
This commit is contained in:
Yann Collet
2015-07-05 15:02:41 -07:00
3 changed files with 51 additions and 0 deletions

View File

@ -76,6 +76,7 @@
#define WELCOME_MESSAGE "*** %s %i-bits %s, by %s (%s) ***\n", COMPRESSOR_NAME, (int)(sizeof(void*)*8), ZSTD_VERSION, AUTHOR, __DATE__
#define ZSTD_EXTENSION ".zst"
#define ZSTD_CAT "zstdcat"
#define ZSTD_UNZSTD "unzstd"
#define KB *(1 <<10)
#define MB *(1 <<20)
@ -172,9 +173,24 @@ int main(int argc, char** argv)
char* dynNameSpace = NULL;
char extension[] = ZSTD_EXTENSION;
/* Pick out basename component. Don't rely on stdlib because of conflicting behaviour. */
for (i = strlen(programName); i > 0; i--)
{
if (programName[i] == '/')
{
i++;
break;
}
}
programName += i;
/* zstdcat behavior */
if (!strcmp(programName, ZSTD_CAT)) { decode=1; forceStdout=1; displayLevel=1; outFileName=stdoutmark; }
/* unzstd behavior */
if (!strcmp(programName, ZSTD_UNZSTD))
decode=1;
// command switches
for(i=1; i<argc; i++)
{