summaryrefslogtreecommitdiff
path: root/lib/getopt.h
diff options
context:
space:
mode:
authorpaul <paul>2005-06-24 01:20:25 +0000
committerpaul <paul>2005-06-24 01:20:25 +0000
commit510e209d26c6f1a0fd7f7005f05a98ac71ae1832 (patch)
tree2f19320763222efda4a26b46c8b97013400f0e30 /lib/getopt.h
parent8469bd7552843333f299e0607f0a2efb7ca056f6 (diff)
2005-06-24 Pawel Worach <pawel.worach@gmail.com>
* getopt.h: add further tests for full getopt declaration on various systems.
Diffstat (limited to 'lib/getopt.h')
-rw-r--r--lib/getopt.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/lib/getopt.h b/lib/getopt.h
index 68a9acfb..dceb0301 100644
--- a/lib/getopt.h
+++ b/lib/getopt.h
@@ -99,10 +99,19 @@ struct option
#define optional_argument 2
#if defined (__STDC__) && __STDC__
-#if defined (__GNU_LIBRARY__) || defined (__EXTENSIONS__)
+#if defined (__GNU_LIBRARY__) \
+ || defined (__EXTENSIONS__) \
+ || defined (_GETOPT_DEFINED_) \
+ || defined (_GETOPT_DECLARED)
/* 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. */
+ errors, only prototype getopt for systems we know have compatible
+ getopt.
+ glibc: __GNU_LIBRARY__
+ solaris: __EXTENSIONS__
+ OpenBSD: _GETOPT_DEFINED_
+ FreeBSD: _GETOPT_DECLARED
+ */
extern int getopt (int argc, char *const *argv, const char *shortopts);
#else /* not __GNU_LIBRARY__ or __EXTENSIONS__ */
extern int getopt (void);