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

Function main

freebsd/contrib/zstd/zlibWrapper/examples/zwrapbench.c:858–1001  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

856#define CLEAN_RETURN(i) { operationResult = (i); goto _end; }
857
858int main(int argCount, char** argv)
859{
860 int argNb,
861 main_pause=0,
862 nextEntryIsDictionary=0,
863 operationResult=0,
864 nextArgumentIsFile=0;
865 int cLevel = ZSTDCLI_CLEVEL_DEFAULT;
866 int cLevelLast = 1;
867 unsigned recursive = 0;
868 FileNamesTable* filenames = UTIL_allocateFileNamesTable((size_t)argCount);
869 const char* programName = argv[0];
870 const char* dictFileName = NULL;
871 char* dynNameSpace = NULL;
872
873 /* init */
874 if (filenames==NULL) { DISPLAY("zstd: %s \n", strerror(errno)); exit(1); }
875 displayOut = stderr;
876
877 /* Pick out program name from path. Don't rely on stdlib because of conflicting behavior */
878 { size_t pos;
879 for (pos = strlen(programName); pos > 0; pos--) { if (programName[pos] == '/') { pos++; break; } }
880 programName += pos;
881 }
882
883 /* command switches */
884 for(argNb=1; argNb<argCount; argNb++) {
885 const char* argument = argv[argNb];
886 if(!argument) continue; /* Protection if argument empty */
887
888 if (nextArgumentIsFile==0) {
889
890 /* long commands (--long-word) */
891 if (!strcmp(argument, "--")) { nextArgumentIsFile=1; continue; }
892 if (!strcmp(argument, "--version")) { displayOut=stdout; DISPLAY(WELCOME_MESSAGE); CLEAN_RETURN(0); }
893 if (!strcmp(argument, "--help")) { displayOut=stdout; CLEAN_RETURN(usage(programName)); }
894 if (!strcmp(argument, "--verbose")) { g_displayLevel++; continue; }
895 if (!strcmp(argument, "--quiet")) { g_displayLevel--; continue; }
896
897 /* Decode commands (note : aggregated commands are allowed) */
898 if (argument[0]=='-') {
899 argument++;
900
901 while (argument[0]!=0) {
902 switch(argument[0])
903 {
904 /* Display help */
905 case 'V': displayOut=stdout; DISPLAY(WELCOME_MESSAGE); CLEAN_RETURN(0); /* Version Only */
906 case 'H':
907 case 'h': displayOut=stdout; CLEAN_RETURN(usage(programName));
908
909 /* Use file content as dictionary */
910 case 'D': nextEntryIsDictionary = 1; argument++; break;
911
912 /* Verbose mode */
913 case 'v': g_displayLevel++; argument++; break;
914
915 /* Quiet mode */

Callers

nothing calls this directly

Calls 15

strcmpFunction · 0.85
BMK_setNotificationLevelFunction · 0.85
BMK_SetNbIterationsFunction · 0.85
toupperFunction · 0.85
BMK_SetBlockSizeFunction · 0.85
BMK_setAdditionalParamFunction · 0.85
UTIL_refFilenameFunction · 0.85
UTIL_expandFNTFunction · 0.85
UTIL_freeFileNamesTableFunction · 0.85
usageFunction · 0.70
readU32FromCharFunction · 0.70

Tested by

no test coverage detected