summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/getopt.h16
-rw-r--r--include/unistd.h3
2 files changed, 13 insertions, 6 deletions
diff --git a/include/getopt.h b/include/getopt.h
index 679dd6d..c29ad42 100644
--- a/include/getopt.h
+++ b/include/getopt.h
@@ -41,12 +41,10 @@
#define _GETOPT_H_
#include <sys/cdefs.h>
-#include <unistd.h>
/*
- * GNU-like getopt_long()
+ * GNU-like getopt_long() & getopt() for GNU programs.
*/
-#if !defined(_POSIX_SOURCE) && !defined(_XOPEN_SOURCE)
#define no_argument 0
#define required_argument 1
#define optional_argument 2
@@ -66,9 +64,15 @@ struct option {
};
__BEGIN_DECLS
-int getopt_long __P((int, char * const *, const char *,
- const struct option *, int *));
+int getopt_long(int, char * const *, const char *,
+ const struct option *, int *);
+#ifndef _GETOPT_DECLARED
+#define _GETOPT_DECLARED
+int getopt(int, char * const [], const char *);
+
+extern char *optarg; /* getopt(3) external variables */
+extern int optind, opterr, optopt;
+#endif /* _GETOPT_DECLARED */
__END_DECLS
-#endif
#endif /* !_GETOPT_H_ */
diff --git a/include/unistd.h b/include/unistd.h
index 6a441dd..8901f93 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -371,10 +371,13 @@ ssize_t write(int, const void *, size_t);
/* 1003.2-1992 */
#if __POSIX_VISIBLE >= 199209 || __XSI_VISIBLE
size_t confstr(int, char *, size_t);
+#ifndef _GETOPT_DECLARED
+#define _GETOPT_DECLARED
int getopt(int, char * const [], const char *);
extern char *optarg; /* getopt(3) external variables */
extern int optind, opterr, optopt;
+#endif /* _GETOPT_DECLARED */
#endif
/* ISO/IEC 9945-1: 1996 */
OpenPOWER on IntegriCloud