diff options
author | Guido van Rossum <guido@python.org> | 2000-12-15 22:00:54 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2000-12-15 22:00:54 (GMT) |
commit | 47f5fdc1144e6f88c09ce790c8d5b9653c7a6d65 (patch) | |
tree | 6125205d47bd39b018d9e85e427a3d5c4ab1ca3d /Modules/main.c | |
parent | 2a862c614d6d3ff50dc644150670651fdc9f3a99 (diff) | |
download | cpython-47f5fdc1144e6f88c09ce790c8d5b9653c7a6d65.zip cpython-47f5fdc1144e6f88c09ce790c8d5b9653c7a6d65.tar.gz cpython-47f5fdc1144e6f88c09ce790c8d5b9653c7a6d65.tar.bz2 |
Add the -W option.
Diffstat (limited to 'Modules/main.c')
-rw-r--r-- | Modules/main.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Modules/main.c b/Modules/main.c index c508eb6..f3d10c4 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -48,6 +48,7 @@ static char *usage_mid = "\ -x : skip first line of source, allowing use of non-Unix forms of #!cmd\n\ -h : print this help message and exit\n\ -V : print the Python version number and exit\n\ +-W arg : warning control (arg is action:message:category:module:lineno)\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\ @@ -101,7 +102,9 @@ Py_Main(int argc, char **argv) if ((p = getenv("PYTHONUNBUFFERED")) && *p != '\0') unbuffered = 1; - while ((c = _PyOS_GetOpt(argc, argv, "c:diOStuUvxXhV")) != EOF) { + PySys_ResetWarnOptions(); + + while ((c = _PyOS_GetOpt(argc, argv, "c:diOStuUvxXhVW:")) != EOF) { if (c == 'c') { /* -c is the last option; following arguments that look like options are left for the @@ -160,6 +163,10 @@ Py_Main(int argc, char **argv) version++; break; + case 'W': + PySys_AddWarnOption(_PyOS_optarg); + break; + /* This space reserved for other options */ default: |