home *** CD-ROM | disk | FTP | other *** search
- ; LogRC .. Jim Butterfield 1991Apr19
- ; CLI only .. puts <return> status into ENV file RETURN<n>
- ; thus, a script could say;
- ; <.. some program..>
- ; LogRC
- ; IF $RETURN<$$>="WARN"
- ; ...
- ; ENDIF
- ; IF $RETURN<$$>="ERROR"
- ; ... etc.
- ;
- ; exec calls
- _LVOOpenLibrary EQU -$228
- _LVOCloseLibrary EQU -$19E
- ThisTask EQU $114
- ; dos calls
- _LVOOpen EQU -$1E
- _LVOClose EQU -$24
- _LVOWrite EQU -$30
- ; process structure
- pr_TaskNum EQU $8C
- pr_CLI EQU $AC
-
- lea dosName(pc),a1
- moveq #0,d0
- move.l 4.w,a6
- move.l ThisTask(a6),a5
- move.l pr_TaskNum(a5),d6
- jsr _LVOOpenLibrary(a6)
- move.l d0,a6
- moveq #5,d7 ; WARN
- tst.l d0
- beq exit
- ; d6 contains CLI number for decimal conversion
- link a3,#-$20
- move.l a3,a2
- move.b #0,-(a2) ; EndString
- Digit divu.w #10,d6
- swap d6
- or.b #$30,d6
- move.b d6,-(a2)
- move.b #0,d6
- swap d6
- bne.s Digit
- moveq #9,d0
- lea Stem(pc),a0
- GetStem move.b 0(a0,d0.w),-(a2)
- dbf d0,GetStem
- move.l a2,d1
- move.l #1006,d2
- jsr _LVOOpen(a6)
- unlk a3
- move.l d0,d4
- beq.s dosExit
- ; now analyze the return value and deliver it to $RETURN
- lea bMess(pc),a0
- move.l pr_CLI(A5),a4
- add.l a4,a4
- add.l a4,a4
- move.l $C(a4),d7 ; return code
- bmi.s SayIt
- lea kMess(pc),a0
- beq.s SayIt
- lea mMess(pc),a0
- cmp #5,d7
- bcs.s SayIt
- lea wMess(pc),a0
- cmp #10,d7
- bcs.s SayIt
- lea eMess(pc),a0
- cmp #20,d7
- bcs.s SayIt
- lea fMess(pc),a0
- SayIt move.l d4,d1
- move.l a0,d2
- moveq #0,d3
- SayLp addq.w #1,d3
- cmp.b #$A,-1(a0,d3.w)
- bne.s SayLp
- jsr _LVOWrite(a6)
-
- move.l d4,d1
- jsr _LVOClose(a6)
- dosExit move.l a6,a1
- move.l 4.w,a6
- jsr _LVOCloseLibrary(a6)
- exit move.l d7,d0
- rts
- dc.b '$VER:LogRC 1.0',$A
- dosName dc.b 'dos.library',0
- Stem dc.b 'ENV:Return'
- bMess dc.b 'BAD',$A
- kMess dc.b 'OK',$A
- mMess dc.b 'MINOR',$A
- wMess dc.b 'WARN',$A
- eMess dc.b 'ERROR',$A
- fMess dc.b 'FAIL',$A
-