[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[PATCH 07/14] Better documentation of _GNU_SOURCE for environment

From: Bastien Roucariès <rouca@debian.org>

Use feature_test_macros and document that historically
you should manually declare it.
 man7/environ.7 | 24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)

diff --git a/man7/environ.7 b/man7/environ.7
index 2fee102ce..bba4f93cb 100644
--- a/man7/environ.7
+++ b/man7/environ.7
@@ -36,19 +36,36 @@
 environ \- user environment
+.B #include <unistd.h>
 .BI "extern char **" environ ;
+.RS -4
+Feature Test Macro Requirements for glibc (see
+.BR feature_test_macros (7)):
+.BR environ:
+        _GNU_SOURCE
 The variable
 .I environ
 points to an array of pointers to strings called the "environment".
 The last pointer in this array has the value NULL.
-(This variable must be declared in the user program,
-but is declared in the header file
+Historically and by standard, this variable must be declared in the user program,
+but for programmer convenience
+.I environ
+is also declared in the header file
 .I <unistd.h>
 if the
-feature test macro is defined.)
+feature test macro is defined (see
+.BR feature_test_macros(7)).
 This array of strings is made available to the process by the
 .BR exec (3)
 call that started the process.
@@ -384,6 +401,7 @@ and strictly conformant to POSIX.1-2017.
 .BR putenv (3),
 .BR setenv (3),
 .BR unsetenv (3),
+.NR feature_test_macros(7),
 .BR locale (7),
 .BR ld.so (8),
 .BR pam_env (8)

Reply to: