home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / perl560.zip / mint / errno.h next >
C/C++ Source or Header  |  1999-07-20  |  997b  |  33 lines

  1. /* Wrapper around broken system errno.h.  */
  2.  
  3. #ifndef _PERL_WRAPPER_AROUND_ERRNO_H
  4. # define _PERL_WRAPPER_AROUND_ERRNO_H 1
  5.  
  6. /* First include the system file.  */
  7. #include_next <errno.h> 
  8.  
  9. /* Now add the missing stuff.
  10. #ifndef EAGAIN
  11. # define EAGAIN EWOULDBLOCK
  12. #endif
  13.  
  14. /* This one is problematic.  If you open() a directory with the
  15.    MiNTLib you can't detect from errno if it is really a directory
  16.    or if the file simply doesn't exist.  You'll get ENOENT 
  17.    ("file not found") in either case.
  18.    
  19.    Defining EISDIR as ENOENT is actually a bad idea but works fine
  20.    in general.  In praxi, if code checks for errno == EISDIR it
  21.    will attempt an opendir() call on the file in question and this
  22.    call will also file if the file really can't be found.  But
  23.    you may get compile-time errors if the errno checking is embedded
  24.    in a switch statement ("duplicate case value in switch").
  25.    
  26.    Anyway, here the define works alright.  */
  27. #ifndef EISDIR
  28. # define EISDIR ENOENT
  29. #endif
  30.  
  31. #endif
  32.  
  33.