• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #include <errno.h>
2 #include <string.h>
3 #include "locale_impl.h"
4 
5 #define E(a,b) ((unsigned char)a),
6 static const unsigned char errid[] = {
7 #include "__strerror.h"
8 };
9 
10 #undef E
11 #define E(a,b) b "\0"
12 static const char errmsg[] =
13 #include "__strerror.h"
14 ;
15 
__strerror_l(int e,locale_t loc)16 char *__strerror_l(int e, locale_t loc)
17 {
18 	const char *s;
19 	int i;
20 	/* mips has one error code outside of the 8-bit range due to a
21 	 * historical typo, so we just remap it. */
22 	if (EDQUOT==1133) {
23 		if (e==109) e=-1;
24 		else if (e==EDQUOT) e=109;
25 	}
26 	for (i=0; errid[i] && errid[i] != e; i++);
27 	for (s=errmsg; i; s++, i--) for (; *s; s++);
28 	return (char *)s;
29 }
30 
strerror(int e)31 char *strerror(int e)
32 {
33 	return __strerror_l(e, NULL);
34 }
35 
36 weak_alias(__strerror_l, strerror_l);
37