summaryrefslogtreecommitdiffstats
path: root/include/getopt.h
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2004-02-23 04:17:59 +0000
committerache <ache@FreeBSD.org>2004-02-23 04:17:59 +0000
commit8371e71458dcaa2126be0b30ce531d99670fc3d4 (patch)
treecd7baefba243e3b75e194c3f0f399ea2a4e66332 /include/getopt.h
parentc247a7c1e0b4d73d0bf1a70021ac5683e506b945 (diff)
downloadFreeBSD-src-8371e71458dcaa2126be0b30ce531d99670fc3d4.zip
FreeBSD-src-8371e71458dcaa2126be0b30ce531d99670fc3d4.tar.gz
Try to better mimic GNU getopt.h which does not assume to make visible
all unistd.h functions, use _GETOPT_DECLARE define for that.
Diffstat (limited to 'include/getopt.h')
-rw-r--r--include/getopt.h16
1 files changed, 10 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_ */
OpenPOWER on IntegriCloud