home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / emacs-19.28-src.tgz / tar.out / fsf / emacs / unixlib / src / error.c < prev    next >
C/C++ Source or Header  |  1996-09-28  |  2KB  |  48 lines

  1. #include "amiga.h"
  2.  
  3. int errno;
  4.  
  5. int convert_oserr(int ioerr)
  6. {
  7.   extern int _OSERR;
  8.  
  9.   _OSERR = ioerr;
  10.   switch (ioerr)
  11.     {
  12.     case 0: return 0;
  13.     case ERROR_NO_FREE_STORE: return ENOMEM;
  14.     case ERROR_TASK_TABLE_FULL: return EAGAIN;
  15.     case ERROR_BAD_TEMPLATE: case ERROR_REQUIRED_ARG_MISSING: case ERROR_BAD_NUMBER:
  16.     case ERROR_KEY_NEEDS_ARG: case ERROR_TOO_MANY_ARGS:
  17.     case ERROR_UNMATCHED_QUOTES: return EINVAL;
  18.     case ERROR_LINE_TOO_LONG: return E2BIG;
  19.     case ERROR_FILE_NOT_OBJECT: return ENOEXEC;
  20.     case ERROR_OBJECT_IN_USE: return EBUSY;
  21.     case ERROR_OBJECT_EXISTS: return EEXIST;
  22.     case ERROR_DIR_NOT_FOUND: return ENOENT;
  23.     case ERROR_OBJECT_NOT_FOUND: return ENOENT;
  24.     case ERROR_BAD_STREAM_NAME: return EINVAL;
  25.     case ERROR_OBJECT_TOO_LARGE: return E2BIG;
  26.     case ERROR_ACTION_NOT_KNOWN: return EINVAL;
  27.     case ERROR_INVALID_COMPONENT_NAME: return ENAMETOOLONG;
  28.     case ERROR_INVALID_LOCK: return EINVAL;
  29.     case ERROR_OBJECT_WRONG_TYPE: return EINVAL;
  30.     case ERROR_DISK_WRITE_PROTECTED: return EROFS;
  31.     case ERROR_RENAME_ACROSS_DEVICES: return EXDEV;
  32.     case ERROR_DIRECTORY_NOT_EMPTY: return ENOTEMPTY;
  33.     case ERROR_TOO_MANY_LEVELS: return ELOOP;
  34.     case ERROR_DEVICE_NOT_MOUNTED: return ENODEV;
  35.     case ERROR_SEEK_ERROR: return EINVAL;
  36.     case ERROR_DISK_FULL: return ENOSPC;
  37.     case ERROR_DELETE_PROTECTED: return EACCES;
  38.     case ERROR_WRITE_PROTECTED: return EACCES;
  39.     case ERROR_READ_PROTECTED: return EACCES;
  40.     default: return EOSERR;
  41.     }
  42. }
  43.  
  44. void _seterr(void)
  45. {
  46.     errno = convert_oserr(IoErr());
  47. }
  48.