Loading...
--- Libc/Libc-583/string/strerror.3
+++ Libc/Libc-262/string/strerror.3
@@ -34,15 +34,14 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)strerror.3 8.1 (Berkeley) 6/9/93
-.\" $FreeBSD: src/lib/libc/string/strerror.3,v 1.23 2004/10/12 14:52:52 keramida Exp $
+.\" $FreeBSD: src/lib/libc/string/strerror.3,v 1.12 2001/10/01 16:09:00 ru Exp $
.\"
-.Dd October 12, 2004
+.Dd June 9, 1993
.Dt STRERROR 3
.Os
.Sh NAME
.Nm perror ,
.Nm strerror ,
-.Nm strerror_r ,
.Nm sys_errlist ,
.Nm sys_nerr
.Nd system error messages
@@ -51,26 +50,15 @@
.Sh SYNOPSIS
.In stdio.h
.Ft void
-.Fo perror
-.Fa "const char *s"
-.Fc
+.Fn perror "const char *string"
.Vt extern const char * const sys_errlist[] ;
.Vt extern const int sys_nerr ;
.In string.h
-.Ft "char *"
-.Fo strerror
-.Fa "int errnum"
-.Fc
-.Ft int
-.Fo strerror_r
-.Fa "int errnum"
-.Fa "char *strerrbuf"
-.Fa "size_t buflen"
-.Fc
+.Ft char *
+.Fn strerror "int errnum"
.Sh DESCRIPTION
The
-.Fn strerror ,
-.Fn strerror_r ,
+.Fn strerror
and
.Fn perror
functions look up the error message string corresponding to an
@@ -80,16 +68,9 @@
.Fn strerror
function accepts an error number argument
.Fa errnum
-and returns a pointer to the corresponding
+and
+returns a pointer to the corresponding
message string.
-.Pp
-The
-.Fn strerror_r
-function renders the same result into
-.Fa strerrbuf
-for a maximum of
-.Fa buflen
-characters and returns 0 upon success.
.Pp
The
.Fn perror
@@ -100,47 +81,22 @@
and writes it, followed by a newline, to the
standard error file descriptor.
If the argument
-.Fa s
+.Fa string
is
.Pf non- Dv NULL
and does not point to the null character,
this string is prepended to the message
string and separated from it by
a colon and space
-.Pq Dq Li ":\ " ;
+.Pq Ql \&:\ \& ;
otherwise, only the error message string is printed.
.Pp
-If the error number is not recognized, these functions return an error message
-string containing
+If
+.Fa errnum
+is not a recognized error number,
+the error message string will contain
.Dq Li "Unknown error:\ "
followed by the error number in decimal.
-The
-.Fn strerror
-and
-.Fn strerror_r
-functions return
-.Er EINVAL
-as a warning.
-Error numbers recognized by this implementation fall in
-the range 0 <
-.Fa errnum
-<
-.Fa sys_nerr .
-.Pp
-If insufficient storage is provided in
-.Fa strerrbuf
-(as specified in
-.Fa buflen )
-to contain the error string,
-.Fn strerror_r
-returns
-.Er ERANGE
-and
-.Fa strerrbuf
-will contain an error message that has been truncated and
-.Dv NUL
-terminated to fit the length specified by
-.Fa buflen .
.Pp
The message strings can be accessed directly using the external
array
@@ -151,23 +107,10 @@
.Va sys_errlist .
The use of these variables is deprecated;
.Fn strerror
-or
-.Fn strerror_r
should be used instead.
.Sh SEE ALSO
.Xr intro 2 ,
.Xr psignal 3
-.Sh STANDARDS
-The
-.Fn perror
-and
-.Fn strerror
-functions conform to
-.St -isoC-99 .
-The
-.Fn strerror_r
-function conforms to
-.St -p1003.1-2001 .
.Sh HISTORY
The
.Fn strerror
@@ -175,23 +118,12 @@
.Fn perror
functions first appeared in
.Bx 4.4 .
-The
-.Fn strerror_r
-function was implemented in
-.Fx 4.4
-by
-.An Wes Peters Aq wes@FreeBSD.org .
.Sh BUGS
For unknown error numbers, the
.Fn strerror
function will return its result in a static buffer which
may be overwritten by subsequent calls.
.Pp
-The return type for
-.Fn strerror
-is missing a type-qualifier; it should actually be
-.Vt const char * .
-.Pp
Programs that use the deprecated
.Va sys_errlist
variable often fail to compile because they declare it