OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [newlib-1.18.0/] [newlib-1.18.0-or32-1.0rc2/] [newlib/] [libc/] [string/] [strerror_r.c] - Diff between revs 207 and 520

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.