/*---------------------------------------------------------------------------* * <RCS keywords> * * C++ Library * * Copyright 1992-1994, David Gottner * * All Rights Reserved * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, * provided that the above copyright notice, this permission notice and * the following disclaimer notice appear unmodified in all copies. * * I DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL I * BE LIABLE FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. *---------------------------------------------------------------------------*/ /* Modified to support --help and --version, as well as /? on Windows * by Georg Brandl. */ #include <Python.h> #include <stdio.h> #include <string.h> #include <wchar.h> #include "pycore_getopt.h" int _PyOS_opterr = …; /* generate error messages */ Py_ssize_t _PyOS_optind = …; /* index into argv array */ const wchar_t *_PyOS_optarg = …; /* optional argument */ static const wchar_t *opt_ptr = …; /* Python command line short and long options */ #define SHORT_OPTS … static const _PyOS_LongOption longopts[] = …; void _PyOS_ResetGetOpt(void) { … } int _PyOS_GetOpt(Py_ssize_t argc, wchar_t * const *argv, int *longindex) { … }