1 --- getopt.c.bsdnew 2009-11-13 14:11:48.000000000 -0800
2 +++ getopt.c 2009-11-13 14:11:48.000000000 -0800
3 @@ -44,16 +44,24 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/
5 #include "libc_private.h"
7 +#ifndef BUILDING_VARIANT
8 int opterr = 1, /* if error message should be printed */
9 optind = 1, /* index into parent argv vector */
10 optopt, /* character checked for validity */
11 optreset; /* reset getopt */
12 char *optarg; /* argument associated with option */
13 +#endif /* !BUILDING_VARIANT */
15 #define BADCH (int)'?'
16 #define BADARG (int)':'
20 +#define PROGNAME nargv[0]
22 +#define PROGNAME _getprogname()
27 * Parse argc/argv argument vector.
28 @@ -99,8 +107,8 @@ getopt(nargc, nargv, ostr)
30 if (opterr && *ostr != ':')
32 - "%s: illegal option -- %c\n", _getprogname(),
34 + "%s: illegal option -- %c\n",
39 @@ -119,13 +127,19 @@ getopt(nargc, nargv, ostr)
40 optarg = nargv[optind];
42 /* option-argument absent */
44 + /* Yes, the standard will put optind past the last
48 +#endif /* __DARWIN_UNIX03 */
54 "%s: option requires an argument -- %c\n",
55 - _getprogname(), optopt);