Move bsd_getopt() from <bsd/getopt.h> to <bsd/unistd.h> Deprecate <bsd/getopt.h>.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
diff --git a/include/bsd/getopt.h b/include/bsd/getopt.h
index ba2c4eb..697f940 100644
--- a/include/bsd/getopt.h
+++ b/include/bsd/getopt.h
@@ -1,6 +1,5 @@
/*
- * Copyright © 2006 Robert Millan
- * Copyright © 2009, 2011 Guillem Jover
+ * Copyright © 2011 Guillem Jover
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -28,23 +27,13 @@
#ifndef LIBBSD_GETOPT_H
#define LIBBSD_GETOPT_H
-#include <sys/cdefs.h>
-
#ifdef LIBBSD_OVERLAY
#include_next <getopt.h>
+#include <unistd.h>
#else
+#warning "Deprecated header, use <bsd/unistd.h> or <unistd.h> with libbsd-overlay.pc instead."
#include <getopt.h>
+#include <bsd/unistd.h>
#endif
-__BEGIN_DECLS
-extern int optreset;
-
-#ifdef LIBBSD_OVERLAY
-#undef getopt
-#define getopt(argc, argv, optstr) bsd_getopt(argc, argv, optstr)
-#endif
-
-int bsd_getopt (int, char **, char *);
-__END_DECLS
-
#endif
diff --git a/include/bsd/unistd.h b/include/bsd/unistd.h
index 61aaff4..1c4e579 100644
--- a/include/bsd/unistd.h
+++ b/include/bsd/unistd.h
@@ -1,4 +1,5 @@
/*
+ * Copyright © 2006 Robert Millan
* Copyright © 2008-2011 Guillem Jover
*
* Redistribution and use in source and binary forms, with or without
@@ -41,6 +42,15 @@
#endif
__BEGIN_DECLS
+extern int optreset;
+
+#ifdef LIBBSD_OVERLAY
+#undef getopt
+#define getopt(argc, argv, optstr) bsd_getopt(argc, argv, optstr)
+#endif
+
+int bsd_getopt(int, char **, char *);
+
mode_t getmode(const void *set, mode_t mode);
void *setmode(const char *mode_str);