]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man3/confstr.3
Automated addition of parentheses by add_parens_for_own_funcs.sh
[thirdparty/man-pages.git] / man3 / confstr.3
CommitLineData
fea681da
MK
1.\" (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de)
2.\"
3.\" Permission is granted to make and distribute verbatim copies of this
4.\" manual provided the copyright notice and this permission notice are
5.\" preserved on all copies.
6.\"
7.\" Permission is granted to copy and distribute modified versions of this
8.\" manual under the conditions for verbatim copying, provided that the
9.\" entire resulting derived work is distributed under the terms of a
10.\" permission notice identical to this one.
11.\"
12.\" Since the Linux kernel and libraries are constantly changing, this
13.\" manual page may be incorrect or out-of-date. The author(s) assume no
14.\" responsibility for errors or omissions, or for damages resulting from
15.\" the use of the information contained herein. The author(s) may not
16.\" have taken the same level of care in the production of this manual,
17.\" which is licensed free of charge, as they might when working
18.\" professionally.
19.\"
20.\" Formatted or processed versions of this manual, if unaccompanied by
21.\" the source, must acknowledge the copyright and authors of this work.
22.\" License.
23.\" Modified Sat Jul 24 19:53:02 1993 by Rik Faith (faith@cs.unc.edu)
5984622e
MK
24.\" FIXME Many more values for 'name' are supported, some of which
25.\" are documented under 'info confstr'.
26.\" See <bits/confname.h> for the rest.
0359df8c 27.\" These should all be added to this page.
5984622e 28.\" See also the SUSv3 specification of confstr()
fea681da
MK
29.TH CONFSTR 3 1993-04-17 "GNU" "Linux Programmer's Manual"
30.SH NAME
31confstr \- get configuration dependent string variables
32.SH SYNOPSIS
33.nf
34.B #define _POSIX_C_SOURCE 2
35or
36.B #define _XOPEN_SOURCE
37.nl
38.B #include <unistd.h>
39.sp
40.BI "size_t confstr(int " "name" ", char *" buf ", size_t " len );
41.fi
42.SH DESCRIPTION
43.B confstr()
44gets the value of configuration-dependent string variables.
45.PP
46The
47.I name
48argument is the system variable to be queried.
49The following variables are supported:
50.TP
5984622e
MK
51.BR _CS_GNU_LIBC_VERSION " (GNU C library only; since glibc 2.3.2)"
52A string which identifies the GNU C library version on this system
53(e.g, "glibc 2.3.4").
54.TP
55.BR _CS_GNU_LIBPTHREAD_VERSION " (GNU C library only; since glibc 2.3.2)"
56A string which identifies the POSIX implementation supplied by this
57C library (e.g, "NPTL 2.3.4" or "linuxthreads-0.10").
58.TP
fea681da
MK
59.B _CS_PATH
60A value for the
61.B PATH
62variable which indicates where all the POSIX.2 standard utilities can
63be found.
64.PP
65If
66.I buf
67is not
68.BR NULL ,
69and
70.I len
71is not zero,
72.B confstr()
73copies the value of the string to
74.I buf
75truncated to
76.I len \- 1
77characters if necessary, with a null character as termination.
78This can be detected by comparing the return value of
79.B confstr()
80against
81.IR len .
82.PP
83If
84.I len
85is zero and
86.I buf
87is
88.BR NULL ,
89.B confstr()
90just returns the value as defined below.
91.SH "RETURN VALUE"
92If
93.I name
94does not correspond to a valid configuration variable,
95.B confstr()
96returns 0.
97.SH EXAMPLES
98The following code fragment determines the path where to find
99the POSIX.2 system utilities:
100.br
101.nf
102.in 10
103
104char *pathbuf; size_t n;
105
106n = confstr(_CS_PATH,NULL,(size_t)0);
107if ((pathbuf = malloc(n)) == NULL) abort();
108confstr(_CS_PATH, pathbuf, n);
109.SH ERRORS
110If the value of
111.I name
112is invalid,
113.I errno
114is set to
115.BR EINVAL .
116.SH "CONFORMING TO"
117proposed POSIX.2
118.SH BUGS
119POSIX.2 is not yet an approved standard; the information in this
120manpage is subject to change.
121.SH "SEE ALSO"
122.BR sh (1),
123.BR exec (3),
124.BR system (3)