/*static char *SCCSID = "@(#)fs_rmdir.c	6.2 92/01/31";*/
#define _BTXT _BTXT
#define INCL_DOSERRORS
#include <os2def.h>
#include <bse.h>
#include <fsh.h>
#include "heap.h"
#include "api.h"
#include "const.h"
#include "misc.h"
#include "chain.h"
#include "buf.h"
#include "dir.h"
#include "storage.h"
#include "volume.h"
#include "tables.h"
#include "pb_ifs.h"
#include "pbmacros.h"
#include "superb.h"
#include "lw.h"
#include "frame.h"
#include "fsdata.h"
#include "shutdown.h"
#include "pr_fsd.h"
#include "pr_CACHE.h"
#include "pr_DEL.h"
#include "pr_HEAP.h"
#include "pr_WRSUB.h"
#include "pr_DEBUG.h"

/*
 *	HISTORY
 *	    02-Jun-1989 by JR (John Rogers, JohnRo@Microsoft)
 *		- DCR 259.2: added counting of write threads for shutdown.
 *		- DCR 259.2: changed names of macros in "frame.h".
 *		- Changed from including os2.h to os2def.h and bse.h, per
 *		  request from JonPa (Jon Parati).
 */

int far pascal
FS_RMDIR (pcdfsi, pcdfsd, pName, iCurDirEnd)
struct cdfsi far *	pcdfsi;
struct cdfsd far *	pcdfsd;
char far *		pName;
unsigned short		iCurDirEnd;
{
	PCRACKEDPATH pcp;
	SHUTDOWN_LOCAL_VARS;
	USHORT usRet;
	FRAME  frm;

	frm.usHardErr = NO_ERROR;
	frm.fRecheckAddr = TRUE;

	INCR_WRITE_THREADS;		/* Tell shutdown we're writing. */

	/*  Allocate space for the pinball cracked path name,
	 *  and convert the parameter name to pinball's format.
	 *
	 */
	if ((usRet = CrackPath(pcdfsi->cdi_hVPB,pName,&pcp,&frm)) == NO_ERROR) {
	    usRet = RmDir (pcp,&frm);
	}

	if (pcp != NULL)
	    RetHeap (pcp);

#ifdef DEBUG
	VBS ();
#endif

	DECR_WRITE_THREADS;		/* Tell shutdown we're done. */

	return (usRet);

	/* to prevent /W3 warnings */
	pcdfsd; iCurDirEnd;
}
