define __KERNEL_STRICT_NAMES to avoid inclusion of kernel types on systems that carry...
[cake.git] / compiler / clib / strerror_rom.c
blob34a244da7ea0107eab6b719c86dfa0a7c5469f11
1 /*
2 Copyright © 1995-2001, The AROS Development Team. All rights reserved.
3 $Id$
5 ANSI C function strerror().
6 */
8 #include <proto/dos.h>
9 #include <errno.h>
10 #include <stdio.h>
12 static const char * _errstrings[] =
14 /* 0 */ "No error",
15 /* EPERM */ "Operation not permitted",
16 /* ENOENT */ "No such file or directory",
17 /* ESRCH */ "No such process",
18 /* EINTR */ "Interrupted system call",
19 /* EIO */ "I/O error",
20 /* ENXIO */ "No such device or address",
21 /* E2BIG */ "Arg list too long",
22 /* ENOEXEC */ "Exec format error",
23 /* EBADF */ "Bad file number",
24 /* ECHILD */ "No child processes",
25 /* EAGAIN */ "Try again",
26 /* ENOMEM */ "Out of memory",
27 /* EACCES */ "Permission denied",
28 /* EFAULT */ "Bad address",
29 /* ENOTBLK */ "Block device required",
30 /* EBUSY */ "Device or resource busy",
31 /* EEXIST */ "File exists",
32 /* EXDEV */ "Cross-device link",
33 /* ENODEV */ "No such device",
34 /* ENOTDIR */ "Not a directory",
35 /* EISDIR */ "Is a directory",
36 /* EINVAL */ "Invalid argument",
37 /* ENFILE */ "File table overflow",
38 /* EMFILE */ "Too many open files",
39 /* ENOTTY */ "Not a typewriter",
40 /* ETXTBSY */ "Text file busy",
41 /* EFBIG */ "File too large",
42 /* ENOSPC */ "No space left on device",
43 /* ESPIPE */ "Illegal seek",
44 /* EROFS */ "Read-only file system",
45 /* EMLINK */ "Too many links",
46 /* EPIPE */ "Broken pipe",
47 /* EDOM */ "Math argument out of domain of func",
48 /* ERANGE */ "Math result not representable",
49 /* EDEADLK */ "Resource deadlock would occur",
50 /* ENAMETOOLONG */ "File name too long",
51 /* ENOLCK */ "No record locks available",
52 /* ENOSYS */ "Function not implemented",
53 /* ENOTEMPTY */ "Directory not empty",
54 /* ELOOP */ "Too many symbolic links encountered",
55 /* EWOULDBLOCK=EAGAIN */ "Resource not available at the moment",
56 /* ENOMSG */ "No message of desired type",
57 /* EIDRM */ "Identifier removed",
58 /* ECHRNG */ "Channel number out of range",
59 /* EL2NSYNC */ "Level 2 not synchronized",
60 /* EL3HLT */ "Level 3 halted",
61 /* EL3RST */ "Level 3 reset",
62 /* ELNRNG */ "Link number out of range",
63 /* EUNATCH */ "Protocol driver not attached",
64 /* ENOCSI */ "No CSI structure available",
65 /* EL2HLT */ "Level 2 halted",
66 /* EBADE */ "Invalid exchange",
67 /* EBADR */ "Invalid request descriptor",
68 /* EXFULL */ "Exchange full",
69 /* ENOANO */ "No anode",
70 /* EBADRQC */ "Invalid request code",
71 /* EBADSLT */ "Invalid slot",
72 /* EDEADLOCK=EDEADLK */ "Reasource deadlock avoided",
73 /* EBFONT */ "Bad font file format",
74 /* ENOSTR */ "Device not a stream",
75 /* ENODATA */ "No data available",
76 /* ETIME */ "Timer expired",
77 /* ENOSR */ "Out of streams resources",
78 /* ENONET */ "Machine is not on the network",
79 /* ENOPKG */ "Package not installed",
80 /* EREMOTE */ "Object is remote",
81 /* ENOLINK */ "Link has been severed",
82 /* EADV */ "Advertise error",
83 /* ESRMNT */ "Srmount error",
84 /* ECOMM */ "Communication error on send",
85 /* EPROTO */ "Protocol error",
86 /* EMULTIHOP */ "Multihop attempted",
87 /* EDOTDOT */ "RFS specific error",
88 /* EBADMSG */ "Not a data message",
89 /* EOVERFLOW */ "Value too large for defined data type",
90 /* ENOTUNIQ */ "Name not unique on network",
91 /* EBADFD */ "File descriptor in bad state",
92 /* EREMCHG */ "Remote address changed",
93 /* ELIBACC */ "Can not access a needed shared library",
94 /* ELIBBAD */ "Accessing a corrupted shared library",
95 /* ELIBSCN */ ".lib section in a.out corrupted",
96 /* ELIBMAX */ "Attempting to link in too many shared libraries",
97 /* ELIBEXEC */ "Cannot exec a shared library directly",
98 /* EILSEQ */ "Illegal byte sequence",
99 /* ERESTART */ "Interrupted system call should be restarted",
100 /* ESTRPIPE */ "Streams pipe error",
101 /* EUSERS */ "Too many users",
102 /* ENOTSOCK */ "Socket operation on non-socket",
103 /* EDESTADDRREQ */ "Destination address required",
104 /* EMSGSIZE */ "Message too long",
105 /* EPROTOTYPE */ "Protocol wrong type for socket",
106 /* ENOPROTOOPT */ "Protocol not available",
107 /* EPROTONOSUPPORT */ "Protocol not supported",
108 /* ESOCKTNOSUPPORT */ "Socket type not supported",
109 /* EOPNOTSUPP */ "Operation not supported on transport endpoint",
110 /* EPFNOSUPPORT */ "Protocol family not supported",
111 /* EAFNOSUPPORT */ "Address family not supported by protocol",
112 /* EADDRINUSE */ "Address already in use",
113 /* EADDRNOTAVAIL */ "Cannot assign requested address",
114 /* ENETDOWN */ "Network is down",
115 /* ENETUNREACH */ "Network is unreachable",
116 /* ENETRESET */ "Network dropped connection because of reset",
117 /* ECONNABORTED */ "Software caused connection abort",
118 /* ECONNRESET */ "Connection reset by peer",
119 /* ENOBUFS */ "No buffer space available",
120 /* EISCONN */ "Transport endpoint is already connected",
121 /* ENOTCONN */ "Transport endpoint is not connected",
122 /* ESHUTDOWN */ "Cannot send after transport endpoint shutdown",
123 /* ETOOMANYREFS */ "Too many references: cannot splice",
124 /* ETIMEDOUT */ "Connection timed out",
125 /* ECONNREFUSED */ "Connection refused",
126 /* EHOSTDOWN */ "Host is down",
127 /* EHOSTUNREACH */ "No route to host",
128 /* EALREADY */ "Operation already in progress",
129 /* EINPROGRESS */ "Operation now in progress",
130 /* ESTALE */ "Stale NFS file handle",
131 /* EUCLEAN */ "Structure needs cleaning",
132 /* ENOTNAM */ "Not a XENIX named type file",
133 /* ENAVAIL */ "No XENIX semaphores available",
134 /* EISNAM */ "Is a named type file",
135 /* EREMOTEIO */ "Remote I/O error",
136 /* EDQUOT */ "Quota exceeded",
139 /*****************************************************************************
141 NAME */
142 #include <string.h>
144 char * strerror (
146 /* SYNOPSIS */
147 int n)
149 /* FUNCTION
150 Returns a readable string for an error number in errno.
152 INPUTS
153 n - The contents of errno or a #define from errno.h
155 RESULT
156 A string describing the error.
158 NOTES
160 EXAMPLE
162 BUGS
164 SEE ALSO
166 INTERNALS
168 ******************************************************************************/
170 if (n >= MAX_ERRNO)
172 return NULL;
175 return (char *)_errstrings[n];
176 } /* strerror */