4 #include "locale_impl.h"
6 /* Error message strings for error codes listed in `regex.h'. This list
7 needs to be in sync with the codes listed there, naturally. */
9 /* Converted to single string by Rich Felker to remove the need for
10 * data relocations at runtime, 27 Feb 2006. */
12 static const char messages
[] = {
16 "Unknown collating element\0"
17 "Unknown character class name\0"
18 "Trailing backslash\0"
19 "Invalid back reference\0"
23 "Invalid contents of {}\0"
24 "Invalid character range\0"
26 "Repetition not preceded by valid expression\0"
30 size_t regerror(int e
, const regex_t
*restrict preg
, char *restrict buf
, size_t size
)
33 for (s
=messages
; e
&& *s
; e
--, s
+=strlen(s
)+1);
36 return 1+snprintf(buf
, size
, "%s", s
);