MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / Tcl_SourceRCFile

Function Tcl_SourceRCFile

SRC/tcl/tclMain85.cpp:330–370  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

328 * Results:
329 * None.
330 *
331 * Side effects:
332 * Depends on what's in the rc script.
333 *
334 *----------------------------------------------------------------------
335 */
336
337void
338Tcl_SourceRCFile(
339 Tcl_Interp *interp) /* Interpreter to source rc file into. */
340{
341 Tcl_DString temp;
342 CONST char *fileName;
343 Tcl_Channel errChannel;
344
345 fileName = Tcl_GetVar(interp, "tcl_rcFileName", TCL_GLOBAL_ONLY);
346 if (fileName != NULL) {
347 Tcl_Channel c;
348 CONST char *fullName;
349
350 Tcl_DStringInit(&temp);
351 fullName = Tcl_TranslateFileName(interp, fileName, &temp);
352 if (fullName == NULL) {
353 /*
354 * Couldn't translate the file name (e.g. it referred to a bogus
355 * user or there was no HOME environment variable). Just do
356 * nothing.
357 */
358 } else {
359 /*
360 * Test for the existence of the rc file before trying to read it.
361 */
362
363 c = Tcl_OpenFileChannel(NULL, fullName, "r", 0);
364 if (c != (Tcl_Channel) NULL) {
365 Tcl_Close(NULL, c);
366 if (Tcl_EvalFile(interp, fullName) != TCL_OK) {
367 errChannel = Tcl_GetStdChannel(TCL_STDERR);
368 if (errChannel) {
369 Tcl_WriteObj(errChannel, Tcl_GetObjResult(interp));
370 Tcl_WriteChars(errChannel, "\n", 1);
371 }
372 }
373 }

Callers 4

runMethod · 0.85
tclMain.cppFile · 0.85
Tk_MainOpenSeesFunction · 0.85
tclMain85.cppFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected