4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-15 11:00:04 +08:00
Jeff Johnston d29587b478 2002-05-24 Jeff Johnston <jjohnstn@redhat.com>
* libc/include/string.h: Add strnlen and strerror_r prototypes.
        * libc/string/Makefile.am: Add strnlen.c and strerror_r.c support.
        * libc/string/Makefile.in: Regenerated.
        * libc/string/strerror_r.c: New file.
        * libc/string/strnlen.c: New file.
        * libc/sys/linux/Makefile.am: Add rename.c.
        * libc/sys/linux/Makefile.in: Regenerated.
        * libc/sys/linux/rename.c: New file to override default rename.
2002-05-24 23:44:39 +00:00

54 lines
1.2 KiB
C

/*
FUNCTION
<<strerror_r>>---convert error number to string and copy to buffer
INDEX
strerror_r
ANSI_SYNOPSIS
#include <string.h>
char *strerror_r(int <[errnum]>, char *<[buffer]>, size_t <[n]>);
TRAD_SYNOPSIS
#include <string.h>
char *strerror_r(<[errnum]>, <[buffer]>, <[n]>)
int <[errnum]>;
char *<[buffer]>;
size_t <[n]>;
DESCRIPTION
<<strerror_r>> converts the error number <[errnum]> into a
string and copies the result into the supplied <[buffer]> for
a length up to <[n]>, including the NUL terminator. The value of
<[errnum]> is usually a copy of <<errno>>. If <<errnum>> is not a known
error number, the result is the empty string.
See <<strerror>> for how strings are mapped to <<errnum>>.
RETURNS
This function returns a pointer to a string. Your application must
not modify that string.
PORTABILITY
<<strerror_r>> is a gnu extension.
<<strerror_r>> requires no supporting OS subroutines.
*/
#undef __STRICT_ANSI__
#include <errno.h>
#include <string.h>
char *
_DEFUN (strerror_r, (errnum, buffer, n),
int errnum _AND
char *buffer _AND
size_t n)
{
char *error;
error = strerror (errnum);
return strncpy (buffer, (const char *)error, n);
}