mirror of
https://github.com/sheumann/hush.git
synced 2024-12-22 14:30:31 +00:00
fix TODO: getopt32 should reset optind to 1 itself
This commit is contained in:
parent
972288e62f
commit
24af7201e9
@ -2041,8 +2041,6 @@ int gzip_main(int argc, char **argv)
|
|||||||
//if (opt & 0x4) // -v
|
//if (opt & 0x4) // -v
|
||||||
#if ENABLE_GUNZIP /* gunzip_main may not be visible... */
|
#if ENABLE_GUNZIP /* gunzip_main may not be visible... */
|
||||||
if (opt & 0x8) { // -d
|
if (opt & 0x8) { // -d
|
||||||
/* FIXME: getopt32 should not depend on optind */
|
|
||||||
optind = 1;
|
|
||||||
return gunzip_main(argc, argv);
|
return gunzip_main(argc, argv);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -454,6 +454,10 @@ getopt32(int argc, char **argv, const char *applet_opts, ...)
|
|||||||
spec_flgs |= FREE_FIRST_ARGV_IS_OPT;
|
spec_flgs |= FREE_FIRST_ARGV_IS_OPT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* In case getopt32 was already called, reinit some state */
|
||||||
|
optind = 1;
|
||||||
|
|
||||||
/* Note: just "getopt() <= 0" will not work good for
|
/* Note: just "getopt() <= 0" will not work good for
|
||||||
* "fake" short options, like this one:
|
* "fake" short options, like this one:
|
||||||
* wget $'-\203' "Test: test" http://kernel.org/
|
* wget $'-\203' "Test: test" http://kernel.org/
|
||||||
@ -463,7 +467,7 @@ getopt32(int argc, char **argv, const char *applet_opts, ...)
|
|||||||
applet_long_options, NULL)) != -1) {
|
applet_long_options, NULL)) != -1) {
|
||||||
#else
|
#else
|
||||||
while ((c = getopt(argc, argv, applet_opts)) != -1) {
|
while ((c = getopt(argc, argv, applet_opts)) != -1) {
|
||||||
#endif /* ENABLE_GETOPT_LONG */
|
#endif
|
||||||
c &= 0xff; /* fight libc's sign extends */
|
c &= 0xff; /* fight libc's sign extends */
|
||||||
loop_arg_is_opt:
|
loop_arg_is_opt:
|
||||||
for (on_off = complementary; on_off->opt != c; on_off++) {
|
for (on_off = complementary; on_off->opt != c; on_off++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user