summaryrefslogtreecommitdiffstats
path: root/Modules/main.c
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2010-12-04 10:47:18 (GMT)
committerGeorg Brandl <georg@python.org>2010-12-04 10:47:18 (GMT)
commit9d8711964f114b9f0f5ed8a9a1eccfba2a096030 (patch)
tree4019cdf599c1b27954dab237dc0d7f955f7a6b05 /Modules/main.c
parentcbd2ab1311120efa37e6dd8008a234235bf97b62 (diff)
downloadcpython-9d8711964f114b9f0f5ed8a9a1eccfba2a096030.zip
cpython-9d8711964f114b9f0f5ed8a9a1eccfba2a096030.tar.gz
cpython-9d8711964f114b9f0f5ed8a9a1eccfba2a096030.tar.bz2
#1772833: add -q command line option.
Diffstat (limited to 'Modules/main.c')
-rw-r--r--Modules/main.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/Modules/main.c b/Modules/main.c
index eeb94c8..3803eee 100644
--- a/Modules/main.c
+++ b/Modules/main.c
@@ -46,7 +46,7 @@ static wchar_t **orig_argv;
static int orig_argc;
/* command line options */
-#define BASE_OPTS L"bBc:dEhiJm:OsStuvVW:xX:?"
+#define BASE_OPTS L"bBc:dEhiJm:OqsStuvVW:xX:?"
#define PROGRAM_OPTS BASE_OPTS
@@ -71,6 +71,7 @@ static char *usage_2 = "\
-m mod : run library module as a script (terminates option list)\n\
-O : optimize generated bytecode slightly; also PYTHONOPTIMIZE=x\n\
-OO : remove doc-strings in addition to the -O optimizations\n\
+-q : don't print version and copyright messages on interactive startup\n\
-s : don't add user site directory to sys.path; also PYTHONNOUSERSITE\n\
-S : don't imply 'import site' on initialization\n\
";
@@ -318,6 +319,7 @@ Py_Main(int argc, wchar_t **argv)
int stdin_is_interactive = 0;
int help = 0;
int version = 0;
+ int quiet = 0;
int saw_unbuffered_flag = 0;
PyCompilerFlags cf;
@@ -424,6 +426,10 @@ Py_Main(int argc, wchar_t **argv)
PySys_AddXOption(_PyOS_optarg);
break;
+ case 'q':
+ quiet++;
+ break;
+
/* This space reserved for other options */
default:
@@ -588,8 +594,9 @@ Py_Main(int argc, wchar_t **argv)
#endif
Py_Initialize();
- if (Py_VerboseFlag ||
- (command == NULL && filename == NULL && module == NULL && stdin_is_interactive)) {
+ if (!quiet && (Py_VerboseFlag ||
+ (command == NULL && filename == NULL &&
+ module == NULL && stdin_is_interactive))) {
fprintf(stderr, "Python %s on %s\n",
Py_GetVersion(), Py_GetPlatform());
if (!Py_NoSiteFlag)