From 7922bd7382c7e22ee9f711f6554718b824ac85a4 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Fri, 29 Aug 1997 22:34:47 +0000 Subject: [PATCH] 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. --- Modules/main.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Modules/main.c b/Modules/main.c index cc18dfae77d..b882ff9e00b 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -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*/