/*static char *SCCSID = "@(#)fs_dlete.c	6.2 91/01/14";*/
#define SCCSID "@(#)fs_dlete.c	6.2 91/01/14"
/*
 *	IBM/Microsoft Confidential
 *
 *	Copyright (c) IBM Corporation 1987, 1989
 *	Copyright (c) Microsoft Corporation 1987, 1989
 *
 *	All Rights Reserved
 *
 */

/***    FS_DELETE - Delete a file
 *      
 *      Removes a directory entry associated with a filename.
 *
 *
 *  REVISION HISTORY (in reverse chronological order)
 *  --------------------------------------------------------------------------
 *  2/22/90     Brian Andrew    Modified to simulate HPFS/FAT type response
 *                              when the disk would not need to be modified.
 *                              Return CDROM_WRITE_PROTECT otherwise.
 *  9/13/89     Paul Bingman    First CDROM version
 *  8/4/89      Brian Andrew    Initial blank template
 *
 *
 * TO DO
 * --------------------------------------------------------------------------
 *
 */


#define INCL_DOSERRORS
#define INCL_NOPMAPI
#include <os2.h>
#include <fsd.h>

#include "cdfs.h"
#include "sem.h"
#include "path.h"
#include "vol.h"
#include "file.h"
#include "buffer.h"
#include "mem.h"
#include "heap.h"
#include "pr_memin.h"

#ifdef DEBUG
#include "pr_DEBUG.h"
#endif


int far pascal
FS_DELETE (pcdfsi, pcdfsd, pFile, iCurDirEnd)
PCDFSI      pcdfsi;
PCDFSD      pcdfsd;
PCHAR       pFile;
USHORT      iCurDirEnd;
{
	USHORT  usRet;
	USHORT  afAttr;

#ifdef DEBUG
	dprintf ("FS_DELETE(\"%Fs\")\n", pFile);
#endif

	/*
	 *  Look for the file first by calling FS_FILEATTRIBUTE.  Pass any
	 *  error back as the return code.
	 *
	 *  If the file is found it must be a read only file.  The return
	 *  value is ERROR_ACCESS_DENIED.
	 */

	if (! (usRet = FS_FILEATTRIBUTE (
						FA_RETRIEVE,
						pcdfsi,
						pcdfsd,
						pFile,
						iCurDirEnd,
						&afAttr)))
	{
		usRet = ERROR_ACCESS_DENIED;
	}

#ifdef DEBUG
	dprintf ("\tFS_DELETE: Return value -- %d\n", usRet);
#endif

	return usRet;

	/* defeat compiler warnings */

	pcdfsi;
	pcdfsd;
	pFile;
	iCurDirEnd;

}   /* end FS_DELETE */

/* end of fs_dlete.c */
