diff options
author | Guido van Rossum <guido@python.org> | 1992-09-03 20:26:57 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1992-09-03 20:26:57 (GMT) |
commit | da8cd8638f0ad6cb3f3393a7637b9b87686af737 (patch) | |
tree | d8e944f3bae86f00793b974107184145e56aa2a5 /Python | |
parent | 14b4adbd3365354f13b6a8a5f07a975a59ff1e34 (diff) | |
download | cpython-da8cd8638f0ad6cb3f3393a7637b9b87686af737.zip cpython-da8cd8638f0ad6cb3f3393a7637b9b87686af737.tar.gz cpython-da8cd8638f0ad6cb3f3393a7637b9b87686af737.tar.bz2 |
Add $PYTHONSTARTUP feature.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/pythonmain.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Python/pythonmain.c b/Python/pythonmain.c index 4344cde..1c64692 100644 --- a/Python/pythonmain.c +++ b/Python/pythonmain.c @@ -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; } |