xref: /dflybsd-src/share/man/man7/standards.7 (revision a9656fbcd49c376aba5e04370d8b0f1fa96e063c)
1.\"
2.\" Copyright (c) 2010
3.\"	The DragonFly Project.  All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\"
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in
13.\"    the documentation and/or other materials provided with the
14.\"    distribution.
15.\" 3. Neither the name of The DragonFly Project nor the names of its
16.\"    contributors may be used to endorse or promote products derived
17.\"    from this software without specific, prior written permission.
18.\"
19.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22.\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
23.\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24.\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
25.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
29.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30.\" SUCH DAMAGE.
31.\"
32.Dd July 4, 2010
33.Dt STANDARDS 7
34.Os
35.Sh NAME
36.Nm standards
37.Nd standards supported by DragonFly
38.Sh SYNOPSIS
39.Fd "#define _XOPEN_SOURCE 600"
40.Pp
41.In sys/cdefs.h
42.Sh DESCRIPTION
43A number of
44.Dq feature test macros ,
45namely
46.Dv _POSIX_C_SOURCE
47and
48.Dv _XOPEN_SOURCE ,
49can be used by applications to indicate desired sets of features (beyond
50those specified by the C standard) in the programming environment supplied by
51.Dx .
52These macros determine which prototypes are exposed by header files and so on.
53.Pp
54If neither
55.Dv _POSIX_C_SOURCE
56and
57.Dv _XOPEN_SOURCE
58are set, the programming environment defaults to
59.St -susv3 .
60In addition, a number of
61.Bx
62specific prototypes, definitions etc.\& are made visible.
63.Ss POSIX Standards (_POSIX_C_SOURCE)
64The value of the
65.Dv _POSIX_C_SOURCE
66macro determines which
67.Tn POSIX
68standard the programming environment conforms to.
69.Bl -tag -width ".Li 199009"
70.It Li 1
71Make definitions conforming to
72.St -p1003.1-90
73visible.
74Implies
75.St -isoC-90 .
76.It Li 2
77Additionally, make definitions conforming to
78.St -p1003.2-92
79visible.
80.It Li 199009
81Same as
82.Li 1 .
83.It Li 199209
84Same as
85.Li 2 .
86.It Li 199309
87Additionally, make definitions conforming to
88.St -p1003.1b-93
89visible.
90.It Li 199506
91Additionally, make definitions conforming to
92.St -p1003.1c-95
93visible.
94.It Li 200112
95Additionally, make definitions conforming to
96.St -p1003.1-2001
97visible.
98Implies
99.St -isoC-99 .
100This is the default.
101.El
102.Pp
103Defining
104.Dv _POSIX_C_SOURCE
105to any value lower than
106.Li 199009
107(other than
108.Li 1
109or
110.Li 2 )
111makes it default to
112.Li 198808
113which makes definitions conforming to
114.St -p1003.1-88
115visible.
116No C standard is implied in this case.
117.Pp
118Defining the obsolete
119.Dv _POSIX_SOURCE
120macro without defining
121.Dv _POSIX_C_SOURCE
122is equivalent to defining
123.Dv _POSIX_C_SOURCE
124to
125.Li 198808 .
126.Ss X/Open CAE Specifications (_XOPEN_SOURCE)
127The value of the
128.Dv _XOPEN_SOURCE
129macro determines which X/Open CAE specification the programming
130environment conforms to.
131.Bl -tag -width ".Li 500"
132.It Li 500
133Make defintions conforming to the
134.St -susv2
135visible.
136Implies defining
137.Dv _POSIX_C_SOURCE
138to
139.Li 199506 .
140.It Li 600
141Make definitions conforming to the
142.St -susv3
143visible.
144Implies defining
145.Dv _POSIX_C_SOURCE
146to
147.Li 200112 .
148This is the default.
149.El
150.Pp
151If both CAE and POSIX conformance is required, only
152.Dv _XOPEN_SOURCE
153can be set.
154.\".Ss Miscellaneous Macros
155.\".Dv _ANSI_SOURCE
156.\".Dv _C99_SOURCE
157.\".Dv _DRAGONFLY_SOURCE
158.\".Dv _NETBSD_SOURCE
159.Sh HISTORY
160A
161.Nm
162manual page first appeared in
163.Dx 2.7 .
164