summaryrefslogtreecommitdiffstats
path: root/contrib/tools/python3/src/Python/getopt.c
diff options
context:
space:
mode:
authorshadchin <[email protected]>2022-02-10 16:44:39 +0300
committerDaniil Cherednik <[email protected]>2022-02-10 16:44:39 +0300
commite9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch)
tree64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/tools/python3/src/Python/getopt.c
parent2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff)
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'contrib/tools/python3/src/Python/getopt.c')
-rw-r--r--contrib/tools/python3/src/Python/getopt.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/contrib/tools/python3/src/Python/getopt.c b/contrib/tools/python3/src/Python/getopt.c
index 650ae089c38..2e3891aae2d 100644
--- a/contrib/tools/python3/src/Python/getopt.c
+++ b/contrib/tools/python3/src/Python/getopt.c
@@ -27,28 +27,28 @@
#include <stdio.h>
#include <string.h>
#include <wchar.h>
-#include "pycore_getopt.h"
+#include "pycore_getopt.h"
#ifdef __cplusplus
extern "C" {
#endif
-int _PyOS_opterr = 1; /* generate error messages */
-Py_ssize_t _PyOS_optind = 1; /* index into argv array */
-const wchar_t *_PyOS_optarg = NULL; /* optional argument */
-
-static const 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},
-};
-
-
+int _PyOS_opterr = 1; /* generate error messages */
+Py_ssize_t _PyOS_optind = 1; /* index into argv array */
+const wchar_t *_PyOS_optarg = NULL; /* optional argument */
+
+static const 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;
@@ -57,7 +57,7 @@ void _PyOS_ResetGetOpt(void)
opt_ptr = L"";
}
-int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex)
+int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex)
{
wchar_t *ptr;
wchar_t option;
@@ -101,9 +101,9 @@ int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex)
if (option == L'-') {
// Parse long option.
if (*opt_ptr == L'\0') {
- if (_PyOS_opterr) {
- fprintf(stderr, "expected long option\n");
- }
+ if (_PyOS_opterr) {
+ fprintf(stderr, "expected long option\n");
+ }
return -1;
}
*longindex = 0;
@@ -113,9 +113,9 @@ int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex)
break;
}
if (!opt->name) {
- if (_PyOS_opterr) {
- fprintf(stderr, "unknown option %ls\n", argv[_PyOS_optind - 1]);
- }
+ if (_PyOS_opterr) {
+ fprintf(stderr, "unknown option %ls\n", argv[_PyOS_optind - 1]);
+ }
return '_';
}
opt_ptr = L"";
@@ -123,10 +123,10 @@ int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex)
return opt->val;
}
if (_PyOS_optind >= argc) {
- if (_PyOS_opterr) {
- fprintf(stderr, "Argument expected for the %ls options\n",
- argv[_PyOS_optind - 1]);
- }
+ if (_PyOS_opterr) {
+ fprintf(stderr, "Argument expected for the %ls options\n",
+ argv[_PyOS_optind - 1]);
+ }
return '_';
}
_PyOS_optarg = argv[_PyOS_optind++];
@@ -134,16 +134,16 @@ int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex)
}
if (option == 'J') {
- if (_PyOS_opterr) {
+ if (_PyOS_opterr) {
fprintf(stderr, "-J is reserved for Jython\n");
- }
+ }
return '_';
}
- if ((ptr = wcschr(SHORT_OPTS, option)) == NULL) {
- if (_PyOS_opterr) {
+ if ((ptr = wcschr(SHORT_OPTS, option)) == NULL) {
+ if (_PyOS_opterr) {
fprintf(stderr, "Unknown option: -%c\n", (char)option);
- }
+ }
return '_';
}
@@ -155,10 +155,10 @@ int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex)
else {
if (_PyOS_optind >= argc) {
- if (_PyOS_opterr) {
+ if (_PyOS_opterr) {
fprintf(stderr,
"Argument expected for the -%c option\n", (char)option);
- }
+ }
return '_';
}