Added -X option to suppress default import of site.py. Also split the

usage message in *three* parts under 510 bytes, for low-end ANSI
compatibility.
This commit is contained in:
Guido van Rossum 1997-08-29 22:34:47 +00:00
parent 3d90af967d
commit 7922bd7382
1 changed files with 14 additions and 6 deletions

View File

@ -53,7 +53,7 @@ static int orig_argc;
/* Short usage message (with %s for argv0) */
static char *usage_line =
"usage: %s [-d] [-i] [-O] [-s] [-u] [-v] [-c cmd | file | -] [arg] ...\n";
"usage: %s [-d] [-i] [-O] [-S] [-u] [-v] [-X] [-c cmd | file | -] [arg] ...\n";
/* Long usage message, split into parts < 512 bytes */
static char *usage_top = "\n\
@ -62,15 +62,18 @@ Options and arguments (and corresponding environment variables):\n\
-i : inspect interactively after running script, (also PYTHONINSPECT=x)\n\
and force prompts, even if stdin does not appear to be a terminal.\n\
-O : optimize generated bytecode (a tad).\n\
-u : unbuffered binary stdout and stderr (also PYTHONUNBUFFERED=x)\n\
-X : disable class based built-in exceptions\n\
-v : verbose (trace import statements) (also PYTHONVERBOSE=x)\n\
-S : don't imply 'import site' on initialization\n\
";
static char *usage_bot = "\
static char *usage_mid = "\
-u : unbuffered binary stdout and stderr (also PYTHONUNBUFFERED=x)\n\
-v : verbose (trace import statements) (also PYTHONVERBOSE=x)\n\
-X : disable class based built-in exceptions\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\
";
static char *usage_bot = "\
\n\
Other environment variables:\n\
PYTHONSTARTUP: file executed on interactive startup (no default)\n\
@ -107,7 +110,7 @@ Py_Main(argc, argv)
unbuffered = 1;
Py_UseClassExceptionsFlag = 1;
while ((c = getopt(argc, argv, "c:diOuvX")) != EOF) {
while ((c = getopt(argc, argv, "c:diOSuvX")) != EOF) {
if (c == 'c') {
/* -c is the last option; following arguments
that look like options are left for the
@ -136,6 +139,10 @@ Py_Main(argc, argv)
Py_OptimizeFlag++;
break;
case 'S':
Py_NoSiteFlag++;
break;
case 'u':
unbuffered++;
break;
@ -153,6 +160,7 @@ Py_Main(argc, argv)
default:
fprintf(stderr, usage_line, argv[0]);
fprintf(stderr, usage_top);
fprintf(stderr, usage_mid);
fprintf(stderr, usage_bot);
exit(2);
/*NOTREACHED*/