home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / lambda / soundpot / p / z33rcp02.lbr / RCPERA.LZB / RCPERA.LIB
Encoding:
Text File  |  1993-10-25  |  1.5 KB  |  63 lines

  1.     page
  2.  
  3. ; RCP-ERA.Z80    'ERA' Command
  4.  
  5. ;=============================================================================
  6. ;
  7. ;        E R A S E    C O M M A N D
  8. ;
  9. ;=============================================================================
  10.  
  11. ;Command: ERA
  12. ;Function:  Erase files
  13. ;Forms:
  14. ;    ERA <afn>    Erase Specified files and print their names
  15. ;    ERA <afn> I    Erase Specified files and print their names, but ask
  16. ;                for verification before Erase is done
  17.  
  18. era:
  19.     call    retsave
  20.     ld    a,(fcb2+1)    ; Get eraflg if it's there
  21.     ld    (eraflg),a    ; Save it as a flag
  22.     ld    a,1        ; Dir files only
  23.     call    getdir        ; Load directory of files
  24.     jp    z,prfnf        ; Abort if no files
  25. ;
  26. ; MAIN ERASE LOOP
  27. ;
  28. era1:
  29.     call    break        ; See if user wants to stop
  30.     push    hl        ; Save ptr to file
  31.     call    prfn        ; Print its name
  32.     ld    (nxtfile),hl    ; Save ptr to next file
  33.     pop    hl        ; Get ptr to this file
  34.     call    rotest        ; Test file pted to by hl for r/o
  35.     jr    nz,era3
  36. eraflg    equ    $+1        ; Address of flag
  37.     ld    a,0        ; 2nd byte is flag
  38.     cp    'I'        ; Is it an inspect option?
  39.     jr    nz,era2        ; Skip prompt if it is not
  40.     call    eraq        ; Erase?
  41.     jr    nz,era3        ; Skip if not
  42. era2:
  43.     ld    de,fcb1+1    ; Copy into fcb1
  44.     ld    b,11        ; 11 bytes
  45.     call    blkmov
  46.     call    initfcb1    ; Init fcb
  47.     ld    c,19        ; Delete file
  48.     call    bdos
  49. era3:
  50.     ld    hl,(nxtfile)    ; Hl pts to next file
  51.     ld    a,(hl)        ; Get char
  52.     or    a        ; Done?
  53.      if    erasp and spaceon
  54.     jp    z,spaexit
  55.      else
  56.     jp    z,exit
  57.      endif            ; Erasp and spaceon
  58.     call    crlf        ; New line
  59.     jr    era1
  60.  
  61. ; End RCP-ERA.Z80
  62.  
  63.