summaryrefslogtreecommitdiff
path: root/src/getopt/getopt.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/getopt/getopt.h')
-rw-r--r--src/getopt/getopt.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/getopt/getopt.h b/src/getopt/getopt.h
index 0311b078b71..117608f485e 100644
--- a/src/getopt/getopt.h
+++ b/src/getopt/getopt.h
@@ -33,8 +33,6 @@
#ifndef _GETOPT_H_
#define _GETOPT_H_
-#include <sys/cdefs.h>
-
/*
* GNU-like getopt_long() and 4.4BSD getsubopt()/optreset extensions
*/
@@ -42,6 +40,10 @@
#define required_argument 1
#define optional_argument 2
+#ifdef __cplusplus
+extern "C" {
+#endif
+
struct option {
/* name of long option */
const char *name;
@@ -56,7 +58,6 @@ struct option {
int val;
};
-__BEGIN_DECLS
int getopt_long(int, char * const *, const char *,
const struct option *, int *);
int getopt_long_only(int, char * const *, const char *,
@@ -73,6 +74,9 @@ extern int optopt;
extern int optreset;
extern char *suboptarg; /* getsubopt(3) external variable */
#endif
-__END_DECLS
+
+#ifdef __cplusplus
+}
+#endif
#endif /* !_GETOPT_H_ */