/ main() */ /
| 1090 | /* main() */ |
| 1091 | /************************************************************************/ |
| 1092 | int main(int argc, char *argv[]) { |
| 1093 | int i,j, iArg; |
| 1094 | char buffer[1024]; |
| 1095 | imageObj *img=NULL; |
| 1096 | int status; |
| 1097 | int sendheaders = MS_TRUE; |
| 1098 | struct mstimeval execstarttime, execendtime; |
| 1099 | struct mstimeval requeststarttime, requestendtime; |
| 1100 | char *service = NULL; |
| 1101 | |
| 1102 | msSetup(); |
| 1103 | |
| 1104 | /* Use MS_ERRORFILE and MS_DEBUGLEVEL env vars if set */ |
| 1105 | if( msDebugInitFromEnv() != MS_SUCCESS ) { |
| 1106 | writeError(); |
| 1107 | msCleanup(); |
| 1108 | exit(0); |
| 1109 | } |
| 1110 | |
| 1111 | if(msGetGlobalDebugLevel() >= MS_DEBUGLEVEL_TUNING) |
| 1112 | msGettimeofday(&execstarttime, NULL); |
| 1113 | |
| 1114 | /* -------------------------------------------------------------------- */ |
| 1115 | /* Process arguments. In normal use as a cgi-bin there are no */ |
| 1116 | /* commandline switches, but we provide a few for test/debug */ |
| 1117 | /* purposes, and to query the version info. */ |
| 1118 | /* -------------------------------------------------------------------- */ |
| 1119 | for( iArg = 1; iArg < argc; iArg++ ) { |
| 1120 | /* Keep only "-v", "-nh" and "QUERY_STRING=..." enabled by default. |
| 1121 | * The others will require an explicit -DMS_ENABLE_CGI_CL_DEBUG_ARGS |
| 1122 | * at compile time. |
| 1123 | */ |
| 1124 | if( strcmp(argv[iArg],"-v") == 0 ) { |
| 1125 | printf("%s\n", msGetVersion()); |
| 1126 | fflush(stdout); |
| 1127 | exit(0); |
| 1128 | } else if(strcmp(argv[iArg], "-nh") == 0) { |
| 1129 | sendheaders = MS_FALSE; |
| 1130 | } else if( strncmp(argv[iArg], "QUERY_STRING=", 13) == 0 ) { |
| 1131 | /* Debugging hook... pass "QUERY_STRING=..." on the command-line */ |
| 1132 | putenv( "REQUEST_METHOD=GET" ); |
| 1133 | putenv( argv[iArg] ); |
| 1134 | } |
| 1135 | #ifdef MS_ENABLE_CGI_CL_DEBUG_ARGS |
| 1136 | else if( iArg < argc-1 && strcmp(argv[iArg], "-tmpbase") == 0) { |
| 1137 | msForceTmpFileBase( argv[++iArg] ); |
| 1138 | } else if( iArg < argc-1 && strcmp(argv[iArg], "-t") == 0) { |
| 1139 | char **tokens; |
| 1140 | int numtokens=0; |
| 1141 | |
| 1142 | if((tokens=msTokenizeMap(argv[iArg+1], &numtokens)) != NULL) { |
| 1143 | int i; |
| 1144 | for(i=0; i<numtokens; i++) |
| 1145 | printf("%s\n", tokens[i]); |
| 1146 | msFreeCharArray(tokens, numtokens); |
| 1147 | } else { |
| 1148 | writeError(); |
| 1149 | } |
nothing calls this directly
no test coverage detected