mirror of
https://github.com/macports/macports-ports.git
synced 2026-07-12 18:20:25 -07:00
96 lines
2.9 KiB
Diff
96 lines
2.9 KiB
Diff
--- ./src/getopt.c
|
|
+++ ./src/getopt.c
|
|
@@ -63,7 +63,7 @@ the executable file might be covered by the GNU General Public License. */
|
|
|
|
/* This needs to come after some library #include
|
|
to get __GNU_LIBRARY__ defined. */
|
|
-#if defined(__GNU_LIBRARY__) || defined(__OpenBSD__)
|
|
+#if defined(__GNU_LIBRARY__) || defined(__OpenBSD__) || defined(__APPLE__)
|
|
/* Don't include stdlib.h for non-GNU C libraries because some of them
|
|
contain conflicting prototypes for getopt. */
|
|
#include <stdlib.h>
|
|
@@ -162,7 +162,7 @@ static enum
|
|
REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
|
|
} ordering;
|
|
|
|
-#if defined(__GNU_LIBRARY__) || defined(__OpenBSD__)
|
|
+#if defined(__GNU_LIBRARY__) || defined(__OpenBSD__) || defined(__APPLE__)
|
|
/* We want to avoid inclusion of string.h with non-GNU libraries
|
|
because there are many ways it can cause trouble.
|
|
On some systems, it contains special magic macros that don't work
|
|
@@ -177,9 +177,7 @@ static enum
|
|
char *getenv ();
|
|
|
|
static char *
|
|
-my_index (str, chr)
|
|
- const char *str;
|
|
- int chr;
|
|
+my_index (const char *str, int chr)
|
|
{
|
|
while (*str)
|
|
{
|
|
@@ -223,8 +221,7 @@ static int last_nonopt;
|
|
the new indices of the non-options in ARGV after they are moved. */
|
|
|
|
static void
|
|
-exchange (argv)
|
|
- char **argv;
|
|
+exchange (char **argv)
|
|
{
|
|
int bottom = first_nonopt;
|
|
int middle = last_nonopt;
|
|
@@ -281,8 +278,7 @@ exchange (argv)
|
|
/* Initialize the internal data when the first call is made. */
|
|
|
|
static const char *
|
|
-_getopt_initialize (optstring)
|
|
- const char *optstring;
|
|
+_getopt_initialize (const char *optstring)
|
|
{
|
|
/* Start processing options with ARGV-element 1 (since ARGV-element 0
|
|
is the program name); the sequence of previously skipped
|
|
@@ -369,13 +365,13 @@ _getopt_initialize (optstring)
|
|
long-named options. */
|
|
|
|
int
|
|
-_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
|
- int argc;
|
|
- char *const *argv;
|
|
- const char *optstring;
|
|
- const struct option *longopts;
|
|
- int *longind;
|
|
- int long_only;
|
|
+_getopt_internal (
|
|
+ int argc,
|
|
+ char *const *argv,
|
|
+ const char *optstring,
|
|
+ const struct option *longopts,
|
|
+ int *longind,
|
|
+ int long_only)
|
|
{
|
|
optarg = NULL;
|
|
|
|
@@ -672,10 +668,7 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only)
|
|
}
|
|
|
|
int
|
|
-getopt (argc, argv, optstring)
|
|
- int argc;
|
|
- char *const *argv;
|
|
- const char *optstring;
|
|
+getopt (int argc, char *const *argv, const char *optstring)
|
|
{
|
|
return _getopt_internal (argc, argv, optstring,
|
|
(const struct option *) 0, (int *) 0, 0);
|
|
--- ./src/getopt.h
|
|
+++ ./src/getopt.h
|
|
@@ -94,7 +94,7 @@ extern "C" {
|
|
#define optional_argument 2
|
|
|
|
#if __STDC__
|
|
-#if defined(__GNU_LIBRARY__)
|
|
+#if defined(__GNU_LIBRARY__) || defined(__APPLE__)
|
|
/* Many other libraries have conflicting prototypes for getopt, with
|
|
differences in the consts, in stdlib.h. To avoid compilation
|
|
errors, only prototype getopt for the GNU C library. */
|