home *** CD-ROM | disk | FTP | other *** search
- ;
- ; FileChanged V1.00 Friday 13-Aug-1993
- ;
- ; by Jan Hagqvist
- ;
- ; Checks if the file has been altered (archiveflag 'a' clear)
- ;
- ; V1.00 Friday 13-Aug-1993 Oh, shi(f)t! !FRI 13 (:o
- ;
-
- XREF _LVOOpenLibrary
- XREF _LVOCloseLibrary
- XREF _LVOOpen
- XREF _LVOExamineFH
- XREF _LVOClose
- XREF _LVOIoErr
- XREF _LVOFault
- XREF _LVOVPrintf
- XREF _LVOGetProgramName
-
- CheckFile
- clr.b -1(a0,d0) ; Null terminate the arg string
- move.l a0,a4 ; The arg string
- moveq.l #0,d6 ; Clear the return flag
- move.l 4,a6
- cmp.w #36,20(a6) ; Is the system V36+?
- bmi.s Quit2 ; No, so quit and make it fast!
- lea DosName(pc),a1
- moveq.l #0,d0
- jsr _LVOOpenLibrary(a6) ; Open Dos
- tst.l d0 ; Got it?
- beq.s Quit2 ; No
-
- move.l d0,a6
- tst.b (a4) ; Any args?
- beq.s About ; No
- cmp.b #'?',(a4) ; Arg='?'
- beq.s About ; Yep
-
- move.l a4,d1
- move.l #1005,d2
- jsr _LVOOpen(a6) ; Open the file
- tst.l d0 ; Got it?
- beq.s QuitError ; No
-
- move.l d0,d7
- move.l d0,d1
- move.l #FIB,d2
- jsr _LVOExamineFH(a6) ; Get fileinfo
-
- move.l d2,a0
- move.l 116(a0),d0 ; Get the protection flags
- btst #4,d0 ; File changed?
- bne.s CloseIt ; No
- moveq.l #5,d6 ; Yep, set return flag to WARN
- CloseIt
- move.l d7,d1
- jsr _LVOClose(a6) ; Close the file
-
- Quit
- move.l a6,a1
- move.l 4,a6
- jsr _LVOCloseLibrary(a6) ; Close Dos
- Quit2
- move.l d6,d0
- rts
-
- QuitError
- jsr _LVOIoErr(a6) ; Get the error num
- move.l d0,d1
- move.l #ErrorText,d2
- move.l #FIB,d3
- move.l #260,d4
- jsr _LVOFault(a6) ; Get the error text
- move.l #FIB,d1
- moveq.l #0,d2
- jsr _LVOVPrintf(a6) ; Print it
- move.l #LineFeed,d1
- moveq.l #0,d2
- jsr _LVOVPrintf(a6)
- bra.s Quit
-
- About
- move.l #FIB,d1
- move.l #260,d2
- jsr _LVOGetProgramName(a6)
- move.l #AboutText,d1
- move.l #AboutArgs,d2
- jsr _LVOVPrintf(a6)
- bra.s Quit
-
- AboutArgs dc.l FIB,0
-
- DosName dc.b 'dos.library',0
- ErrorText dc.b 'DOS Error',0
- LineFeed dc.b 10,0
- AboutText dc.b 10,'FileChanged V1.00 Friday 13-Aug-1993',10
- dc.b 'by Jan Hagqvist',10
- dc.b 'Made in Finland',10,10
- dc.b 'Returns WARN if the file has been changed (archiveflag "a" is clear).',10,10
- dc.b 'USAGE: %s filename',10,10,0
-
- section 2,bss
-
- FIB dcb.b 260,0
-
- END
-