unistd: avoid namespace pollution on non-glibc systems
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 7 Feb 2013 00:11:07 +0000 (16:11 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Thu, 7 Feb 2013 00:11:32 +0000 (16:11 -0800)
* lib/unistd.in.h: #define __need_getopt before including <getopt.h>.
This avoids namespace pollution on non-glibc systems, by causing
gnulib unistd.h to behave more like glibc unistd.h.  I also hope
that this fixes a bug on FreeBSD, reported by Mats Erik Andersson in
<http://lists.gnu.org/archive/html/bug-gnulib/2013-02/msg00027.html>.

ChangeLog
lib/unistd.in.h

index 4b046d3..25db57d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2013-02-06  Paul Eggert  <eggert@cs.ucla.edu>
+
+       unistd: avoid namespace pollution on non-glibc systems
+       * lib/unistd.in.h: #define __need_getopt before including <getopt.h>.
+       This avoids namespace pollution on non-glibc systems, by causing
+       gnulib unistd.h to behave more like glibc unistd.h.  I also hope
+       that this fixes a bug on FreeBSD, reported by Mats Erik Andersson in
+       <http://lists.gnu.org/archive/html/bug-gnulib/2013-02/msg00027.html>.
+
 2013-02-04  Paul Eggert  <eggert@cs.ucla.edu>
 
        tmpdir: use secure_getenv
index 7cc022d..8a25aa4 100644 (file)
 /* Get getopt(), optarg, optind, opterr, optopt.
    But avoid namespace pollution on glibc systems.  */
 #if @GNULIB_UNISTD_H_GETOPT@ && !defined __GLIBC__ && !defined _GL_SYSTEM_GETOPT
+# define __need_getopt
 # include <getopt.h>
 #endif