home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / crt / src / syserr.c < prev    next >
C/C++ Source or Header  |  1998-06-17  |  5KB  |  126 lines

  1. /***
  2. *syserr.c - system error list
  3. *
  4. *       Copyright (c) 1987-1997, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. *       Defines the System Error List, containing the full messages for
  8. *       all errno values set by the library routines.
  9. *       Defines sys_errlist, sys_nerr.
  10. *
  11. *******************************************************************************/
  12.  
  13. #include <cruntime.h>
  14. #include <stdlib.h>
  15.  
  16. #ifdef _WIN32
  17.  
  18. char *_sys_errlist[] =
  19. {
  20.     /*  0              */  "No error",
  21.     /*  1 EPERM        */  "Operation not permitted",
  22.     /*  2 ENOENT       */  "No such file or directory",
  23.     /*  3 ESRCH        */  "No such process",
  24.     /*  4 EINTR        */  "Interrupted function call",
  25.     /*  5 EIO          */  "Input/output error",
  26.     /*  6 ENXIO        */  "No such device or address",
  27.     /*  7 E2BIG        */  "Arg list too long",
  28.     /*  8 ENOEXEC      */  "Exec format error",
  29.     /*  9 EBADF        */  "Bad file descriptor",
  30.     /* 10 ECHILD       */  "No child processes",
  31.     /* 11 EAGAIN       */  "Resource temporarily unavailable",
  32.     /* 12 ENOMEM       */  "Not enough space",
  33.     /* 13 EACCES       */  "Permission denied",
  34.     /* 14 EFAULT       */  "Bad address",
  35.     /* 15 ENOTBLK      */  "Unknown error",                     /* not POSIX */
  36.     /* 16 EBUSY        */  "Resource device",
  37.     /* 17 EEXIST       */  "File exists",
  38.     /* 18 EXDEV        */  "Improper link",
  39.     /* 19 ENODEV       */  "No such device",
  40.     /* 20 ENOTDIR      */  "Not a directory",
  41.     /* 21 EISDIR       */  "Is a directory",
  42.     /* 22 EINVAL       */  "Invalid argument",
  43.     /* 23 ENFILE       */  "Too many open files in system",
  44.     /* 24 EMFILE       */  "Too many open files",
  45.     /* 25 ENOTTY       */  "Inappropriate I/O control operation",
  46.     /* 26 ETXTBSY      */  "Unknown error",                     /* not POSIX */
  47.     /* 27 EFBIG        */  "File too large",
  48.     /* 28 ENOSPC       */  "No space left on device",
  49.     /* 29 ESPIPE       */  "Invalid seek",
  50.     /* 30 EROFS        */  "Read-only file system",
  51.     /* 31 EMLINK       */  "Too many links",
  52.     /* 32 EPIPE        */  "Broken pipe",
  53.     /* 33 EDOM         */  "Domain error",
  54.     /* 34 ERANGE       */  "Result too large",
  55.     /* 35 EUCLEAN      */  "Unknown error",                     /* not POSIX */
  56.     /* 36 EDEADLK      */  "Resource deadlock avoided",
  57.     /* 37 UNKNOWN      */  "Unknown error",
  58.     /* 38 ENAMETOOLONG */  "Filename too long",
  59.     /* 39 ENOLCK       */  "No locks available",
  60.     /* 40 ENOSYS       */  "Function not implemented",
  61.     /* 41 ENOTEMPTY    */  "Directory not empty",
  62.     /* 42 EILSEQ       */  "Illegal byte sequence",
  63.     /* 43              */  "Unknown error"
  64.  
  65. };
  66.  
  67. #elif defined (_MAC)
  68.  
  69. char *_sys_errlist[] =
  70. {
  71.     /*  0 EZERO     */  "No Error",
  72.     /*  1 EPERM     */  "Not owner",
  73.     /*  2 ENOENT    */  "No such file or directory",
  74.     /*  3 ESRCH     */  "No such process",
  75.     /*  4 EINTR     */  "Interrupted system call",
  76.     /*  5 EIO       */  "I/O error",
  77.     /*  6 ENXIO     */  "No such device or address",
  78.     /*  7 E2BIG     */  "Arg list too long",
  79.     /*  8 ENOEXEC   */  "Exec format error",
  80.     /*  9 EBADF     */  "Bad file number",
  81.     /* 10 ECHILD    */  "No children", /* uniforum differs */
  82.     /* 11 EAGAIN    */  "No more processes",
  83.     /* 12 ENOMEM    */  "Not enough memory", /* uniforum differs */
  84.     /* 13 EACCES    */  "Permission denied",
  85.     /* 14 EFAULT    */  "Bad address",
  86.     /* 15 ENOTBLK   */  "Block device required",
  87.     /* 16 EBUSY     */  "Mount device or directory busy", /* uniforum differs */
  88.     /* 17 EEXIST    */  "File exists",
  89.     /* 18 EXDEV     */  "Cross-device link",
  90.     /* 19 ENODEV    */  "No such device",
  91.     /* 20 ENOTDIR   */  "Not a directory",
  92.     /* 21 EISDIR    */  "Is a directory",
  93.     /* 22 EINVAL    */  "Invalid argument",
  94.     /* 23 ENFILE    */  "File table overflow",
  95.     /* 24 EMFILE    */  "Too many open files",
  96.     /* 25 ENOTTY    */  "Not a typewriter", /* uniforum differs */
  97.     /* 26 ETXTBSY   */  "Text file busy",
  98.     /* 27 EFBIG     */  "File too large",
  99.     /* 28 ENOSPC    */  "No space left on device",
  100.     /* 29 ESPIPE    */  "Illegal seek",
  101.     /* 30 EROFS     */  "Read-only file system",
  102.     /* 31 EMLINK    */  "Too many links",
  103.     /* 32 EPIPE     */  "Broken pipe",
  104.     /* 33 EDOM      */  "Math argument",
  105.     /* 34 ERANGE    */  "Result too large",
  106.     /* 35 EUCLEAN   */  "File system not clean",
  107.     /* 36 EDEADLOCK */  "Resource deadlock would occur", /* uniforum differs */
  108.     /* 37 UNKNOWN   */  "Unknown error"
  109. };
  110.  
  111. #else  /* defined (_MAC) */
  112.  
  113. #error ERROR - ONLY WIN32 OR MAC TARGET SUPPORTED!
  114.  
  115. #endif  /* defined (_MAC) */
  116.  
  117. int _sys_nerr = sizeof( _sys_errlist ) / sizeof( _sys_errlist[ 0 ] ) - 1;
  118.  
  119. /* The above array contains all the errors including unknown error # 37
  120.    which is used if msg_num is unknown */
  121.  
  122.  
  123. /* ***NOTE: Parameter _SYS_MSGMAX (in file syserr.h) indicates the length of
  124.    the longest systerm error message in the above table.  When you add or
  125.    modify a message, you must update the value _SYS_MSGMAX, if appropriate. */
  126.