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