summaryrefslogtreecommitdiffstats
path: root/newlib/libc/string/strerror.c
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2016-08-23 17:49:24 +0200
committerCorinna Vinschen <corinna@vinschen.de>2016-08-23 17:51:14 +0200
commit463a8afaa58b80926b0236e14a6171f45c1b784f (patch)
tree6ef3bc150434889e49388b8520ed4ed95095b7cc /newlib/libc/string/strerror.c
parent80e0ad1e77a9365b85ffda62aa1471e5c8768743 (diff)
downloadcygnal-463a8afaa58b80926b0236e14a6171f45c1b784f.tar.gz
cygnal-463a8afaa58b80926b0236e14a6171f45c1b784f.tar.bz2
cygnal-463a8afaa58b80926b0236e14a6171f45c1b784f.zip
Implement missing POSIX-1.2008 function strerror_l
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
Diffstat (limited to 'newlib/libc/string/strerror.c')
-rw-r--r--newlib/libc/string/strerror.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/newlib/libc/string/strerror.c b/newlib/libc/string/strerror.c
index fcef33e0e..49e5f7e64 100644
--- a/newlib/libc/string/strerror.c
+++ b/newlib/libc/string/strerror.c
@@ -7,14 +7,18 @@
/*
FUNCTION
- <<strerror>>---convert error number to string
+ <<strerror>>, <<strerror_l>>---convert error number to string
INDEX
strerror
+INDEX
+ strerror_l
+
ANSI_SYNOPSIS
#include <string.h>
char *strerror(int <[errnum]>);
+ char *strerror_l(int <[errnum]>, locale_t locale);
char *_strerror_r(struct _reent <[ptr]>, int <[errnum]>,
int <[internal]>, int *<[error]>);
@@ -29,6 +33,10 @@ string. The value of <[errnum]> is usually a copy of <<errno>>.
If <<errnum>> is not a known error number, the result points to an
empty string.
+<<strftime_l>> is like <<strftime>> but creates a string in a format
+as expected in locale <[locale]>. If <[locale]> is LC_GLOBAL_LOCALE or
+not a valid locale object, the behaviour is undefined.
+
This implementation of <<strerror>> prints out the following strings
for each of the values defined in `<<errno.h>>':
@@ -330,6 +338,8 @@ PORTABILITY
ANSI C requires <<strerror>>, but does not specify the strings used
for each error number.
+<<strerror_l>> is POSIX-1.2008.
+
Although this implementation of <<strerror>> is reentrant (depending
on <<_user_strerror>>), ANSI C declares that subsequent calls to
<<strerror>> may overwrite the result string; therefore portable
@@ -893,3 +903,10 @@ _DEFUN(strerror, (int),
{
return _strerror_r (_REENT, errnum, 0, NULL);
}
+
+char *
+strerror_l (int errnum, locale_t locale)
+{
+ /* We don't support per-locale error messages. */
+ return _strerror_r (_REENT, errnum, 0, NULL);
+}