platform/os2.c
changeset 599 44af228dd59a
parent 596 381b6ca0dd85
child 657 dad3b5c307a9
child 1021 7facbc5f4192
equal deleted inserted replaced
598:c3f267dbbbb6 599:44af228dd59a
    21 #define INCL_DOSDEVICES
    21 #define INCL_DOSDEVICES
    22 #define INCL_DOSDEVIOCTL
    22 #define INCL_DOSDEVIOCTL
    23 #define INCL_DOSMISC
    23 #define INCL_DOSMISC
    24 #include <os2.h>
    24 #include <os2.h>
    25 
    25 
       
    26 #include <stdio.h>
    26 #include <stdlib.h>
    27 #include <stdlib.h>
    27 #include <errno.h>
    28 #include <errno.h>
    28 #include <string.h>
    29 #include <string.h>
    29 #include <time.h>
    30 #include <time.h>
    30 #include <ctype.h>
    31 #include <ctype.h>
    59         case ERROR_TOO_MANY_HANDLES: return(ERR_TOO_MANY_HANDLES);
    60         case ERROR_TOO_MANY_HANDLES: return(ERR_TOO_MANY_HANDLES);
    60         case ERROR_TOO_MANY_OPEN_FILES: return(ERR_TOO_MANY_HANDLES);
    61         case ERROR_TOO_MANY_OPEN_FILES: return(ERR_TOO_MANY_HANDLES);
    61         case ERROR_NO_MORE_SEARCH_HANDLES: return(ERR_TOO_MANY_HANDLES);
    62         case ERROR_NO_MORE_SEARCH_HANDLES: return(ERR_TOO_MANY_HANDLES);
    62         case ERROR_SEEK_ON_DEVICE: return(ERR_SEEK_ERROR);
    63         case ERROR_SEEK_ON_DEVICE: return(ERR_SEEK_ERROR);
    63         case ERROR_NEGATIVE_SEEK: return(ERR_SEEK_OUT_OF_RANGE);
    64         case ERROR_NEGATIVE_SEEK: return(ERR_SEEK_OUT_OF_RANGE);
    64         case ERROR_DEL_CURRENT_DIRECTORY: return(ERR_DEL_CWD);
    65         /*!!! FIXME: Where did this go?  case ERROR_DEL_CURRENT_DIRECTORY: return(ERR_DEL_CWD);*/
    65         case ERROR_WRITE_PROTECT: return(ERR_WRITE_PROTECT_ERROR);
    66         case ERROR_WRITE_PROTECT: return(ERR_WRITE_PROTECT_ERROR);
    66         case ERROR_WRITE_FAULT: return(ERR_WRITE_FAULT);
    67         case ERROR_WRITE_FAULT: return(ERR_WRITE_FAULT);
    67         case ERROR_LOCK_VIOLATION: return(ERR_LOCK_VIOLATION);
    68         case ERROR_LOCK_VIOLATION: return(ERR_LOCK_VIOLATION);
    68         case ERROR_GEN_FAILURE: return(ERR_GENERAL_FAILURE);
    69         case ERROR_GEN_FAILURE: return(ERR_GEN_FAILURE);
    69         case ERROR_UNCERTAIN_MEDIA: return(ERR_UNCERTAIN_MEDIA);
    70         case ERROR_UNCERTAIN_MEDIA: return(ERR_UNCERTAIN_MEDIA);
    70         case ERROR_PROTECTION_VIOLATION: return(ERR_PROT_VIOLATION);
    71         case ERROR_PROTECTION_VIOLATION: return(ERR_PROT_VIOLATION);
    71         case ERROR_BROKEN_PIPE: return(ERR_BROKEN_PIPE);
    72         case ERROR_BROKEN_PIPE: return(ERR_BROKEN_PIPE);
    72 
    73 
    73         case ERROR_INVALID_PARAMETER:
    74         case ERROR_INVALID_PARAMETER:
    96 {
    97 {
    97     char buf[128];
    98     char buf[128];
    98     const char *err = get_os2_error_string(retval);
    99     const char *err = get_os2_error_string(retval);
    99     if (err == ERR_OS2_GENERIC)
   100     if (err == ERR_OS2_GENERIC)
   100     {
   101     {
   101         snprintf(buf, ERR_OS2_GENERIC, (int) retval);
   102         snprintf(buf, sizeof (buf), ERR_OS2_GENERIC, (int) retval);
   102         err = buf;
   103         err = buf;
   103     } /* if */
   104     } /* if */
   104 
   105 
   105     if (err != NULL)
   106     if (err != NULL)
   106         __PHYSFS_setError(err);
   107         __PHYSFS_setError(err);
   107 
   108 
   108     return(err);
   109     return(retval);
   109 } /* os2err */
   110 } /* os2err */
   110 
   111 
   111 
   112 
   112 /* (be gentle, this function isn't very robust.) */
   113 /* (be gentle, this function isn't very robust.) */
   113 static void cvt_path_to_correct_case(char *buf)
   114 static void cvt_path_to_correct_case(char *buf)