summaryrefslogtreecommitdiffstats
path: root/Python/getopt.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@redhat.com>2019-03-05 01:44:12 (GMT)
committerGitHub <noreply@github.com>2019-03-05 01:44:12 (GMT)
commit6dcb54228e7520abd058897440c26e323f62afcd (patch)
tree44c513ae0de0ecbf63609bb3b61bbc41806ce156 /Python/getopt.c
parentcad1f747da47849ab5d8b0b881f7a0b94564d290 (diff)
downloadcpython-6dcb54228e7520abd058897440c26e323f62afcd.zip
cpython-6dcb54228e7520abd058897440c26e323f62afcd.tar.gz
cpython-6dcb54228e7520abd058897440c26e323f62afcd.tar.bz2
bpo-36142: Add _PyPreConfig_ReadFromArgv() (GH-12173)
The new function is now responsible to parse -E and -I command line arguments.
Diffstat (limited to 'Python/getopt.c')
-rw-r--r--Python/getopt.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/Python/getopt.c b/Python/getopt.c
index c165a94..1dc8720 100644
--- a/Python/getopt.c
+++ b/Python/getopt.c
@@ -43,6 +43,16 @@ wchar_t *_PyOS_optarg = NULL; /* optional argument */
static wchar_t *opt_ptr = L"";
+/* Python command line short and long options */
+
+#define SHORT_OPTS L"bBc:dEhiIJm:OqRsStuvVW:xX:?"
+
+static const _PyOS_LongOption longopts[] = {
+ {L"check-hash-based-pycs", 1, 0},
+ {NULL, 0, 0},
+};
+
+
void _PyOS_ResetGetOpt(void)
{
_PyOS_opterr = 1;
@@ -51,8 +61,7 @@ void _PyOS_ResetGetOpt(void)
opt_ptr = L"";
}
-int _PyOS_GetOpt(int argc, wchar_t **argv, wchar_t *optstring,
- const _PyOS_LongOption *longopts, int *longindex)
+int _PyOS_GetOpt(int argc, wchar_t **argv, int *longindex)
{
wchar_t *ptr;
wchar_t option;
@@ -128,7 +137,7 @@ int _PyOS_GetOpt(int argc, wchar_t **argv, wchar_t *optstring,
return '_';
}
- if ((ptr = wcschr(optstring, option)) == NULL) {
+ if ((ptr = wcschr(SHORT_OPTS, option)) == NULL) {
if (_PyOS_opterr)
fprintf(stderr, "Unknown option: -%c\n", (char)option);
return '_';