Mercurial > cpython-lru_cache-weakref
diff Python/pythonmain.c @ 1318:92e6a8cf14be legacy-trunk
* pythonmain.c: -k option, usage message, more environment flags.
(the latter also in frozenmain.c)
* ceval.c: global 'killprint' flag raises exception when printing an
expression statement's value (useful for finding stray output)
* timemodule.c: add asctime() and ctime(). Change julian date to
1-based origin (as intended and documented).
* Removed unused DO_TIMES stuff from timemodule.c. Added 'epoch' and
'day0' globals (year where time.time() == 0 and day of the week the
epoch started).
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Thu, 24 Jun 1993 11:10:19 +0000 |
| parents | 14369a5e6167 |
| children | c914b10bf2ed |
line wrap: on
line diff
--- a/Python/pythonmain.c Wed Jun 23 11:55:24 1993 +0000 +++ b/Python/pythonmain.c Thu Jun 24 11:10:19 1993 +0000 @@ -26,8 +26,9 @@ #include "allobjects.h" -extern int debugging; /* Needed by parser.c */ -extern int verbose; /* Needed by import.c */ +extern int debugging; /* Defined in parser.c */ +extern int verbose; /* Defined in import.c */ +extern int killprint; /* Defined in ceval.c */ /* Interface to getopt(): */ extern int optind; @@ -52,10 +53,14 @@ debugging = 1; if ((p = getenv("PYTHONVERBOSE")) && *p != '\0') verbose = 1; + if ((p = getenv("PYTHONINSPECT")) && *p != '\0') + inspect = 1; + if ((p = getenv("PYTHONKILLPRINT")) && *p != '\0') + killprint = 1; - initargs(&argc, &argv); /* Defined in config*.c */ + initargs(&argc, &argv); - while ((c = getopt(argc, argv, "c:div")) != EOF) { + while ((c = getopt(argc, argv, "c:dikv")) != EOF) { if (c == 'c') { /* -c is the last option; following arguments that look like options are left for the @@ -77,6 +82,10 @@ inspect++; break; + case 'k': + killprint++; + break; + case 'v': verbose++; break; @@ -85,8 +94,25 @@ default: fprintf(stderr, - "usage: %s [-c cmd | file | -] [arg] ...\n", +"usage: %s [-d] [-i] [-k] [-v] [-c cmd | file | -] [arg] ...\n", argv[0]); + fprintf(stderr, "\ +\n\ +Options and arguments (and corresponding environment variables):\n\ +-d : debug output from parser (also PYTHONDEBUG=x)\n\ +-i : inspect interactively after running script (also PYTHONINSPECT=x)\n\ +-k : kill printing expression statement (also PYTHONKILLPRINT=x)\n\ +-v : verbose (trace import statements) (also PYTHONVERBOSE=x)\n\ +-c cmd : program passed in as string (terminates option list)\n\ +file : program read from script file\n\ +- : program read from stdin (default; interactive mode if a tty)\n\ +arg ...: arguments passed to program in sys.argv[1:]\n\ +\n\ +Other environment variables:\n\ +PYTHONSTARTUP: file executed on interactive startup (no default)\n\ +PYTHONPATH : colon-separated list of directories prefixed to the\n\ + default module search path. The result is sys.path.\n\ +"); exit(2); /*NOTREACHED*/
