| 328 | * Results: |
| 329 | * None. |
| 330 | * |
| 331 | * Side effects: |
| 332 | * Depends on what's in the rc script. |
| 333 | * |
| 334 | *---------------------------------------------------------------------- |
| 335 | */ |
| 336 | |
| 337 | void |
| 338 | Tcl_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 | } |
no outgoing calls
no test coverage detected