Loading...
--- Libc/Libc-1507.100.9/stdlib/FreeBSD/getopt.c
+++ Libc/Libc-763.12/stdlib/FreeBSD/getopt.c
@@ -44,23 +44,15 @@
#include "libc_private.h"
-#ifndef BUILDING_VARIANT
int opterr = 1, /* if error message should be printed */
optind = 1, /* index into parent argv vector */
optopt, /* character checked for validity */
optreset; /* reset getopt */
char *optarg; /* argument associated with option */
-#endif /* !BUILDING_VARIANT */
#define BADCH (int)'?'
#define BADARG (int)':'
#define EMSG ""
-
-#if __DARWIN_UNIX03
-#define PROGNAME nargv[0]
-#else
-#define PROGNAME _getprogname()
-#endif
/*
* getopt --
@@ -107,8 +99,8 @@
++optind;
if (opterr && *ostr != ':')
(void)fprintf(stderr,
- "%s: illegal option -- %c\n",
- PROGNAME, optopt);
+ "%s: illegal option -- %c\n", _getprogname(),
+ optopt);
return (BADCH);
}
@@ -127,19 +119,13 @@
optarg = nargv[optind];
else {
/* option-argument absent */
-#if __DARWIN_UNIX03
- /* Yes, the standard will put optind past the last
- argument */
- ++optind;
- optarg = NULL;
-#endif /* __DARWIN_UNIX03 */
place = EMSG;
if (*ostr == ':')
return (BADARG);
if (opterr)
(void)fprintf(stderr,
"%s: option requires an argument -- %c\n",
- PROGNAME, optopt);
+ _getprogname(), optopt);
return (BADCH);
}
place = EMSG;