~ubuntu-branches/ubuntu/trusty/musl/trusty-proposed

« back to all changes in this revision

Viewing changes to src/errno/strerror.c

  • Committer: Package Import Robot
  • Author(s): Kevin Bortis
  • Date: 2013-09-20 20:54:14 UTC
  • Revision ID: package-import@ubuntu.com-20130920205414-5b61trtmma18w58o
Tags: upstream-0.9.13
ImportĀ upstreamĀ versionĀ 0.9.13

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include <errno.h>
 
2
#include <string.h>
 
3
 
 
4
#define E(a,b) a,
 
5
static const unsigned char errid[] = {
 
6
#include "__strerror.h"
 
7
};
 
8
 
 
9
#undef E
 
10
#define E(a,b) b "\0"
 
11
static const char errmsg[] =
 
12
#include "__strerror.h"
 
13
;
 
14
 
 
15
char *strerror(int e)
 
16
{
 
17
        const char *s;
 
18
        int i;
 
19
        for (i=0; errid[i] && errid[i] != e; i++);
 
20
        for (s=errmsg; i; s++, i--) for (; *s; s++);
 
21
        return (char *)s;
 
22
}