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