Blame win32/regerror.c

Packit 54873f
#include <string.h>
Packit 54873f
#include <regex.h>
Packit 54873f
#include <stdio.h>
Packit 54873f
// #include "locale_impl.h"
Packit 54873f
Packit 54873f
/* Error message strings for error codes listed in `regex.h'.  This list
Packit 54873f
   needs to be in sync with the codes listed there, naturally. */
Packit 54873f
Packit 54873f
/* Converted to single string by Rich Felker to remove the need for
Packit 54873f
 * data relocations at runtime, 27 Feb 2006. */
Packit 54873f
Packit 54873f
static const char messages[] = {
Packit 54873f
  "No error\0"
Packit 54873f
  "No match\0"
Packit 54873f
  "Invalid regexp\0"
Packit 54873f
  "Unknown collating element\0"
Packit 54873f
  "Unknown character class name\0"
Packit 54873f
  "Trailing backslash\0"
Packit 54873f
  "Invalid back reference\0"
Packit 54873f
  "Missing ']'\0"
Packit 54873f
  "Missing ')'\0"
Packit 54873f
  "Missing '}'\0"
Packit 54873f
  "Invalid contents of {}\0"
Packit 54873f
  "Invalid character range\0"
Packit 54873f
  "Out of memory\0"
Packit 54873f
  "Repetition not preceded by valid expression\0"
Packit 54873f
  "\0Unknown error"
Packit 54873f
};
Packit 54873f
Packit 54873f
size_t regerror(int e, const regex_t *__restrict preg, char *__restrict buf, size_t size)
Packit 54873f
{
Packit 54873f
	const char *s;
Packit 54873f
	for (s=messages; e && *s; e--, s+=strlen(s)+1);
Packit 54873f
	if (!*s) s++;
Packit 54873f
	// s = LCTRANS_CUR(s);
Packit 54873f
	return 1+snprintf(buf, size, "%s", s);
Packit 54873f
}