/*-----------------------------------------------------------------------*
 * filename - rmdir.cas
 *
 * function(s)
 *        rmdir - removes directory
 *-----------------------------------------------------------------------*/

/*
 *      C/C++ Run Time Library - Version 5.0
 *
 *      Copyright (c) 1987, 1992 by Borland International
 *      All Rights Reserved.
 *
 */


#pragma inline
#include <asmrules.h>
#include <dir.h>
#include <_io.h>

/*-----------------------------------------------------------------------*

Name            rmdir - removes directory

Usage           int rmdir(const char *pathname);

Prototype in    dir.h

Description     deletes the directory given by pathP.  The directory
                named by pathP

                        1) must be empty

                        2) must not be the current working directory

                        3) must not be the root directory

Return value    success : 0
                failure : -1 and errno is set to one of the following:

                        EACCES  Permission denied
                        ENOENT  Path or file name not found

*------------------------------------------------------------------------*/
int rmdir(const char *pathP)
{
        pushDS_
asm     mov     ah, 03Ah
asm     LDS_    dx, pathP
asm     int     021H
        popDS_
asm     jc      rmdirFailed
        return(0);

rmdirFailed:
        return __IOerror(_AX);
}
