r3852: port to mac os x which has getopt but not getopt_long
[ctsim.git] / getopt / getopt.h
index b0147e9d2ac314401941304659c3c19575f025df..74a3a5820b37633697d28f27c818eb77fe6f6cfa 100644 (file)
@@ -19,6 +19,9 @@
 
 #ifndef _GETOPT_H
 
+#include "../config.h"
+
+
 #ifndef __need_getopt
 # define _GETOPT_H 1
 #endif
@@ -82,7 +85,7 @@ extern int optopt;
 
 struct option
 {
-# if defined __STDC__ && __STDC__
+# if defined __STDC__
   const char *name;
 # else
   char *name;
@@ -126,19 +129,19 @@ struct option
    arguments to the option '\0'.  This behavior is specific to the GNU
    `getopt'.  */
 
-#if defined __STDC__ && __STDC__
+#if defined __STDC__ 
 # ifdef __GNU_LIBRARY__
 /* 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.  */
 extern int getopt (int __argc, char *const *__argv, const char *__shortopts);
 # else /* not __GNU_LIBRARY__ */
-extern int getopt ();
+  /* extern int getopt (); */
 # endif /* __GNU_LIBRARY__ */
 
 # ifndef __need_getopt
-extern int getopt_long (int __argc, char *const *__argv, const char *__shortopts,
-                       const struct option *__longopts, int *__longind);
+extern int getopt_long (int argc, char *const *argv, const char *shortopts,
+                       const struct option *longopts, int *longind);
 extern int getopt_long_only (int __argc, char *const *__argv,
                             const char *__shortopts,
                             const struct option *__longopts, int *__longind);
@@ -152,10 +155,15 @@ extern int _getopt_internal (int __argc, char *const *__argv,
 #else /* not __STDC__ */
 extern int getopt ();
 # ifndef __need_getopt
-extern int getopt_long ();
-extern int getopt_long_only ();
-
-extern int _getopt_internal ();
+extern int getopt_long (int argc, char *const *argv, const char *shortopts,\r
+                       const struct option *longopts, int *longind);\r
+extern int getopt_long_only (int __argc, char *const *__argv,\r
+                            const char *__shortopts,\r
+                            const struct option *__longopts, int *__longind);\r
+extern int _getopt_internal (int __argc, char *const *__argv,\r
+                            const char *__shortopts,\r
+                            const struct option *__longopts, int *__longind,\r
+                            int __long_only);\r
 # endif
 #endif /* __STDC__ */