mirror of
https://github.com/python/cpython.git
synced 2025-08-25 03:04:55 +00:00
Support for frozen scripts; added -i option.
This commit is contained in:
parent
41ffccbba7
commit
f56e3db1dd
6 changed files with 150 additions and 5 deletions
|
@ -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*/
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue