mirror of
https://git.planet-casio.com/Vhex-Kernel-Core/fxlibc.git
synced 2024-12-29 13:03:38 +01:00
string: add and test strerror (DONE)
This commit is contained in:
parent
2a78c17597
commit
b78cec4f6d
3 changed files with 17 additions and 1 deletions
|
@ -141,6 +141,7 @@ set(SOURCES
|
||||||
src/libc/string/strcmp.c
|
src/libc/string/strcmp.c
|
||||||
src/libc/string/strcpy.c
|
src/libc/string/strcpy.c
|
||||||
src/libc/string/strdup.c
|
src/libc/string/strdup.c
|
||||||
|
src/libc/string/strerror.c
|
||||||
src/libc/string/strlen.c
|
src/libc/string/strlen.c
|
||||||
src/libc/string/strncat.c
|
src/libc/string/strncat.c
|
||||||
src/libc/string/strncmp.c
|
src/libc/string/strncmp.c
|
||||||
|
|
2
STATUS
2
STATUS
|
@ -129,7 +129,7 @@ DONE: Function/symbol/macro is defined, builds, links, and is tested
|
||||||
! 7.21.5.7 strstr: TODO
|
! 7.21.5.7 strstr: TODO
|
||||||
! 7.21.5.8 strtok: TODO
|
! 7.21.5.8 strtok: TODO
|
||||||
7.21.6.1 memset: DONE
|
7.21.6.1 memset: DONE
|
||||||
! 7.21.6.2 strerror: TODO
|
7.21.6.2 strerror: DONE
|
||||||
7.21.6.3 strlen: DONE
|
7.21.6.3 strlen: DONE
|
||||||
Extensions:
|
Extensions:
|
||||||
! - strnlen: TODO
|
! - strnlen: TODO
|
||||||
|
|
15
src/libc/string/strerror.c
Normal file
15
src/libc/string/strerror.c
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
#include <string.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
static char *errno_strings [] = {
|
||||||
|
[0] = "Success",
|
||||||
|
[EDOM] = "Numerical argument out of domain",
|
||||||
|
[EILSEQ] = "Invalid or incomplete multibyte or wide character",
|
||||||
|
[ERANGE] = "Numerical result out of range",
|
||||||
|
};
|
||||||
|
|
||||||
|
char *strerror(int e)
|
||||||
|
{
|
||||||
|
int count = sizeof errno_strings / sizeof errno_strings[0];
|
||||||
|
return (e >= 0 && e < count) ? errno_strings[e] : "<Unknown errno>";
|
||||||
|
}
|
Loading…
Reference in a new issue