/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* |_o_o|\\ Copyright (c) 1987 The Software Distillery.  All Rights Reserved */
/* |. o.| || This program may not be distributed without the permission of   */
/* | .  | || the authors:                                          BBS:      */
/* | o  | ||   John Toebes     Dave Baker     John Mainwaring                */
/* |  . |//                                                                  */
/* ======                                                                    */
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/* File Manipulation  */
/*  ActDelete ActRename ActSetProtection ActSetComment */
#include "handler.h"

void ActDelete(global, pkt)
GLOBAL global;
struct DosPacket *pkt;              /* a pointer to the dos packet sent       */
/* Arg1: Lock	*/
/* Arg2: Name	*/
{
   KEY key;

   BUG(("ActDelete\n"));

   key = GetKey(global,(struct FileLock *)pkt->dp_Arg1);

   if (key == 0)
      pkt->dp_Res1 = DOS_FALSE;
   else
      pkt->dp_Res1 = DeleteEntry(global, key, (char *)pkt->dp_Arg2);
}

void ActRename(global,pkt)
GLOBAL global;
struct DosPacket *pkt;              /* a pointer to the dos packet sent	*/
/* Arg1: FromLock	*/
/* Arg2: FromName	*/
/* Arg3: ToLock		*/
/* Arg4: ToName		*/
{
KEY fromkey, tokey;

   BUG(("ActRename\n"));

   fromkey = GetKey(global,(struct FileLock *)pkt->dp_Arg1);
   tokey = GetKey(global,(struct FileLock *)pkt->dp_Arg3);

   if (pkt->dp_Res1 = (fromkey && tokey))  /* set FALSE ret if appropriate */
      pkt->dp_Res1 = RenameEntry
         (global, fromkey, tokey, (char *)pkt->dp_Arg2, (char *)pkt->dp_Arg4);
}

void ActSetProtection(global, pkt)
GLOBAL global;
struct DosPacket *pkt;              /* a pointer to the dos packet sent */
/* Arg1: Unused */
/* Arg2: Lock */
/* Arg3: Name */
/* Arg4: Mask of protection */
{
   KEY key;

   BUG(("ActSetProtection\n"));

   BUGBSTR("File to lock: ", pkt->dp_Arg3);

   key = GetKey(global,(struct FileLock *)pkt->dp_Arg2);

   key = LocateEntry(global, key, (char *)pkt->dp_Arg3);

   pkt->dp_Res1 = SetProtect(global, key, pkt->dp_Arg4);
}

void ActSetComment(global,pkt)
GLOBAL global;
struct DosPacket *pkt;              /* a pointer to the dos packet sent       */
/* Arg1: Unused */
/* Arg2: Lock */
/* Arg3: Name */
/* Arg4: Comment */
{
   long key;

   BUG(("ActSetComment\n"));

   BUGBSTR("File to Comment: ", pkt->dp_Arg3);
   BUGBSTR("New Comment Str: ", pkt->dp_Arg4);

   key = GetKey(global,(struct FileLock *)pkt->dp_Arg2);

   key = LocateEntry(global, key, (char *)pkt->dp_Arg3);

   pkt->dp_Res1 = SetCommentStr(global, key, (char *)pkt->dp_Arg4);
}
