errno, _doserrno, sys_errlist, sys_nerr
Enable perror to print error messages.
Defined in header <errno.h>
Syntax
extern int errno;
extern int _doserrno;
extern char * sys_errlist[ ];
extern int sys_nerr;
Remarks
errno, sys_errlist, and sysjnerr are used by perror to print error messages when certain Hbrary routines fail to accomplish their appointed tasks. jioserrno is a variable that maps many DOS error codes to errno; however, perror does not use jioserrno directly.
jioserrno: When a DOS system call results in an error, jioserrno is set to the actual DOS error code, errno is a parallel error variable inherited from UNIX.
errno: When an error in a math or system call occurs, errno is set to indicate the type of error. Sometimes errno and _doserrno are equivalent. At other times, errno does not contain the actual DOS error code, which is contained in jioserrno. Still other errors might occur that set only errno, not jioserrno.
sys_errlist: To provide more control over message formatting, the array of message strings is provided in sys_errlist. You can use errno as an index into the array to find the string corresponding to the error number. The string does not include any newline character.
sysjierr: This variable is defined as the number of error message strings in sys_errlist.
The following table gives mnemonics and their meanings for the values stored in sys_errlist.
| Mnemonic | Meaning |
| E2BIG | Arg list too long |
| EACCES | Permission denied |
| EBADF | Bad file number |
| ECONTR | Memory blocks destroyed |
| ECURDIR | Attempt to remove CurDir |
| EDOM | Domain error |
| EEXIST | File already exists |
| EFAULT | Unknown error |
| EINVACC | Invalid access code |
| EINVAL | Invalid argument |
| EINVDAT | Invalid data |
| EINVDRV | Invalid drive specified |
| EINVENV | Invalid environment |
| EINVFMT | Invalid format |
| EINVFNC | Invalid function number |
| EINVMEM | Invalid memory block address |
| EMFILE | Too many open files |
| ENMFILE | No more files |
| ENODEV | No such device |
| ENOENT | No such file or directory |
| ENOEXEC | Exec format error |
| ENOFILE | No such file or directory |
| ENOMEM | Not enough memory |
| ENOPATH | Path not found |
| ENOTSAM | Not same device |
| ERANGE | Result out of range |
| EXDEV | Cross-device link |
| EZERO | Error 0 |
The follow^ing list gives mnemonics for the actual DOS error codes to w^hich _doserrno can be set. (This value of _doserrno may or may not be mapped (through errno) to an equivalent error message string in si/s_errlist.
| Mnemonic | DOS error code |
| E2BIG | Bad environ |
| EACCES | Access denied |
| EACCES | Bad access |
| EACCES | Is current dir |
| EBADF | Bad handle |
| EFAULT | Reserved |
| EINVAL | Bad data |
| EINVAL | Bad function |
| EMHLE | Too many open |
| ENOENT | No such file or directory |
| ENOEXEC | Bad format |
| ENOMEM | Mcb destroyed |
| ENOMEM | Out of memory |
| ENOMEM | Bad block |
| EXDEV | Bad drive |
| EXDEV | Not same device |
Refer to your DOS reference manual for more information about DOS error return codes.
Example
#include <errno.h>
#include <stdio.h>
extern char *sys_errlist [];
main ()
{
int i = 0;
while (sys_errlist[i++] printf("%s\n", sys_errlist [i]
return 0;
Differences from modern implementations
Nothing recorded yet.
Modern references
These are search links, not yet checked by hand.
Extraction notes
- heading `errno, _closerrno, sys_errlist, sys_nerr` read as `errno, _doserrno, sys_errlist, sys_nerr`
Stable link: /3.1/errno.h/errno/
· short form /3.1/errno/