home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 200-299 / ff236.lzh / DiskHandler / file.c < prev    next >
C/C++ Source or Header  |  1989-08-09  |  3KB  |  93 lines

  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  2. /* |_o_o|\\ Copyright (c) 1987 The Software Distillery.  All Rights Reserved */
  3. /* |. o.| || This program may not be distributed without the permission of   */
  4. /* | .  | || the authors:                                          BBS:      */
  5. /* | o  | ||   John Toebes     Dave Baker     John Mainwaring                */
  6. /* |  . |//                                                                  */
  7. /* ======                                                                    */
  8. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  9. /* File Manipulation  */
  10. /*  ActDelete ActRename ActSetProtection ActSetComment */
  11. #include "handler.h"
  12.  
  13. void ActDelete(global, pkt)
  14. GLOBAL global;
  15. struct DosPacket *pkt;              /* a pointer to the dos packet sent       */
  16. /* Arg1: Lock    */
  17. /* Arg2: Name    */
  18. {
  19.    KEY key;
  20.  
  21.    BUG(("ActDelete\n"));
  22.  
  23.    key = GetKey(global,(struct FileLock *)pkt->dp_Arg1);
  24.  
  25.    if (key == 0)
  26.       pkt->dp_Res1 = DOS_FALSE;
  27.    else
  28.       pkt->dp_Res1 = DeleteEntry(global, key, (char *)pkt->dp_Arg2);
  29. }
  30.  
  31. void ActRename(global,pkt)
  32. GLOBAL global;
  33. struct DosPacket *pkt;              /* a pointer to the dos packet sent    */
  34. /* Arg1: FromLock    */
  35. /* Arg2: FromName    */
  36. /* Arg3: ToLock        */
  37. /* Arg4: ToName        */
  38. {
  39. KEY fromkey, tokey;
  40.  
  41.    BUG(("ActRename\n"));
  42.  
  43.    fromkey = GetKey(global,(struct FileLock *)pkt->dp_Arg1);
  44.    tokey = GetKey(global,(struct FileLock *)pkt->dp_Arg3);
  45.  
  46.    if (pkt->dp_Res1 = (fromkey && tokey))  /* set FALSE ret if appropriate */
  47.       pkt->dp_Res1 = RenameEntry
  48.          (global, fromkey, tokey, (char *)pkt->dp_Arg2, (char *)pkt->dp_Arg4);
  49. }
  50.  
  51. void ActSetProtection(global, pkt)
  52. GLOBAL global;
  53. struct DosPacket *pkt;              /* a pointer to the dos packet sent */
  54. /* Arg1: Unused */
  55. /* Arg2: Lock */
  56. /* Arg3: Name */
  57. /* Arg4: Mask of protection */
  58. {
  59.    KEY key;
  60.  
  61.    BUG(("ActSetProtection\n"));
  62.  
  63.    BUGBSTR("File to lock: ", pkt->dp_Arg3);
  64.  
  65.    key = GetKey(global,(struct FileLock *)pkt->dp_Arg2);
  66.  
  67.    key = LocateEntry(global, key, (char *)pkt->dp_Arg3);
  68.  
  69.    pkt->dp_Res1 = SetProtect(global, key, pkt->dp_Arg4);
  70. }
  71.  
  72. void ActSetComment(global,pkt)
  73. GLOBAL global;
  74. struct DosPacket *pkt;              /* a pointer to the dos packet sent       */
  75. /* Arg1: Unused */
  76. /* Arg2: Lock */
  77. /* Arg3: Name */
  78. /* Arg4: Comment */
  79. {
  80.    long key;
  81.  
  82.    BUG(("ActSetComment\n"));
  83.  
  84.    BUGBSTR("File to Comment: ", pkt->dp_Arg3);
  85.    BUGBSTR("New Comment Str: ", pkt->dp_Arg4);
  86.  
  87.    key = GetKey(global,(struct FileLock *)pkt->dp_Arg2);
  88.  
  89.    key = LocateEntry(global, key, (char *)pkt->dp_Arg3);
  90.  
  91.    pkt->dp_Res1 = SetCommentStr(global, key, (char *)pkt->dp_Arg4);
  92. }
  93.