comparison Python/pythonmain.c @ 1014:96acb35bb92b legacy-trunk

Add $PYTHONSTARTUP feature.
author Guido van Rossum <guido@python.org>
date Thu, 03 Sep 1992 20:26:57 +0000
parents c156d4960c2b
children 1cabc2b6c970
comparison
equal deleted inserted replaced
1013:a1ce5a949828 1014:96acb35bb92b
103 103
104 if (command) { 104 if (command) {
105 sts = run_command(command) != 0; 105 sts = run_command(command) != 0;
106 } 106 }
107 else { 107 else {
108 if (filename == NULL && isatty((int)fileno(fp))) {
109 char *startup = getenv("PYTHONSTARTUP");
110 if (startup != NULL && startup[0] != '\0') {
111 FILE *fp = fopen(startup, "r");
112 if (fp != NULL) {
113 (void) run_script(fp, startup);
114 err_clear();
115 }
116 }
117 }
108 sts = run(fp, filename == NULL ? "<stdin>" : filename) != 0; 118 sts = run(fp, filename == NULL ? "<stdin>" : filename) != 0;
109 } 119 }
110 120
111 goaway(sts); 121 goaway(sts);
112 /*NOTREACHED*/ 122 /*NOTREACHED*/