home *** CD-ROM | disk | FTP | other *** search
/ SPACE 2 / SPACE - Library 2 - Volume 1.iso / program / 316 / libsrc / st-error.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-10-20  |  1.8 KB  |  75 lines

  1.  
  2. /* does this replace some Eunuchs thing?  Who knows, in this kludge of a 
  3.  * language.  In any event, input-scrub.c wants it; nobody else seems to use 
  4.  * it.
  5.  */
  6.  
  7. /* apparently Eunuchs has a similar thing, but their error numbers
  8.    go up from 0.  We'll hack things a bit so as to allow negative offsets
  9.    from sys_errlist to get the right strings here */
  10.  
  11. #include <errno.h>
  12.  
  13. int sys_nerr = -67;            /* min known error number */
  14. int errno = 0;                /* current error num */
  15.  
  16. char * __gubbish = "No error";        /* see below */
  17.  
  18. char * _sys_errlist[] = 
  19.     {
  20.     "System error",            /* min-error minus 1 */
  21.     "Error setting block size",    /* -67 */
  22.     "Not an executable",
  23.     "Internal error",
  24.     "Bad arg",            /* -64 */
  25.     "", "", "", "", "", "", "", "",    /* -63 .. -56 */
  26.     "", "", "", "", "", "",        /* -55 .. -50 */
  27.     "No more files",
  28.     "Cross device rename",
  29.     "",                /* -47 */
  30.     "Invalid drive",
  31.     "", "", "", "", "",
  32.     "Memory fault",
  33.     "Not enough memory",
  34.     "",                /* -38 */
  35.     "Invalid file handle",
  36.     "Access denied",
  37.     "Too many open files",
  38.     "Path not found",
  39.     "File not found",
  40.     "Invalid function number",
  41.     "", "", "", "", "", "", "", "",    /* -31 .. -24 */
  42.     "", "", "", "", "", "",     /* -23 .. -18 */
  43.     "Insert disk",
  44.     "Bad sectors",
  45.     "Unknown device",
  46.     "Media change",
  47.     "Write protected",
  48.     "Random bogons",
  49.     "Read fault",
  50.     "Write fault",
  51.     "Paper out",
  52.     "Sector not found",
  53.     "Unknown media",
  54.     "Seek error",
  55.     "Bad request",
  56.     "CRC error",
  57.     "Unknown command",
  58.     "Drive not ready",
  59.     "Generic bogosity"        /* -1 */
  60.     };
  61. /* this, of course, must follow the above immediately.  We rely
  62.    on GCC optimizing this into a reference to the duplicate string, above */
  63. char * sys_errlist[] = 
  64.     {
  65.     "No error"
  66.     };
  67.  
  68. char * sys_error(num)
  69. int num;
  70. {
  71.   if ((num < sys_nerr) || (num > 0))
  72.     num = 0;
  73.   return(sys_errlist[num]);
  74. }
  75.