environ.7: Relocate and reword the mention of _GNU_SOURCE

Using _GNU_SOURCE to obtain the declaration of 'environ' is
nonstandard. Therefore, move the mention of this detail to NOTES.
At the same time, add a few words proposed by Bastien.

Cowritten-by: Bastien Roucariès <rouca@debian.org>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2021-01-28 10:08:05 +01:00
parent 0efacbdd86
commit fc0bcf3cfe
1 changed files with 12 additions and 6 deletions

View File

@ -43,12 +43,6 @@ 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
.I <unistd.h>
if the
.B _GNU_SOURCE
feature test macro is defined.)
This array of strings is made available to the process by the
.BR exec (3)
call that started the process.
@ -240,6 +234,18 @@ may specify the desired printer to use.
See
.BR lpr (1).
.SH NOTES
Historically and by standard,
.I environ
must be declared in the user program.
However, as a (nonstandard) programmer convenience,
.I environ
is declared in the header file
.I <unistd.h>
if the
.B _GNU_SOURCE
feature test macro is defined (see
.BR feature_test_macros (7)).
.PP
The
.BR prctl (2)
.B PR_SET_MM_ENV_START