fix config file path
[AROS.git] / compiler / clib / strerror.c
blob05d9635dc1e011ce5c78aae0f62ed60502f4d43a
1 /*
2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
3 $Id$
5 C99 function strerror().
6 */
8 #include "__arosc_privdata.h"
10 #include <proto/dos.h>
11 #include <clib/macros.h>
12 #include <errno.h>
13 #include <stdio.h>
15 extern const char * _errstrings[];
17 /*****************************************************************************
19 NAME */
20 #include <string.h>
22 char * strerror (
24 /* SYNOPSIS */
25 int n)
27 /* FUNCTION
28 Returns a readable string for an error number in errno.
30 INPUTS
31 n - The contents of errno or a #define from errno.h
33 RESULT
34 A string describing the error.
36 NOTES
38 EXAMPLE
40 BUGS
42 SEE ALSO
44 INTERNALS
46 ******************************************************************************/
48 if (n > MAX_ERRNO)
50 struct aroscbase *aroscbase = __aros_getbase_aroscbase();
52 Fault(n - MAX_ERRNO, NULL, aroscbase->acb_fault_buf, sizeof(aroscbase->acb_fault_buf));
54 return aroscbase->acb_fault_buf;
56 else
58 char *s;
60 s = (char *)_errstrings[MIN(n, ELAST+1)];
62 if (s == NULL)
63 s = (char *)"Errno out of range";
65 return s;
67 } /* strerror */