MCPcopy Create free account
hub / github.com/F-Stack/f-stack / main

Function main

freebsd/contrib/zstd/examples/dictionary_compression.c:70–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

68}
69
70int main(int argc, const char** argv)
71{
72 const char* const exeName = argv[0];
73 int const cLevel = 3;
74
75 if (argc<3) {
76 fprintf(stderr, "wrong arguments\n");
77 fprintf(stderr, "usage:\n");
78 fprintf(stderr, "%s [FILES] dictionary\n", exeName);
79 return 1;
80 }
81
82 /* load dictionary only once */
83 const char* const dictName = argv[argc-1];
84 ZSTD_CDict* const dictPtr = createCDict_orDie(dictName, cLevel);
85
86 int u;
87 for (u=1; u<argc-1; u++) {
88 const char* inFilename = argv[u];
89 char* const outFilename = createOutFilename_orDie(inFilename);
90 compress(inFilename, outFilename, dictPtr);
91 free(outFilename);
92 }
93
94 ZSTD_freeCDict(dictPtr);
95 printf("All %u files compressed. \n", argc-2);
96 return 0;
97}

Callers

nothing calls this directly

Calls 6

createCDict_orDieFunction · 0.85
createOutFilename_orDieFunction · 0.70
compressFunction · 0.70
freeFunction · 0.50
ZSTD_freeCDictFunction · 0.50
printfFunction · 0.50

Tested by

no test coverage detected