int optind = 1; /* index into parent argv vector */
int optopt = '?'; /* character checked for validity */
-static void pass(void) {}
-#define warnx(a, ...) pass()
+static void pass(const char *a) {(void) a; }
+#define warnx(a, ...) pass(a)
#define PRINT_ERROR ((opterr) && (*options != ':'))
char *oli; /* option letter list index */
int optchar, short_too;
static int posixly_correct = -1;
- char *buf;
size_t len;
int optreset = 0;
* Disable GNU extensions if POSIXLY_CORRECT is set or options
* string begins with a '+'.
*/
- if (posixly_correct == -1)
- posixly_correct = _dupenv_s(&buf, &len, "POSIXLY_CORRECT");
+ if (posixly_correct == -1) {
+ errno_t err = _wgetenv_s(&len, NULL, 0, L"POSIXLY_CORRECT");
+ posixly_correct = (err == 0) && (len > 0);
+ }
if (!posixly_correct || *options == '+')
flags &= ~FLAG_PERMUTE;
else if (*options == '-')
flags |= FLAG_ALLARGS;
if (*options == '+' || *options == '-')
options++;
- if (!posixly_correct)
- free(buf);
/*
* reset if requested
*/