home *** CD-ROM | disk | FTP | other *** search
/ Internet MPEG Audio Archive / IMAA.mdf / util / dos / l3v100n / rsx / source / doserrno.c < prev    next >
C/C++ Source or Header  |  1994-01-19  |  7KB  |  159 lines

  1. #include "DOSERRNO.H"
  2.  
  3. #define N_DOS_ERRORS 0x5A
  4.  
  5. #define EMX_RESERVED        EMX_EIO
  6.  
  7. static unsigned char dos_errors[N_DOS_ERRORS + 1] =
  8. {
  9. 0,            /* 0x00  no error                                 */
  10. EMX_EINVAL,        /* 0x01  function number invalid                 */
  11. EMX_ENOENT,        /* 0x02  file not found                          */
  12. EMX_ENOENT,        /* 0x03  path not found                          */
  13. EMX_EMFILE,        /* 0x04  too many open files                         */
  14. EMX_EACCES,        /* 0x05  access denied                             */
  15. EMX_EBADF,        /* 0x06  invalid handle                          */
  16. EMX_EIO,        /* 0x07  memory control block destroyed          */
  17. EMX_ENOMEM,        /* 0x08  insufficient memory                         */
  18. EMX_EIO,        /* 0x09  memory block address invalid                 */
  19. EMX_EINVAL,        /* 0x0A  environment invalid                         */
  20. EMX_ENOEXEC,        /* 0x0B  format invalid                          */
  21. EMX_EINVAL,        /* 0x0C  access code invalid                         */
  22. EMX_EINVAL,        /* 0x0D  data invalid                                 */
  23. EMX_RESERVED,        /* 0x0E  reserved                                 */
  24. EMX_EACCES,        /* 0x0F  invalid drive                             */
  25. EMX_EACCES,        /* 0x10  attempted to remove current directory     */
  26. EMX_EXDEV,        /* 0x11  not same device                         */
  27. EMX_ENOENT,        /* 0x12  no more files                             */
  28. EMX_EIO,        /* 0x13  disk write-protected                         */
  29. EMX_EIO,        /* 0x14  unknown unit                                 */
  30. EMX_EIO,        /* 0x15  drive not ready                         */
  31. EMX_EIO,        /* 0x16  unknown command                         */
  32. EMX_EIO,        /* 0x17  data error                                 */
  33. EMX_EIO,        /* 0x18  bad request structure length                 */
  34. EMX_EIO,        /* 0x19  seek error                                 */
  35. EMX_EIO,        /* 0x1A  unknown media type                         */
  36. EMX_EIO,        /* 0x1B  sector not found                         */
  37. EMX_ENOSPC,        /* 0x1C  printer out of paper                         */
  38. EMX_EIO,        /* 0x1D  write fault                                 */
  39. EMX_EIO,        /* 0x1E  read fault                                 */
  40. EMX_EIO,        /* 0x1F  general failure                         */
  41. EMX_EACCES,        /* 0x20  sharing violation                         */
  42. EMX_EACCES,        /* 0x21  lock violation                          */
  43. EMX_EIO,        /* 0x22  disk change invalid                         */
  44. EMX_EIO,        /* 0x23  FCB unavailable                         */
  45. EMX_EIO,        /* 0x24  sharing buffer overflow                 */
  46. EMX_EIO,        /* 0x25  code page mismatch                         */
  47. EMX_EIO,        /* 0x26  cannot complete file operation          */
  48. EMX_ENOSPC,        /* 0x27  insufficient disk space                 */
  49. EMX_RESERVED,        /* 0x28  reserved                                 */
  50. EMX_RESERVED,        /* 0x29  reserved                                 */
  51. EMX_RESERVED,        /* 0x2A  reserved                                 */
  52. EMX_RESERVED,        /* 0x2B  reserved                                 */
  53. EMX_RESERVED,        /* 0x2C  reserved                                 */
  54. EMX_RESERVED,        /* 0x2D  reserved                                 */
  55. EMX_RESERVED,        /* 0x2E  reserved                                 */
  56. EMX_RESERVED,        /* 0x2F  reserved                                 */
  57. EMX_RESERVED,        /* 0x30  reserved                                 */
  58. EMX_RESERVED,        /* 0x31  reserved                                 */
  59. EMX_EIO,        /* 0x32  network request not supported             */
  60. EMX_EIO,        /* 0x33  remote computer not listening             */
  61. EMX_EIO,        /* 0x34  duplicate name on network                 */
  62. EMX_EIO,        /* 0x35  network name not found                  */
  63. EMX_EIO,        /* 0x36  network busy                                 */
  64. EMX_EIO,        /* 0x37  network device no longer exists         */
  65. EMX_EIO,        /* 0x38  network BIOS command limit exceeded         */
  66. EMX_EIO,        /* 0x39  network adapter hardware error          */
  67. EMX_EIO,        /* 0x3A  incorrect response from network         */
  68. EMX_EIO,        /* 0x3B  unexpected network error                 */
  69. EMX_EIO,        /* 0x3C  incompatible remote adapter                 */
  70. EMX_ENOSPC,        /* 0x3D  print queue full                         */
  71. EMX_ENOSPC,        /* 0x3E  queue not full                          */
  72. EMX_EIO,        /* 0x3F  not enough space to print file          */
  73. EMX_EIO,        /* 0x40  network name was deleted                 */
  74. EMX_EACCES,        /* 0x41  network: Access denied                  */
  75. EMX_EIO,        /* 0x42  network device type incorrect             */
  76. EMX_EIO,        /* 0x43  network name not found                  */
  77. EMX_EIO,        /* 0x44  network name limit exceeded                 */
  78. EMX_EIO,        /* 0x45  network BIOS session limit exceeded         */
  79. EMX_EIO,        /* 0x46  temporarily paused                         */
  80. EMX_EIO,        /* 0x47  network request not accepted                 */
  81. EMX_EIO,        /* 0x48  network print/disk redirection paused     */
  82. EMX_EACCES,        /* 0x49  invalid network version                 */
  83. EMX_EIO,        /* 0x4A  account expired                         */
  84. EMX_EIO,        /* 0x4B  password expired                         */
  85. EMX_EIO,        /* 0x4C  login attempt invalid at this time         */
  86. EMX_EIO,        /* 0x4D  disk limit exceeded on network node         */
  87. EMX_EIO,        /* 0x4E  not logged in to network node             */
  88. EMX_RESERVED,        /* 0x4F  reserved                                 */
  89. EMX_EEXIST,        /* 0x50  file exists                                 */
  90. EMX_RESERVED,        /* 0x51  reserved                                 */
  91. EMX_ENOENT,        /* 0x52  cannot make directory                     */
  92. EMX_EIO,        /* 0x53  fail on INT 24h                         */
  93. EMX_EIO,        /* 0x54  too many redirections                     */
  94. EMX_EIO,        /* 0x55  duplicate redirection                     */
  95. EMX_EIO,        /* 0x56  invalid password                         */
  96. EMX_EINVAL,        /* 0x57  invalid parameter                         */
  97. EMX_EIO,        /* 0x58  network write fault                         */
  98. EMX_EIO,        /* 0x59  function not supported on network         */
  99. EMX_EIO         /* 0x5A  required system component not installed */
  100. };
  101.  
  102. static unsigned char emx2djgpp[] =
  103. {
  104.       0,
  105.       5,      /* 1  EPERM     Operation not permitted          */
  106.       2,      /* 2  ENOENT     No such file or directory          */
  107.      19,      /* 3  ESRCH     No such process              */
  108.     100,      /* 4  EINTR     Interrupted system call          */
  109.     101,      /* 5  EIO      I/O error                  */
  110.     101,
  111.      10,      /* 7  E2BIG     Arguments or environment too big     */
  112.      21,      /* 8  ENOEXEC     Invalid executable file format       */
  113.       6,      /* 9  EBADF     Bad file number              */
  114.     200,      /* 10 ECHILD     No child processes              */
  115.     103,      /* 11 EAGAIN     No more processes              */
  116.       8,      /* 12 ENOMEM     Not enough memory              */
  117.       5,      /* 13 EACCES     Permission denied              */
  118.     101,
  119.     101,
  120.     101,
  121.      36,      /* 17 EEXIST     File exists                  */
  122.      17,      /* 18 EXDEV     Cross-device link              */
  123.     101,
  124.       3,      /* 20 ENOTDIR     Not a directory              */
  125.      19,      /* 21 EISDIR     Is a directory               */
  126.      19,      /* 22 EINVAL     Invalid argument              */
  127.     101,
  128.       4,      /* 24 EMFILE     Too many open files              */
  129.     101,
  130.     101,
  131.     101,
  132.     102,      /* 28 ENOSPC     Disk full                  */
  133.      19,      /* 29 ESPIPE     Illegal seek                  */
  134.       5,      /* 30 EROFS     Read-only file system              */
  135.     101,
  136.      32,      /* 32 EPIPE     Broken pipe                  */
  137.      33,      /* 33 EDOM     Domain error                  */
  138.      34,      /* 34 ERANGE     Result too large              */
  139.     101,
  140.     101,
  141.       5,      /* 37 EMSDOS     Not supported under MS-DOS          */
  142.      19       /* 38 ENAMETOOLONG File name too long              */
  143. } ;
  144.  
  145. unsigned int doserror_to_errno(int error_dos)
  146. {
  147.     if (error_dos >= N_DOS_ERRORS)
  148.     return EMX_EIO;
  149.     else
  150.     return (unsigned) dos_errors[error_dos];
  151. }
  152.  
  153. unsigned int errno_djgpp(int emx_errno)
  154. {
  155.     if (emx_errno > 38)
  156.     emx_errno = EMX_EIO;
  157.     return (unsigned) emx2djgpp[emx_errno];
  158. }
  159.