summaryrefslogtreecommitdiff
path: root/src/getopt/getopt.h
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2011-01-12 16:08:22 +0000
committerJosé Fonseca <jfonseca@vmware.com>2011-01-12 16:54:21 +0000
commitf9bb5323eb96f47cfb4ab5f93165323df0a1fd61 (patch)
treefdc8f69ad6ed4bc345d464b97ea3cfeb76cbb722 /src/getopt/getopt.h
parent6d670f6c0f3b9383b8b4c8ed12beaeec56928266 (diff)
getopt: Make code more portable.
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 0311b078b7..117608f485 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_ */