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

Function main

freebsd/contrib/zstd/examples/multiple_streaming_compression.c:95–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

93}
94
95int main(int argc, const char** argv)
96{
97 const char* const exeName = argv[0];
98
99 if (argc<2) {
100 printf("wrong arguments\n");
101 printf("usage:\n");
102 printf("%s FILE(s)\n", exeName);
103 return 1;
104 }
105
106 int const cLevel = 7;
107 resources const ress = createResources_orDie(cLevel);
108 void* ofnBuffer = NULL;
109 size_t ofnbSize = 0;
110
111 int argNb;
112 for (argNb = 1; argNb < argc; argNb++) {
113 const char* const ifn = argv[argNb];
114 size_t const ifnSize = strlen(ifn);
115 size_t const ofnSize = ifnSize + 5;
116 if (ofnbSize <= ofnSize) {
117 ofnbSize = ofnSize + 16;
118 free(ofnBuffer);
119 ofnBuffer = malloc_orDie(ofnbSize);
120 }
121 memset(ofnBuffer, 0, ofnSize);
122 strcat(ofnBuffer, ifn);
123 strcat(ofnBuffer, ".zst");
124 compressFile_orDie(ress, ifn, ofnBuffer);
125 }
126
127 freeResources(ress);
128 free(ofnBuffer);
129
130 printf("compressed %i files \n", argc-1);
131
132 return 0;
133}

Callers

nothing calls this directly

Calls 8

malloc_orDieFunction · 0.85
memsetFunction · 0.85
strcatFunction · 0.85
createResources_orDieFunction · 0.70
compressFile_orDieFunction · 0.70
freeResourcesFunction · 0.70
printfFunction · 0.50
freeFunction · 0.50

Tested by

no test coverage detected