home *** CD-ROM | disk | FTP | other *** search
- page
-
- ; RCP-REN.Z80
-
- ;Section 5E
- ;Command: REN
- ;Function: To change the name of an existing file
- ;Forms:
- ; REN <New ufn>=<Old ufn> Perform function
- ;
- ren:
- ;
- ; CHECK FOR WHEEL APPROVAL IF OPTION ENABLED
- ;
-
- call retsave
- ;
- ;
- ; STEP 1: CHECK FOR FILE 2 BEING AMBIGUOUS
- ;
- ld hl,fcb2+1 ; Can't be ambiguous
- call ambchk1
- ;
- ; STEP 2: LOG INTO USER AREA
- ;
- call logusr ; Log into user area of fcb1
- ;
- ; STEP 3: SEE IF OLD FILE IS R/O
- ;
- ld hl,fcb1 ; Pt to 1st fcb
- push hl
- ld de,fcb2 ; Pt to 2nd file
- push de ; Save ptr
- ld a,(hl) ; Get 1st's drive
- ld (de),a ; Stuff into second fcb
- ld c,17 ; Look for file
- call bdos
- inc a
- jp z,prfnf
- call getsbit ; Get ptr to entry in tbuff
- ex de,hl ; Hl pts to entry
- inc hl ; Pt to fn
- call rotest ; See if file is r/o
- jp nz,exit
- ;
- ; STEP 4: SEE IF NEW FILE ALREADY EXISTS
- ; EXTEST PERFORMS A NUMBER OF CHECKS:
- ; 1) AMBIGUITY
- ; 2) R/O
- ; 3) IF FILE EXISTS AND NOT R/O, PERMISSION TO DELETE
- ;
- call extest
- jp z,exit ; R/o or no permission
- ;
- ; STEP 5: EXCHANGE FILE NAME FIELDS FOR RENAME
- ;
- pop de ; Pt to old
- pop hl ; Pt to new
- push hl ; Save ptr
- ld b,12 ; 12 bytes
- call iswap1
- ;
- ; STEP 6: RENAME THE FILE
- ;
- pop de ; Get ptr to fcb
- ld c,23 ; Rename
- call bdos
- inc a ; Set zero flag if error
- jp z,prfnf ; Print no source file message
- jp exit
- ;
- ;
- ; End RCP-REN.Z80
-
-