home *** CD-ROM | disk | FTP | other *** search
/ ftp.uv.es / 2014.11.ftp.uv.es.tar / ftp.uv.es / pub / unix / elm-2.4-pl20.tar.Z / elm-2.4-pl20.tar / lib / errno.c < prev    next >
C/C++ Source or Header  |  1992-10-03  |  3KB  |  92 lines

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