win32 portability patch and win32/rrdlib.vcproj file for the source
[rrdtool.git] / src / rrd_getopt.h
index 7dad11b..1d443f1 100644 (file)
@@ -23,7 +23,7 @@
 #define _GETOPT_H 1
 
 #ifdef __cplusplus
-extern "C" {
+extern    "C" {
 #endif
 
 /* For communication from `getopt' to the caller.
@@ -32,7 +32,7 @@ extern "C" {
    Also, when `ordering' is RETURN_IN_ORDER,
    each non-option ARGV-element is returned here.  */
 
-extern char *optarg;
+    extern char *optarg;
 
 /* Index in ARGV of the next element to be scanned.
    This is used for communication to and from the caller
@@ -46,16 +46,16 @@ extern char *optarg;
    Otherwise, `optind' communicates from one call to the next
    how much of ARGV has been scanned so far.  */
 
-extern int optind;
+    extern int optind;
 
 /* Callers store zero here to inhibit the error message `getopt' prints
    for unrecognized options.  */
 
-extern int opterr;
+    extern int opterr;
 
 /* Set to an option character which was unrecognized.  */
 
-extern int optopt;
+    extern int optopt;
 
 /* Describe the long-named options requested by the application.
    The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
@@ -78,19 +78,18 @@ extern int optopt;
    one).  For long options that have a zero `flag' field, `getopt'
    returns the contents of the `val' field.  */
 
-struct option
-{
+    struct option {
 #if defined (__STDC__) && __STDC__
-  const char *name;
+        const char *name;
 #else
-  char *name;
+        char     *name;
 #endif
-  /* has_arg can't be an enum because some compilers complain about
-     type mismatches in all the code that assumes it is an int.  */
-  int has_arg;
-  int *flag;
-  int val;
-};
+        /* has_arg can't be an enum because some compilers complain about
+           type mismatches in all the code that assumes it is an int.  */
+        int       has_arg;
+        int      *flag;
+        int       val;
+    };
 
 /* Names for the values of the `has_arg' field of `struct option'.  */
 
@@ -103,31 +102,50 @@ struct option
 /* 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 ();
-#endif /* __GNU_LIBRARY__ */
-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);
+    extern int getopt(
+    int argc,
+    char *const *argv,
+    const char *shortopts);
+#else                   /* not __GNU_LIBRARY__ */
+    extern int getopt(
+        );
+#endif                  /* __GNU_LIBRARY__ */
+    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);
 
 /* Internal only.  Users should not call this directly.  */
-extern int _getopt_internal (int argc, char *const *argv,
-                            const char *shortopts,
-                            const struct option *longopts, int *longind,
-                            int long_only);
-#else /* not __STDC__ */
-extern int getopt ();
-extern int getopt_long ();
-extern int getopt_long_only ();
-
-extern int _getopt_internal ();
-#endif /* __STDC__ */
+    extern int _getopt_internal(
+    int argc,
+    char *const *argv,
+    const char *shortopts,
+    const struct option *longopts,
+    int *longind,
+    int long_only);
+#else                   /* not __STDC__ */
+    int getopt_long(int argc,
+                    char **argv,
+                    const char *options,
+                    const struct option *long_options,
+                    int *opt_index);
+    int _getopt_internal(int argc,
+                         char **argv,
+                         const char *shortopts,
+                         const struct option *longopts,
+                         int *longind,
+                         int long_only);
+#endif                  /* __STDC__ */
 
 #ifdef __cplusplus
 }
 #endif
-
-#endif /* _GETOPT_H */
+#endif                  /* _GETOPT_H */