MCPcopy Index your code
hub / github.com/MapServer/MapServer / setMode

Function setMode

mapserv.c:265–296  ·  view source on GitHub ↗

** Set operation mode. First look in MS_MODE env. var. as a ** default value that can be overridden by the mode=... CGI param. ** Returns silently, leaving mapserv->Mode unchanged if mode param not set. */

Source from the content-addressed store, hash-verified

263** Returns silently, leaving mapserv->Mode unchanged if mode param not set.
264*/
265static int setMode(void)
266{
267 const char *mode = NULL;
268 int i, j;
269
270
271 mode = getenv("MS_MODE");
272 for( i=0; i<mapserv->request->NumParams; i++ )
273 {
274 if(strcasecmp(mapserv->request->ParamNames[i], "mode") == 0)
275 {
276 mode = mapserv->request->ParamValues[i];
277 break;
278 }
279 }
280
281 if (mode) {
282 for(j=0; j<numModes; j++) {
283 if(strcasecmp(mode, modeStrings[j]) == 0) {
284 mapserv->Mode = j;
285 break;
286 }
287 }
288
289 if(j == numModes) {
290 msSetError(MS_WEBERR, "Invalid mode.", "setMode()");
291 return MS_FAILURE;
292 }
293 }
294
295 return MS_SUCCESS;
296}
297
298/*
299** Process CGI parameters.

Callers 1

mainFunction · 0.85

Calls 2

strcasecmpFunction · 0.85
msSetErrorFunction · 0.85

Tested by

no test coverage detected