feature_test_macros.7: Update example

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2010-11-01 15:44:32 +01:00
parent ecdf6a22fb
commit cab82d6551
1 changed files with 10 additions and 12 deletions

View File

@ -53,15 +53,13 @@ header file.
When a function requires that a feature test macro is defined,
the manual page SYNOPSIS typically includes a note of the following form
(this example from the
.BR chmod (2)
.BR acct (2)
manual page):
.RS 10
.RS 8
.sp
.B #include <sys/stat.h>
.B #include <unistd.h>
.sp
.BI "int chmod(const char *" path ", mode_t " mode );
.br
.BI "int fchmod(int " fd ", mode_t " mode );
.BI "int acct(const char *" filename );
.sp
.nf
.in -4n
@ -70,21 +68,21 @@ Feature Test Macro Requirements for glibc (see
.fi
.in
.sp
.BR fchmod ():
_BSD_SOURCE || _XOPEN_SOURCE\ >=\ 500
.BR acct ():
_BSD_SOURCE || (_XOPEN_SOURCE && _XOPEN_SOURCE\ <\ 500)
.RE
.PP
The \fB||\fP means that in order to obtain the declaration of
.BR fchmod (2)
.BR acct (2)
from
.IR <sys/stat.h> ,
.IR <unistd.h> ,
\fIeither\fP of the following macro
definitions must be made before including any header files:
.RS
.nf
#define _BSD_SOURCE
#define _XOPEN_SOURCE 500 /* or any value > 500 */
#define _XOPEN_SOURCE /* or any value < 500 */
.fi
.RE
.PP
@ -94,7 +92,7 @@ compilation command:
.nf
cc \-D_BSD_SOURCE
cc \-D_XOPEN_SOURCE=500 # Or any value > 500
cc \-D_XOPEN_SOURCE # Or any value < 500
.fi
.RE
.PP