summaryrefslogtreecommitdiff
path: root/src/string/strerror.c
blob: 055a11f73a45fe271bd916f855990720f78a0be5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#include <string.h>
#include "errno.h"
#include "stdio.h"
# define __LONGEST_STRERR 64	/* FIXME */

/** convert error number to string **/
char * strerror(int errnum)
{
	static char errstr[__LONGEST_STRERR+1];

	switch (errnum) {
	#include "_strerror.h"
	default:
		sprintf(errstr, "unknown error [%d]", errnum);
		break;
	}

	/*
	RETURN_ALWAYS(a pointer to the message string);
	*/
	return errstr;
}

/***
converts the error number ARGUMENT(errnum) to an error message
string. The string returned should not be modified, and may be overwritten by
subsequent calls.
***/
/*
STDC(1)
*/