Add $PYTHONSTARTUP feature.

This commit is contained in:
Guido van Rossum 1992-09-03 20:26:57 +00:00
parent 14b4adbd33
commit da8cd8638f
1 changed files with 10 additions and 0 deletions

View File

@ -105,6 +105,16 @@ main(argc, argv)
sts = run_command(command) != 0;
}
else {
if (filename == NULL && isatty((int)fileno(fp))) {
char *startup = getenv("PYTHONSTARTUP");
if (startup != NULL && startup[0] != '\0') {
FILE *fp = fopen(startup, "r");
if (fp != NULL) {
(void) run_script(fp, startup);
err_clear();
}
}
}
sts = run(fp, filename == NULL ? "<stdin>" : filename) != 0;
}