in src/generic/modwebsh_cgi.c [136:198]
int Web_ConfigPath(Tcl_Interp * interp, int objc, Tcl_Obj * CONST objv[]) {
/* these options should be in sync with the options in Web_Cfg
* not the order or anything, but the actual text strings */
static TCLCONST char *subCmd[] = {
"script",
"server_root",
"document_root",
"interpclass",
NULL
};
enum subCmd
{
SCRIPT,
SERVER_ROOT,
DOCUMENT_ROOT,
INTERPCLASS
};
int index;
Tcl_Obj *res = NULL;
ApFuncs *apFuncs = Tcl_GetAssocData(interp, WEB_APFUNCS_ASSOC_DATA, NULL);
if (apFuncs != NULL)
return apFuncs->Web_ConfigPath(interp, objc, objv);
if (Tcl_GetIndexFromObj(interp, objv[1], subCmd, "subcommand", 0, &index)
!= TCL_OK) {
/* let the caller handle the web::config command */
Tcl_ResetResult(interp);
return TCL_CONTINUE;
}
WebAssertObjc(objc != 2, 2, NULL);
switch ((enum subCmd) index) {
case SCRIPT: {
res = tclSetEnv(interp, "SCRIPT_FILENAME", NULL);
break;
}
case SERVER_ROOT: {
res = tclSetEnv(interp, "SERVER_ROOT", NULL);
break;
}
case DOCUMENT_ROOT: {
res = tclSetEnv(interp, "DOCUMENT_ROOT", NULL);
break;
}
case INTERPCLASS: {
res = tclSetEnv(interp, "SCRIPT_FILENAME", NULL);
break;
}
}
/* reset errors from getting invalid env vars */
Tcl_ResetResult(interp);
if (res) {
Tcl_SetObjResult(interp, res);
Tcl_DecrRefCount(res);
}
return TCL_OK;
}