1 
2 static char rcsid[] = "@(#)$Id: errno.c,v 1.2 1995/09/29 17:41:08 wfp5p Exp $";
3 
4 /*******************************************************************************
5  *  The Elm Mail System  -  $Revision: 1.2 $   $State: Exp $
6  *
7  *                      Copyright (c) 1988-1995 USENET Community Trust
8  *			Copyright (c) 1986,1987 Dave Taylor
9  *******************************************************************************
10  * Bug reports, patches, comments, suggestions should be sent to:
11  *
12  *      Bill Pemberton, Elm Coordinator
13  *      flash@virginia.edu
14  *
15  *******************************************************************************
16  * $Log: errno.c,v $
17  * Revision 1.2  1995/09/29  17:41:08  wfp5p
18  * Alpha 8 (Chip's big changes)
19  *
20  * Revision 1.1.1.1  1995/04/19  20:38:32  wfp5p
21  * Initial import of elm 2.4 PL0 as base for elm 2.5.
22  *
23  ******************************************************************************/
24 
25 /** This routine maps error numbers to error names and error messages.
26     These are all directly ripped out of the include file errno.h, and
27     are HOPEFULLY standardized across the different breeds of Unix!!
28 
29     If (alas) yours are different, you should be able to use awk to
30     mangle your errno.h file quite simply...
31 
32 **/
33 
34 #include "elm_defs.h"
35 
36 #ifndef STRERROR
37 
38 #ifdef ERRLST
39 extern char *sys_errlist[];
40 extern int sys_nerr;
41 #else
42 static char *sys_errlist[] = {
43 /*  0 - NOERROR	*/ "No error status currently",
44 /*  1 - EPERM	*/ "Not super-user",
45 /*  2 - ENOENT	*/ "No such file or directory",
46 /*  3 - ESRCH	*/ "No such process",
47 /*  4 - EINTR	*/ "Interrupted system call",
48 /*  5 - EIO	*/ "I/O error",
49 /*  6 - ENXIO	*/ "No such device or address",
50 /*  7 - E2BIG	*/ "Arg list too long",
51 /*  8 - ENOEXEC	*/ "Exec format error",
52 /*  9 - EBADF	*/ "Bad file number",
53 /* 10 - ECHILD	*/ "No children",
54 /* 11 - EAGAIN	*/ "No more processes",
55 /* 12 - ENOMEM	*/ "Not enough core",
56 /* 13 - EACCES	*/ "Permission denied",
57 /* 14 - EFAULT	*/ "Bad address",
58 /* 15 - ENOTBLK	*/ "Block device required",
59 /* 16 - EBUSY	*/ "Mount device busy",
60 /* 17 - EEXIST	*/ "File exists",
61 /* 18 - EXDEV	*/ "Cross-device link",
62 /* 19 - ENODEV	*/ "No such device",
63 /* 20 - ENOTDIR	*/ "Not a directory",
64 /* 21 - EISDIR	*/ "Is a directory",
65 /* 22 - EINVAL	*/ "Invalid argument",
66 /* 23 - ENFILE	*/ "File table overflow",
67 /* 24 - EMFILE	*/ "Too many open files",
68 /* 25 - ENOTTY	*/ "Not a typewriter",
69 /* 26 - ETXTBSY	*/ "Text file busy",
70 /* 27 - EFBIG	*/ "File too large",
71 /* 28 - ENOSPC	*/ "No space left on device",
72 /* 29 - ESPIPE	*/ "Illegal seek",
73 /* 30 - EROFS	*/ "Read only file system",
74 /* 31 - EMLINK	*/ "Too many links",
75 /* 32 - EPIPE	*/ "Broken pipe",
76 /* 33 - EDOM	*/ "Math arg out of domain of func",
77 /* 34 - ERANGE	*/ "Math result not representable",
78 /* 35 - ENOMSG	*/ "No message of desired type",
79 /* 36 - EIDRM	*/ "Identifier removed"
80 	};
81 static int sys_nerr = 37;
82 #endif /* ERRLST */
83 
84 #ifdef strerror
85 # undef strerror
86 #endif
87 
strerror(errnumber)88 char *strerror(errnumber)
89 int errnumber;
90 {
91 	static char buffer[50];
92 	if (errnumber < 0 || errnumber >= sys_nerr)  {
93 	  sprintf(buffer,"ERR-UNKNOWN (%d)", errnumber);
94 	  return(buffer);
95 	}
96 	return( sys_errlist[errnumber] );
97 }
98 
99 #endif /* !STRERROR */
100