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