Don't mention getopt() for C++. (Local fix).
authorRaja R Harinath <harinath@src.gnome.org>
Wed, 11 Mar 1998 23:28:44 +0000 (23:28 +0000)
committerRaja R Harinath <harinath@src.gnome.org>
Wed, 11 Mar 1998 23:28:44 +0000 (23:28 +0000)
* getopt.h: Don't mention getopt() for C++.  (Local fix).

This is IMHO better than my previous commit.  -- Hari

svn path=/trunk/; revision=140

support/ChangeLog
support/getopt.h

index 971dc14..b5bf43c 100644 (file)
@@ -1,6 +1,6 @@
 1998-03-11  Raja R Harinath  <harinath@cs.umn.edu>
 
-       * getopt.h: Prototype getopt() for C++ too.  (Local fix).
+       * getopt.h: Don't mention getopt() for C++.  (Local fix).
 
        * vsnprintf.c: Actually fill it in.  It is from
        <URL:http://theos.com/~deraadt/snprintf.c>, with one small fix to
index de4b4e0..9b25f90 100644 (file)
@@ -97,15 +97,17 @@ struct option
 #define optional_argument      2
 
 #if defined (__STDC__) && __STDC__
-#if defined __cplusplus || defined __GNU_LIBRARY__
+#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.
-
-   But, C++ is more pedantic, and demands a prototype.  */
+   errors, only prototype getopt for the GNU C library.  */
 extern int getopt (int argc, char *const *argv, const char *shortopts);
 #else /* not __GNU_LIBRARY__ */
+#ifndef __cplusplus
+/* C++ is more pedantic, and demands a full prototype, not this.
+   Hope that stdlib.h has a prototype for `getopt'.  */
 extern int getopt ();
+#endif /* __cplusplus */
 #endif /* __GNU_LIBRARY__ */
 extern int getopt_long (int argc, char *const *argv, const char *shortopts,
                        const struct option *longopts, int *longind);