X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=src%2Fmisc%2Fgetopt_long.c;h=6949ab1c7eec09753b49946da4ceeef6b89e3adc;hb=2404d9d643763e6eceafa9a1918925d80a84ad44;hp=e5a4a75adcb94740901a03a3465a9ce47f02114c;hpb=0217ed72f986d78b177f1a014e93f2150105bb44;p=musl diff --git a/src/misc/getopt_long.c b/src/misc/getopt_long.c index e5a4a75a..6949ab1c 100644 --- a/src/misc/getopt_long.c +++ b/src/misc/getopt_long.c @@ -1,8 +1,11 @@ #define _GNU_SOURCE #include +#include +#include #include #include #include +#include "stdio_impl.h" extern int __optpos, __optreset; @@ -16,14 +19,11 @@ static void permute(char *const *argv, int dest, int src) av[dest] = tmp; } -void __getopt_msg(const char *, const char *, const char *, size_t); - static int __getopt_long_core(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *idx, int longonly); static int __getopt_long(int argc, char *const *argv, const char *optstring, const struct option *longopts, int *idx, int longonly) { int ret, skipped, resumed; - const char *optstring2 = optstring + 1; if (!optind || __optreset) { __optreset = 0; __optpos = 0; @@ -38,10 +38,9 @@ static int __getopt_long(int argc, char *const *argv, const char *optstring, con if (argv[i][0] == '-' && argv[i][1]) break; } optind = i; - optstring2 = optstring; } resumed = optind; - ret = __getopt_long_core(argc, argv, optstring2, longopts, idx, longonly); + ret = __getopt_long_core(argc, argv, optstring, longopts, idx, longonly); if (resumed > skipped) { int i, cnt = optind-resumed; for (i=0; i