From 4f43f21f304f7e225ea3e65fa67253b061790046 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Mon, 1 May 2006 05:53:15 +0000 Subject: [PATCH] Rewrote RETURN VALUE discussion. Updated CONFORMING TO. Removed BUGS. --- man3/confstr.3 | 40 ++++++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 12 deletions(-) diff --git a/man3/confstr.3 b/man3/confstr.3 index 5af591a8b4..314a62d34b 100644 --- a/man3/confstr.3 +++ b/man3/confstr.3 @@ -88,9 +88,35 @@ just returns the value as defined below. .SH "RETURN VALUE" If .I name -does not correspond to a valid configuration variable, +is a valid configuration variable, .BR confstr () +returns the number of bytes (including the terminating null byte) +that would be required to hold the entire value of that variable. +This value may be greater than +.IR len , +which means that the value in +.I buf +is truncated. + +If +.I name +is a valid configuration variable, +but that variable does not have a value, then +.I confstr () returns 0. +If +.I name +does not correspond to a valid configuration variable, +.BR confstr () +returns 0, and +.I errno +is set to +.BR EINVAL . +.SH ERRORS +.BR EINVAL . +If the value of +.I name +is invalid. .SH EXAMPLES The following code fragment determines the path where to find the POSIX.2 system utilities: @@ -103,18 +129,8 @@ char *pathbuf; size_t n; n = confstr(_CS_PATH,NULL,(size_t)0); if ((pathbuf = malloc(n)) == NULL) abort(); confstr(_CS_PATH, pathbuf, n); -.SH ERRORS -If the value of -.I name -is invalid, -.I errno -is set to -.BR EINVAL . .SH "CONFORMING TO" -proposed POSIX.2 -.SH BUGS -POSIX.2 is not yet an approved standard; the information in this -manpage is subject to change. +POSIX.1-2001 .SH "SEE ALSO" .BR sh (1), .BR exec (3), -- 2.39.5