about summary refs log tree commit diff
path: root/libio/stdio.h
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2017-03-25 11:24:24 -0400
committerZack Weinberg <zackw@panix.com>2017-04-07 07:53:03 -0400
commit10a33cf8b403e3c031c5dd10a06b4a2a6489e48c (patch)
treedd0fe2c58f8a61cb33ee60fffd287f609745ac7a /libio/stdio.h
parent0f3be8721a86299600eae2d266934f661bf7c990 (diff)
downloadglibc-10a33cf8b403e3c031c5dd10a06b4a2a6489e48c.tar.gz
glibc-10a33cf8b403e3c031c5dd10a06b4a2a6489e48c.tar.xz
glibc-10a33cf8b403e3c031c5dd10a06b4a2a6489e48c.zip
getopt: eliminate __need_getopt by splitting up getopt.h.
__need_getopt is misnamed; what it really means is "we want only the
getopt features specified in POSIX, not the GNU extensions".  Because
this code is shared with gnulib, it winds up being cleanest to split
getopt.h into *four* headers.  getopt_core.h and getopt_ext.h will
be shared with gnulib, getopt_posix.h will be just for glibc, and
each project will have its own copy of getopt.h.

	* posix/bits/getopt_core.h, posix/bits/getopt_ext.h:
	New files, intended to be shared with gnulib.
	* posix/bits/getopt_posix.h:
	New file, not intended to be shared with gnulib.
	* posix/getopt.h: Now just includes features.h,
	bits/getopt_core.h, and bits/getopt_ext.h.  Will
	no longer be shared with gnulib.
	* include/bits/getopt_core.h, include/bits/getopt_ext.h
	* include/bits/getopt_posix.h: New wrappers.
	* posix/Makefile: Install new headers.
	* posix/unistd.h, libio/stdio.h:
	Include bits/getopt_posix.h instead of getopt.h.
Diffstat (limited to 'libio/stdio.h')
-rw-r--r--libio/stdio.h10
1 files changed, 4 insertions, 6 deletions
diff --git a/libio/stdio.h b/libio/stdio.h
index 3e01d54eb2..422f39daf5 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -875,12 +875,10 @@ extern void funlockfile (FILE *__stream) __THROW;
 #endif /* POSIX */
 
 #if defined __USE_XOPEN && !defined __USE_XOPEN2K && !defined __USE_GNU
-/* The X/Open standard requires some functions and variables to be
-   declared here which do not belong into this header.  But we have to
-   follow.  In GNU mode we don't do this nonsense.  */
-# define __need_getopt
-# include <getopt.h>
-#endif	/* X/Open, but not issue 6 and not for GNU.  */
+/*  X/Open Issues 1-5 required getopt to be declared in this
+   header.  It was removed in Issue 6.  GNU follows Issue 6.  */
+# include <bits/getopt_posix.h>
+#endif
 
 /* If we are compiling with optimizing read this file.  It contains
    several optimizing inline functions and macros.  */