summaryrefslogtreecommitdiffstats
path: root/Python/pythonmain.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1993-04-01 20:59:32 (GMT)
committerGuido van Rossum <guido@python.org>1993-04-01 20:59:32 (GMT)
commitf56e3db1dd4bedc9331933504f5008a03f5d3131 (patch)
treee5dad2acc4127f93e054658c6226ecec274c2930 /Python/pythonmain.c
parent41ffccbba75413c64efad283da19b8038aa07dd1 (diff)
downloadcpython-f56e3db1dd4bedc9331933504f5008a03f5d3131.zip
cpython-f56e3db1dd4bedc9331933504f5008a03f5d3131.tar.gz
cpython-f56e3db1dd4bedc9331933504f5008a03f5d3131.tar.bz2
Support for frozen scripts; added -i option.
Diffstat (limited to 'Python/pythonmain.c')
-rw-r--r--Python/pythonmain.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/Python/pythonmain.c b/Python/pythonmain.c
index 1718611..760e5da 100644
--- a/Python/pythonmain.c
+++ b/Python/pythonmain.c
@@ -34,6 +34,8 @@ extern int optind;
extern char *optarg;
extern int getopt PROTO((int, char **, char *));
+extern char *getenv();
+
main(argc, argv)
int argc;
char **argv;
@@ -43,10 +45,17 @@ main(argc, argv)
char *command = NULL;
char *filename = NULL;
FILE *fp = stdin;
+ char *p;
+ int inspect = 0;
+
+ if ((p = getenv("PYTHONDEBUG")) && *p != '\0')
+ debugging = 1;
+ if ((p = getenv("PYTHONVERBOSE")) && *p != '\0')
+ verbose = 1;
initargs(&argc, &argv); /* Defined in config*.c */
- while ((c = getopt(argc, argv, "c:dv")) != EOF) {
+ while ((c = getopt(argc, argv, "c:div")) != EOF) {
if (c == 'c') {
/* -c is the last option; following arguments
that look like options are left for the
@@ -64,6 +73,10 @@ main(argc, argv)
debugging++;
break;
+ case 'i':
+ inspect++;
+ break;
+
case 'v':
verbose++;
break;
@@ -118,6 +131,10 @@ main(argc, argv)
sts = run(fp, filename == NULL ? "<stdin>" : filename) != 0;
}
+ if (inspect && isatty((int)fileno(stdin)) &&
+ (filename != NULL || command != NULL))
+ sts = run(stdin, "<stdin>") != 0;
+
goaway(sts);
/*NOTREACHED*/
}