diff --git a/man3/confstr.3 b/man3/confstr.3 index 5af591a8b..314a62d34 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 +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. +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),