xref: /freebsd/usr.bin/getconf/getconf.1 (revision 5521ff5a4d1929056e7ffc982fac3341ca54df7c)
1.\"
2.\" Copyright 2000 Massachusetts Institute of Technology
3.\"
4.\" Permission to use, copy, modify, and distribute this software and
5.\" its documentation for any purpose and without fee is hereby
6.\" granted, provided that both the above copyright notice and this
7.\" permission notice appear in all copies, that both the above
8.\" copyright notice and this permission notice appear in all
9.\" supporting documentation, and that the name of M.I.T. not be used
10.\" in advertising or publicity pertaining to distribution of the
11.\" software without specific, written prior permission.  M.I.T. makes
12.\" no representations about the suitability of this software for any
13.\" purpose.  It is provided "as is" without express or implied
14.\" warranty.
15.\"
16.\" THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''.  M.I.T. DISCLAIMS
17.\" ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
18.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
20.\" SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21.\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22.\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23.\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24.\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27.\" SUCH DAMAGE.
28.\"
29.\" $FreeBSD$
30.\"
31.Dd April 25, 2000
32.Dt GETCONF 1
33.Os
34.Sh NAME
35.Nm getconf
36.Nd retrieve standard configuration variables
37.Sh SYNOPSIS
38.Nm
39.Op Fl v Ar environment
40.Ar path_var
41.Ar file
42.Pp
43.Nm
44.Op Fl v Ar environment
45.Ar system_var
46.Sh DESCRIPTION
47The
48.Nm
49utility prints the value of a
50.Tn POSIX
51or
52.Tn X/Open
53path or system configuration variable to the standard output.
54If the specified variable is undefined, the string
55.Dq Li undefined
56is output.
57.Pp
58The first form of the command, with two mandatory
59arguments, retrieves file- and filesystem-specific
60configuration variables using
61.Xr pathconf 2 .
62The second form, with a single argument, retrieves system
63configuration variables using
64.Xr confstr 3
65and
66.Xr sysconf 3 ,
67depending on the type of variable.
68.Pp
69All variables use the same name as the manifest constants defined in
70the relevant standard C-language bindings, including any leading
71underscore or prefix.
72That is to say,
73.Ar system_var
74might be
75.Dv ARG_MAX
76or
77.Dv _POSIX_VERSION ,
78as opposed to the
79.Xr sysconf 3
80names
81.Dv _SC_ARG_MAX
82or
83.Dv _SC_POSIX_VERSION .
84(There is one exception: there is no corresponding manifest constant
85to
86.Dv _CS_PATH ,
87so a
88.Ar system_var
89of
90.Dq Li PATH
91is used.)
92.Pp
93The
94.Fl v Ar environment
95option is not supported, but provided for compatibility purposes.
96.Sh DIAGNOSTICS
97The
98.Nm
99utility exits 0 on success or >0 if an error occurred.
100Use of a
101.Ar system_var
102or
103.Ar path_var
104which is completely unknown to the system is considered an error,
105causing a diagnostic message to be written to standard error; one
106which is known but merely undefined does not result in an error
107indication.
108.Pp
109Use of the unsupported
110.Fl v Ar environment
111option will result in a diagnostic message indicating that it is not
112supported.
113.Sh EXAMPLES
114The command:
115.Bd -literal -offset indent
116getconf PATH
117.Ed
118.Pp
119will display the system default setting for the
120.Ev PATH
121environment variable.
122.Pp
123The command:
124.Bd -literal -offset indent
125getconf NAME_MAX /tmp
126.Ed
127.Pp
128will display the maximum length of a filename in the
129.Pa /tmp
130directory.
131.Sh SEE ALSO
132.Xr pathconf 2 ,
133.Xr confstr 3 ,
134.Xr sysconf 3
135.Sh STANDARDS
136The
137.Nm
138utility is expected to be compliant with
139.St -susv2 .
140.Sh HISTORY
141The
142.Nm
143command first appeared in
144.Fx 5.0 .
145.Sh AUTHORS
146.An Garrett A. Wollman Aq wollman@lcs.mit.edu
147