usb 2.17.0 → 2.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +14 -0
- package/binding.gyp +2 -9
- package/dist/usb/bindings.d.ts +27 -2
- package/dist/usb/bindings.js.map +1 -1
- package/dist/usb/index.d.ts +0 -29
- package/dist/usb/index.js +4 -18
- package/dist/usb/index.js.map +1 -1
- package/libusb/.clang-tidy +5 -3
- package/libusb/.private/ci-build.sh +5 -1
- package/libusb/AUTHORS +14 -0
- package/libusb/ChangeLog +15 -2
- package/libusb/README +8 -5
- package/libusb/Xcode/libusb.xcodeproj/project.pbxproj +4 -0
- package/libusb/configure.ac +12 -2
- package/libusb/examples/hotplugtest.c +19 -11
- package/libusb/examples/listdevs.c +41 -3
- package/libusb/examples/xusb.c +6 -1
- package/libusb/libusb/Makefile.am +4 -0
- package/libusb/libusb/core.c +175 -14
- package/libusb/libusb/descriptor.c +163 -14
- package/libusb/libusb/io.c +7 -3
- package/libusb/libusb/libusb-1.0.def +10 -0
- package/libusb/libusb/libusb.h +59 -9
- package/libusb/libusb/libusbi.h +89 -25
- package/libusb/libusb/os/darwin_usb.c +126 -46
- package/libusb/libusb/os/darwin_usb.h +10 -8
- package/libusb/libusb/os/emscripten_webusb.cpp +31 -10
- package/libusb/libusb/os/haiku_usb_raw.cpp +4 -0
- package/libusb/libusb/os/linux_usbfs.c +73 -25
- package/libusb/libusb/os/netbsd_usb.c +2 -0
- package/libusb/libusb/os/openbsd_usb.c +2 -0
- package/libusb/libusb/os/sunos_usb.c +2 -0
- package/libusb/libusb/os/threads_posix.c +3 -3
- package/libusb/libusb/os/threads_posix.h +8 -2
- package/libusb/libusb/os/threads_windows.h +2 -1
- package/libusb/libusb/os/windows_common.c +86 -1
- package/libusb/libusb/os/windows_common.h +20 -1
- package/libusb/libusb/os/windows_hotplug.c +321 -0
- package/libusb/libusb/os/windows_hotplug.h +28 -0
- package/libusb/libusb/os/windows_usbdk.c +16 -8
- package/libusb/libusb/os/windows_winusb.c +753 -41
- package/libusb/libusb/os/windows_winusb.h +11 -6
- package/libusb/libusb/version.h +1 -1
- package/libusb/libusb/version_nano.h +1 -1
- package/libusb/msvc/Base.props +1 -1
- package/libusb/msvc/Configuration.Base.props +2 -1
- package/libusb/msvc/Configuration.DynamicLibrary.props +12 -0
- package/libusb/msvc/ProjectConfigurations.Base.props +69 -16
- package/libusb/msvc/build_all.ps1 +2 -2
- package/libusb/msvc/config.h +4 -0
- package/libusb/msvc/getopt/bits/getopt_core.h +96 -0
- package/libusb/msvc/getopt/bits/getopt_ext.h +77 -0
- package/libusb/msvc/getopt/features.h +21 -0
- package/libusb/msvc/getopt/getopt.c +456 -705
- package/libusb/msvc/getopt/getopt.h +16 -158
- package/libusb/msvc/getopt/getopt1.c +40 -69
- package/libusb/msvc/getopt/getopt_int.h +118 -0
- package/libusb/msvc/getopt/gettext.h +7 -0
- package/libusb/msvc/getopt/unistd.h +5 -0
- package/libusb/msvc/getopt.vcxproj +11 -4
- package/libusb/msvc/libusb.sln +515 -268
- package/libusb/msvc/libusb_dll.vcxproj +2 -0
- package/libusb/msvc/libusb_static.vcxproj +2 -0
- package/libusb/msvc/xusb.vcxproj +1 -1
- package/libusb/tests/Makefile.am +10 -1
- package/libusb/tests/fuzz/corpus/bos/min.bos +0 -0
- package/libusb/tests/fuzz/corpus/descriptor_parsers/min_valid_config.bin +0 -0
- package/libusb/tests/fuzz/corpus/descriptor_parsers/regression_bug_a_endpoint_null.bin +0 -0
- package/libusb/tests/fuzz/corpus/descriptor_parsers/regression_bug_b_iad_oob.bin +0 -0
- package/libusb/tests/fuzz/fuzz_bos_descriptor.c +49 -0
- package/libusb/tests/fuzz/fuzz_descriptor_parsers.c +83 -0
- package/libusb/tests/stress_mt.c +2 -1
- package/libusb/tests/webusb-test-shim/index.js +6 -5
- package/libusb.gypi +5 -0
- package/package.json +1 -1
- package/prebuilds/android-arm/node.napi.armv7.node +0 -0
- package/prebuilds/android-arm64/node.napi.armv8.node +0 -0
- package/prebuilds/darwin-x64+arm64/node.napi.node +0 -0
- package/prebuilds/linux-arm/node.napi.armv6.node +0 -0
- package/prebuilds/linux-arm/node.napi.armv7.node +0 -0
- package/prebuilds/linux-arm64/node.napi.armv8.node +0 -0
- package/prebuilds/linux-ia32/node.napi.node +0 -0
- package/prebuilds/linux-x64/node.napi.glibc.node +0 -0
- package/prebuilds/linux-x64/node.napi.musl.node +0 -0
- package/prebuilds/win32-arm64/node.napi.node +0 -0
- package/prebuilds/win32-ia32/node.napi.node +0 -0
- package/prebuilds/win32-x64/node.napi.node +0 -0
- package/src/{hotplug/libusb.cc → hotplug.cc} +2 -3
- package/src/{hotplug/hotplug.h → hotplug.h} +2 -6
- package/src/node_usb.cc +3 -3
- package/test/usb.coffee +4 -4
- package/test/webusb.coffee +22 -12
- package/src/hotplug/windows.cc +0 -168
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/* Declarations for getopt.
|
|
2
|
-
Copyright (C) 1989-
|
|
2
|
+
Copyright (C) 1989-2026 Free Software Foundation, Inc.
|
|
3
3
|
This file is part of the GNU C Library.
|
|
4
|
+
Unlike the bulk of the getopt implementation, this file is NOT part
|
|
5
|
+
of gnulib; gnulib also has a getopt.h but it is different.
|
|
4
6
|
|
|
5
7
|
The GNU C Library is free software; you can redistribute it and/or
|
|
6
8
|
modify it under the terms of the GNU Lesser General Public
|
|
@@ -13,168 +15,24 @@
|
|
|
13
15
|
Lesser General Public License for more details.
|
|
14
16
|
|
|
15
17
|
You should have received a copy of the GNU Lesser General Public
|
|
16
|
-
License along with the GNU C Library; if not,
|
|
17
|
-
|
|
18
|
-
02111-1307 USA. */
|
|
18
|
+
License along with the GNU C Library; if not, see
|
|
19
|
+
<https://www.gnu.org/licenses/>. */
|
|
19
20
|
|
|
20
21
|
#ifndef _GETOPT_H
|
|
22
|
+
#define _GETOPT_H 1
|
|
21
23
|
|
|
22
|
-
#
|
|
23
|
-
# define _GETOPT_H 1
|
|
24
|
-
#endif
|
|
25
|
-
|
|
26
|
-
/* If __GNU_LIBRARY__ is not already defined, either we are being used
|
|
27
|
-
standalone, or this is the first header included in the source file.
|
|
28
|
-
If we are being used with glibc, we need to include <features.h>, but
|
|
29
|
-
that does not exist if we are standalone. So: if __GNU_LIBRARY__ is
|
|
30
|
-
not defined, include <ctype.h>, which will pull in <features.h> for us
|
|
31
|
-
if it's from glibc. (Why ctype.h? It's guaranteed to exist and it
|
|
32
|
-
doesn't flood the namespace with stuff the way some other headers do.) */
|
|
33
|
-
#if !defined __GNU_LIBRARY__
|
|
34
|
-
# include <ctype.h>
|
|
35
|
-
#endif
|
|
36
|
-
|
|
37
|
-
#ifdef __cplusplus
|
|
38
|
-
extern "C" {
|
|
39
|
-
#endif
|
|
40
|
-
|
|
41
|
-
/* For communication from `getopt' to the caller.
|
|
42
|
-
When `getopt' finds an option that takes an argument,
|
|
43
|
-
the argument value is returned here.
|
|
44
|
-
Also, when `ordering' is RETURN_IN_ORDER,
|
|
45
|
-
each non-option ARGV-element is returned here. */
|
|
46
|
-
|
|
47
|
-
extern char *optarg;
|
|
48
|
-
|
|
49
|
-
/* Index in ARGV of the next element to be scanned.
|
|
50
|
-
This is used for communication to and from the caller
|
|
51
|
-
and for communication between successive calls to `getopt'.
|
|
52
|
-
|
|
53
|
-
On entry to `getopt', zero means this is the first call; initialize.
|
|
54
|
-
|
|
55
|
-
When `getopt' returns -1, this is the index of the first of the
|
|
56
|
-
non-option elements that the caller should itself scan.
|
|
57
|
-
|
|
58
|
-
Otherwise, `optind' communicates from one call to the next
|
|
59
|
-
how much of ARGV has been scanned so far. */
|
|
60
|
-
|
|
61
|
-
extern int optind;
|
|
62
|
-
|
|
63
|
-
/* Callers store zero here to inhibit the error message `getopt' prints
|
|
64
|
-
for unrecognized options. */
|
|
65
|
-
|
|
66
|
-
extern int opterr;
|
|
67
|
-
|
|
68
|
-
/* Set to an option character which was unrecognized. */
|
|
69
|
-
|
|
70
|
-
extern int optopt;
|
|
71
|
-
|
|
72
|
-
#ifndef __need_getopt
|
|
73
|
-
/* Describe the long-named options requested by the application.
|
|
74
|
-
The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
|
|
75
|
-
of `struct option' terminated by an element containing a name which is
|
|
76
|
-
zero.
|
|
77
|
-
|
|
78
|
-
The field `has_arg' is:
|
|
79
|
-
no_argument (or 0) if the option does not take an argument,
|
|
80
|
-
required_argument (or 1) if the option requires an argument,
|
|
81
|
-
optional_argument (or 2) if the option takes an optional argument.
|
|
82
|
-
|
|
83
|
-
If the field `flag' is not NULL, it points to a variable that is set
|
|
84
|
-
to the value given in the field `val' when the option is found, but
|
|
85
|
-
left unchanged if the option is not found.
|
|
86
|
-
|
|
87
|
-
To have a long-named option do something other than set an `int' to
|
|
88
|
-
a compiled-in constant, such as set a value from `optarg', set the
|
|
89
|
-
option's `flag' field to zero and its `val' field to a nonzero
|
|
90
|
-
value (the equivalent single-letter option character, if there is
|
|
91
|
-
one). For long options that have a zero `flag' field, `getopt'
|
|
92
|
-
returns the contents of the `val' field. */
|
|
93
|
-
|
|
94
|
-
struct option
|
|
95
|
-
{
|
|
96
|
-
# if (defined __STDC__ && __STDC__) || defined __cplusplus
|
|
97
|
-
const char *name;
|
|
98
|
-
# else
|
|
99
|
-
char *name;
|
|
100
|
-
# endif
|
|
101
|
-
/* has_arg can't be an enum because some compilers complain about
|
|
102
|
-
type mismatches in all the code that assumes it is an int. */
|
|
103
|
-
int has_arg;
|
|
104
|
-
int *flag;
|
|
105
|
-
int val;
|
|
106
|
-
};
|
|
107
|
-
|
|
108
|
-
/* Names for the values of the `has_arg' field of `struct option'. */
|
|
109
|
-
|
|
110
|
-
# define no_argument 0
|
|
111
|
-
# define required_argument 1
|
|
112
|
-
# define optional_argument 2
|
|
113
|
-
#endif /* need getopt */
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
/* Get definitions and prototypes for functions to process the
|
|
117
|
-
arguments in ARGV (ARGC of them, minus the program name) for
|
|
118
|
-
options given in OPTS.
|
|
119
|
-
|
|
120
|
-
Return the option character from OPTS just read. Return -1 when
|
|
121
|
-
there are no more options. For unrecognized options, or options
|
|
122
|
-
missing arguments, `optopt' is set to the option letter, and '?' is
|
|
123
|
-
returned.
|
|
124
|
-
|
|
125
|
-
The OPTS string is a list of characters which are recognized option
|
|
126
|
-
letters, optionally followed by colons, specifying that that letter
|
|
127
|
-
takes an argument, to be placed in `optarg'.
|
|
128
|
-
|
|
129
|
-
If a letter in OPTS is followed by two colons, its argument is
|
|
130
|
-
optional. This behavior is specific to the GNU `getopt'.
|
|
131
|
-
|
|
132
|
-
The argument `--' causes premature termination of argument
|
|
133
|
-
scanning, explicitly telling `getopt' that there are no more
|
|
134
|
-
options.
|
|
135
|
-
|
|
136
|
-
If OPTS begins with `--', then non-option arguments are treated as
|
|
137
|
-
arguments to the option '\0'. This behavior is specific to the GNU
|
|
138
|
-
`getopt'. */
|
|
139
|
-
|
|
140
|
-
#if (defined __STDC__ && __STDC__) || defined __cplusplus
|
|
141
|
-
# ifdef __GNU_LIBRARY__
|
|
142
|
-
/* Many other libraries have conflicting prototypes for getopt, with
|
|
143
|
-
differences in the consts, in stdlib.h. To avoid compilation
|
|
144
|
-
errors, only prototype getopt for the GNU C library. */
|
|
145
|
-
extern int getopt (int __argc, char *const *__argv, const char *__shortopts);
|
|
146
|
-
# else /* not __GNU_LIBRARY__ */
|
|
147
|
-
extern int getopt ();
|
|
148
|
-
# endif /* __GNU_LIBRARY__ */
|
|
149
|
-
|
|
150
|
-
# ifndef __need_getopt
|
|
151
|
-
extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts,
|
|
152
|
-
const struct option *__longopts, int *__longind);
|
|
153
|
-
extern int getopt_long_only (int __argc, char *const *__argv,
|
|
154
|
-
const char *__shortopts,
|
|
155
|
-
const struct option *__longopts, int *__longind);
|
|
156
|
-
|
|
157
|
-
/* Internal only. Users should not call this directly. */
|
|
158
|
-
extern int _getopt_internal (int __argc, char *const *__argv,
|
|
159
|
-
const char *__shortopts,
|
|
160
|
-
const struct option *__longopts, int *__longind,
|
|
161
|
-
int __long_only);
|
|
162
|
-
# endif
|
|
163
|
-
#else /* not __STDC__ */
|
|
164
|
-
extern int getopt ();
|
|
165
|
-
# ifndef __need_getopt
|
|
166
|
-
extern int getopt_long ();
|
|
167
|
-
extern int getopt_long_only ();
|
|
168
|
-
|
|
169
|
-
extern int _getopt_internal ();
|
|
170
|
-
# endif
|
|
171
|
-
#endif /* __STDC__ */
|
|
24
|
+
#include <features.h>
|
|
172
25
|
|
|
173
|
-
|
|
174
|
-
|
|
26
|
+
/* The type of the 'argv' argument to getopt_long and getopt_long_only
|
|
27
|
+
is properly 'char **', since both functions may write to the array
|
|
28
|
+
(in order to move all the options to the beginning). However, for
|
|
29
|
+
compatibility with old versions of LSB, glibc has to use 'char *const *'
|
|
30
|
+
instead. */
|
|
31
|
+
#ifndef __getopt_argv_const
|
|
32
|
+
# define __getopt_argv_const const
|
|
175
33
|
#endif
|
|
176
34
|
|
|
177
|
-
|
|
178
|
-
#
|
|
35
|
+
#include <bits/getopt_core.h>
|
|
36
|
+
#include <bits/getopt_ext.h>
|
|
179
37
|
|
|
180
38
|
#endif /* getopt.h */
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* getopt_long and getopt_long_only entry points for GNU getopt.
|
|
2
|
-
Copyright (C) 1987,
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
Copyright (C) 1987-2026 Free Software Foundation, Inc.
|
|
3
|
+
This file is part of the GNU C Library and is also part of gnulib.
|
|
4
|
+
Patches to this file should be submitted to both projects.
|
|
5
5
|
|
|
6
6
|
The GNU C Library is free software; you can redistribute it and/or
|
|
7
7
|
modify it under the terms of the GNU Lesser General Public
|
|
@@ -14,64 +14,31 @@
|
|
|
14
14
|
Lesser General Public License for more details.
|
|
15
15
|
|
|
16
16
|
You should have received a copy of the GNU Lesser General Public
|
|
17
|
-
License along with the GNU C Library; if not,
|
|
18
|
-
|
|
19
|
-
02111-1307 USA. */
|
|
20
|
-
|
|
21
|
-
#ifdef HAVE_CONFIG_H
|
|
22
|
-
#include <config.h>
|
|
23
|
-
#endif
|
|
24
|
-
|
|
25
|
-
#include "getopt.h"
|
|
26
|
-
|
|
27
|
-
#if !defined __STDC__ || !__STDC__
|
|
28
|
-
/* This is a separate conditional since some stdc systems
|
|
29
|
-
reject `defined (const)'. */
|
|
30
|
-
#ifndef const
|
|
31
|
-
#define const
|
|
32
|
-
#endif
|
|
33
|
-
#endif
|
|
17
|
+
License along with the GNU C Library; if not, see
|
|
18
|
+
<https://www.gnu.org/licenses/>. */
|
|
34
19
|
|
|
35
|
-
#
|
|
36
|
-
|
|
37
|
-
/* Comment out all this code if we are using the GNU C Library, and are not
|
|
38
|
-
actually compiling the library itself. This code is part of the GNU C
|
|
39
|
-
Library, but also included in many other GNU distributions. Compiling
|
|
40
|
-
and linking in this code is a waste when using the GNU C library
|
|
41
|
-
(especially if it is a shared library). Rather than having every GNU
|
|
42
|
-
program understand `configure --with-gnu-libc' and omit the object files,
|
|
43
|
-
it is simpler to just do this in the source for each such file. */
|
|
44
|
-
|
|
45
|
-
#define GETOPT_INTERFACE_VERSION 2
|
|
46
|
-
#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
|
|
47
|
-
#include <gnu-versions.h>
|
|
48
|
-
#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
|
|
49
|
-
#define ELIDE_CODE
|
|
50
|
-
#endif
|
|
20
|
+
#ifndef _LIBC
|
|
21
|
+
# include <config.h>
|
|
51
22
|
#endif
|
|
52
23
|
|
|
53
|
-
#
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
/* This needs to come after some library #include
|
|
57
|
-
to get __GNU_LIBRARY__ defined. */
|
|
58
|
-
#ifdef __GNU_LIBRARY__
|
|
59
|
-
#include <stdlib.h>
|
|
60
|
-
#endif
|
|
24
|
+
#include "getopt.h"
|
|
25
|
+
#include "getopt_int.h"
|
|
61
26
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
27
|
+
int
|
|
28
|
+
getopt_long (int argc, char *__getopt_argv_const *argv, const char *options,
|
|
29
|
+
const struct option *long_options, int *opt_index)
|
|
30
|
+
{
|
|
31
|
+
return _getopt_internal (argc, (char **) argv, options, long_options,
|
|
32
|
+
opt_index, 0, 0);
|
|
33
|
+
}
|
|
65
34
|
|
|
66
35
|
int
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const char *options;
|
|
71
|
-
const struct option *long_options;
|
|
72
|
-
int *opt_index;
|
|
36
|
+
_getopt_long_r (int argc, char **argv, const char *options,
|
|
37
|
+
const struct option *long_options, int *opt_index,
|
|
38
|
+
struct _getopt_data *d)
|
|
73
39
|
{
|
|
74
|
-
return
|
|
40
|
+
return _getopt_internal_r (argc, argv, options, long_options, opt_index,
|
|
41
|
+
0, d, 0);
|
|
75
42
|
}
|
|
76
43
|
|
|
77
44
|
/* Like getopt_long, but '-' as well as '--' can indicate a long option.
|
|
@@ -80,27 +47,31 @@ getopt_long (argc, argv, options, long_options, opt_index)
|
|
|
80
47
|
instead. */
|
|
81
48
|
|
|
82
49
|
int
|
|
83
|
-
getopt_long_only (argc,
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
const char *options;
|
|
87
|
-
const struct option *long_options;
|
|
88
|
-
int *opt_index;
|
|
50
|
+
getopt_long_only (int argc, char *__getopt_argv_const *argv,
|
|
51
|
+
const char *options,
|
|
52
|
+
const struct option *long_options, int *opt_index)
|
|
89
53
|
{
|
|
90
|
-
return _getopt_internal (argc, argv, options, long_options,
|
|
54
|
+
return _getopt_internal (argc, (char **) argv, options, long_options,
|
|
55
|
+
opt_index, 1, 0);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
int
|
|
59
|
+
_getopt_long_only_r (int argc, char **argv, const char *options,
|
|
60
|
+
const struct option *long_options, int *opt_index,
|
|
61
|
+
struct _getopt_data *d)
|
|
62
|
+
{
|
|
63
|
+
return _getopt_internal_r (argc, argv, options, long_options, opt_index,
|
|
64
|
+
1, d, 0);
|
|
91
65
|
}
|
|
92
66
|
|
|
93
67
|
|
|
94
|
-
#endif /* Not ELIDE_CODE. */
|
|
95
|
-
|
|
96
68
|
#ifdef TEST
|
|
97
69
|
|
|
98
70
|
#include <stdio.h>
|
|
71
|
+
#include <stdlib.h>
|
|
99
72
|
|
|
100
73
|
int
|
|
101
|
-
main (argc, argv)
|
|
102
|
-
int argc;
|
|
103
|
-
char **argv;
|
|
74
|
+
main (int argc, char **argv)
|
|
104
75
|
{
|
|
105
76
|
int c;
|
|
106
77
|
int digit_optind = 0;
|
|
@@ -109,7 +80,7 @@ main (argc, argv)
|
|
|
109
80
|
{
|
|
110
81
|
int this_option_optind = optind ? optind : 1;
|
|
111
82
|
int option_index = 0;
|
|
112
|
-
static struct option long_options[] =
|
|
83
|
+
static const struct option long_options[] =
|
|
113
84
|
{
|
|
114
85
|
{"add", 1, 0, 0},
|
|
115
86
|
{"append", 0, 0, 0},
|
|
@@ -159,11 +130,11 @@ main (argc, argv)
|
|
|
159
130
|
break;
|
|
160
131
|
|
|
161
132
|
case 'c':
|
|
162
|
-
printf ("option c with value
|
|
133
|
+
printf ("option c with value '%s'\n", optarg);
|
|
163
134
|
break;
|
|
164
135
|
|
|
165
136
|
case 'd':
|
|
166
|
-
printf ("option d with value
|
|
137
|
+
printf ("option d with value '%s'\n", optarg);
|
|
167
138
|
break;
|
|
168
139
|
|
|
169
140
|
case '?':
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/* Internal declarations for getopt.
|
|
2
|
+
Copyright (C) 1989-2026 Free Software Foundation, Inc.
|
|
3
|
+
This file is part of the GNU C Library and is also part of gnulib.
|
|
4
|
+
Patches to this file should be submitted to both projects.
|
|
5
|
+
|
|
6
|
+
The GNU C Library is free software; you can redistribute it and/or
|
|
7
|
+
modify it under the terms of the GNU Lesser General Public
|
|
8
|
+
License as published by the Free Software Foundation; either
|
|
9
|
+
version 2.1 of the License, or (at your option) any later version.
|
|
10
|
+
|
|
11
|
+
The GNU C Library is distributed in the hope that it will be useful,
|
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
14
|
+
Lesser General Public License for more details.
|
|
15
|
+
|
|
16
|
+
You should have received a copy of the GNU Lesser General Public
|
|
17
|
+
License along with the GNU C Library; if not, see
|
|
18
|
+
<https://www.gnu.org/licenses/>. */
|
|
19
|
+
|
|
20
|
+
#ifndef _GETOPT_INT_H
|
|
21
|
+
#define _GETOPT_INT_H 1
|
|
22
|
+
|
|
23
|
+
#include <getopt.h>
|
|
24
|
+
|
|
25
|
+
extern int _getopt_internal (int ___argc, char **___argv,
|
|
26
|
+
const char *__shortopts,
|
|
27
|
+
const struct option *__longopts, int *__longind,
|
|
28
|
+
int __long_only, int __posixly_correct);
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
/* Reentrant versions which can handle parsing multiple argument
|
|
32
|
+
vectors at the same time. */
|
|
33
|
+
|
|
34
|
+
/* Describe how to deal with options that follow non-option ARGV-elements.
|
|
35
|
+
|
|
36
|
+
REQUIRE_ORDER means don't recognize them as options; stop option
|
|
37
|
+
processing when the first non-option is seen. This is what POSIX
|
|
38
|
+
specifies should happen.
|
|
39
|
+
|
|
40
|
+
PERMUTE means permute the contents of ARGV as we scan, so that
|
|
41
|
+
eventually all the non-options are at the end. This allows options
|
|
42
|
+
to be given in any order, even with programs that were not written
|
|
43
|
+
to expect this.
|
|
44
|
+
|
|
45
|
+
RETURN_IN_ORDER is an option available to programs that were
|
|
46
|
+
written to expect options and other ARGV-elements in any order
|
|
47
|
+
and that care about the ordering of the two. We describe each
|
|
48
|
+
non-option ARGV-element as if it were the argument of an option
|
|
49
|
+
with character code 1.
|
|
50
|
+
|
|
51
|
+
The special argument '--' forces an end of option-scanning regardless
|
|
52
|
+
of the value of 'ordering'. In the case of RETURN_IN_ORDER, only
|
|
53
|
+
'--' can cause 'getopt' to return -1 with 'optind' != ARGC. */
|
|
54
|
+
|
|
55
|
+
enum __ord
|
|
56
|
+
{
|
|
57
|
+
REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/* Data type for reentrant functions. */
|
|
61
|
+
struct _getopt_data
|
|
62
|
+
{
|
|
63
|
+
/* These have exactly the same meaning as the corresponding global
|
|
64
|
+
variables, except that they are used for the reentrant
|
|
65
|
+
versions of getopt. */
|
|
66
|
+
int optind;
|
|
67
|
+
int opterr;
|
|
68
|
+
int optopt;
|
|
69
|
+
char *optarg;
|
|
70
|
+
|
|
71
|
+
/* Internal members. */
|
|
72
|
+
|
|
73
|
+
/* True if the internal members have been initialized. */
|
|
74
|
+
int __initialized;
|
|
75
|
+
|
|
76
|
+
/* The next char to be scanned in the option-element
|
|
77
|
+
in which the last option character we returned was found.
|
|
78
|
+
This allows us to pick up the scan where we left off.
|
|
79
|
+
|
|
80
|
+
If this is zero, or a null string, it means resume the scan
|
|
81
|
+
by advancing to the next ARGV-element. */
|
|
82
|
+
char *__nextchar;
|
|
83
|
+
|
|
84
|
+
/* See __ord above. */
|
|
85
|
+
enum __ord __ordering;
|
|
86
|
+
|
|
87
|
+
/* Handle permutation of arguments. */
|
|
88
|
+
|
|
89
|
+
/* Describe the part of ARGV that contains non-options that have
|
|
90
|
+
been skipped. 'first_nonopt' is the index in ARGV of the first
|
|
91
|
+
of them; 'last_nonopt' is the index after the last of them. */
|
|
92
|
+
|
|
93
|
+
int __first_nonopt;
|
|
94
|
+
int __last_nonopt;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
/* The initializer is necessary to set OPTIND and OPTERR to their
|
|
98
|
+
default values and to clear the initialization flag. */
|
|
99
|
+
#define _GETOPT_DATA_INITIALIZER { 1, 1 }
|
|
100
|
+
|
|
101
|
+
extern int _getopt_internal_r (int ___argc, char **___argv,
|
|
102
|
+
const char *__shortopts,
|
|
103
|
+
const struct option *__longopts, int *__longind,
|
|
104
|
+
int __long_only, struct _getopt_data *__data,
|
|
105
|
+
int __posixly_correct);
|
|
106
|
+
|
|
107
|
+
extern int _getopt_long_r (int ___argc, char **___argv,
|
|
108
|
+
const char *__shortopts,
|
|
109
|
+
const struct option *__longopts, int *__longind,
|
|
110
|
+
struct _getopt_data *__data);
|
|
111
|
+
|
|
112
|
+
extern int _getopt_long_only_r (int ___argc, char **___argv,
|
|
113
|
+
const char *__shortopts,
|
|
114
|
+
const struct option *__longopts,
|
|
115
|
+
int *__longind,
|
|
116
|
+
struct _getopt_data *__data);
|
|
117
|
+
|
|
118
|
+
#endif /* getopt_int.h */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
|
2
2
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
3
3
|
<Import Project="ProjectConfigurations.Base.props" />
|
|
4
4
|
<PropertyGroup Label="Globals">
|
|
@@ -16,8 +16,9 @@
|
|
|
16
16
|
<PropertyGroup Label="UserMacros" />
|
|
17
17
|
<ItemDefinitionGroup>
|
|
18
18
|
<ClCompile>
|
|
19
|
-
<
|
|
20
|
-
<
|
|
19
|
+
<AdditionalIncludeDirectories>.\getopt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
20
|
+
<PreprocessorDefinitions>_GL_UNUSED=;HAVE_STRING_H;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
21
|
+
<DisableSpecificWarnings>4100;4131;4702;%(DisableSpecificWarnings)</DisableSpecificWarnings>
|
|
21
22
|
</ClCompile>
|
|
22
23
|
</ItemDefinitionGroup>
|
|
23
24
|
<ItemGroup>
|
|
@@ -25,9 +26,15 @@
|
|
|
25
26
|
<ClCompile Include=".\getopt\getopt1.c" />
|
|
26
27
|
</ItemGroup>
|
|
27
28
|
<ItemGroup>
|
|
29
|
+
<ClInclude Include=".\getopt\bits\getopt_core.h" />
|
|
30
|
+
<ClInclude Include=".\getopt\bits\getopt_ext.h" />
|
|
31
|
+
<ClInclude Include=".\getopt\features.h" />
|
|
32
|
+
<ClInclude Include=".\getopt\gettext.h" />
|
|
28
33
|
<ClInclude Include=".\getopt\getopt.h" />
|
|
34
|
+
<ClInclude Include=".\getopt\getopt_int.h" />
|
|
35
|
+
<ClInclude Include=".\getopt\unistd.h" />
|
|
29
36
|
</ItemGroup>
|
|
30
37
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
31
38
|
<ImportGroup Label="ExtensionTargets">
|
|
32
39
|
</ImportGroup>
|
|
33
|
-
</Project>
|
|
40
|
+
</Project>
|