home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / LIBSRC.ZOO / libsrc / local / rmdir.c < prev    next >
Text File  |  1992-02-21  |  796b  |  47 lines

  1. #define INCL_DOSFILEMGR
  2. #define INCL_DOSERRORS
  3. #include <os2.h>
  4. #include <errno.h>
  5.  
  6. ULONG Dos32DeleteDir() asm ("Dos32DeleteDir");
  7.  
  8. int rmdir (const char *path)
  9. {
  10.    ULONG rc;
  11.  
  12.    rc = Dos32DeleteDir ((PSZ)path, 0);
  13.  
  14.    if (rc)
  15.    {
  16.       if (rc == ERROR_PATH_NOT_FOUND || rc == ERROR_FILE_NOT_FOUND)
  17.       {
  18.          errno = ENOTDIR;
  19.          return (-1);
  20.       }
  21.  
  22.       if (rc == ERROR_ACCESS_DENIED)
  23.       {
  24.          errno = EACCES;
  25.          return (-1);
  26.       }
  27.  
  28.       if (rc == ERROR_INVALID_PARAMETER)
  29.       {
  30.          errno = EINVAL;
  31.          return (-1);
  32.       }
  33.  
  34.       if (rc == ERROR_FILENAME_EXCED_RANGE)
  35.       {
  36.          errno = ENAMETOOLONG;
  37.          return (-1);
  38.       }
  39.  
  40.       errno = EIO;
  41.       return (-1);
  42.    }
  43.  
  44.     return (0);
  45. }
  46.  
  47.