;**********************************************
; DELLF - DELete Line Feed
;
; Deletes LFs from files
;
; by Doug Dozier - modified from Dave Heyliger's DELCR program
;
; Directions: just type DELLF and follow 'em!
;
;**********************************************
;--- Get symbols and macros
;
SEARCH SYS
SEARCH SYSSYM
SEARCH TRM
;--- Define version number
;
VMAJOR=1.
VMINOR=0.
VEDIT=100. ;original by Doug Dozier, M.D.
;--- Program header and variable offset assignments
;
PHDR -1,0,PH$REE!PH$REU ;re-entrant, re-usable
GETIMP IMPSIZ,A3 ;A3 points to variables
LEA A5,IDDB(A3) ;A5 points to input file
LEA A4,ODDB(A3) ;A4 point to output file
;--- type out introduction
;
PRTTAB -1,0 ;clear screen
PRTTAB 6,37 ;tab to here
TYPE <DELETE LF Utility> ;fancy program title
PRTTAB 10,24 ;tab to here
TYPE <deletes Line Feeds from files!>
;--- get input file and output file (not intensive error checking)
;
PRTTAB 12,20
TYPE <Enter in the file having LFs : >
KBD
FSPEC @A5
PRTTAB 13,20
TYPE <Enter in a name for updated file : >
KBD
FSPEC @A4
INIT @A5 ;initialize both files
INIT @A4
LOOKUP @A5 ;if input file not found
JNE BOOBOO ;error
LOOKUP @A4 ;if output file found
JEQ BOOBOO ;error
OPENI @A5 ;open them
OPENO @A4
PRTTAB 15,1
TYPE <Working..> ;gizmo effects!
;--- read input file byte-by-byte, write to output file byte-by-byte,
; but delete a LF if you ever hit a one on the input file
;
BYB: FILINB @A5 ;get a byte
TST IDDB+D.SIZ(A3) ;eof?
BEQ EOF ;yup
CMPB D1,#12 ;is it a LF?
BNE AOK ;nope, so AOK to write
TYPE <.> ;yup, so gizmo effects
BR BYB ;and don't write the byte
AOK: FILOTB @A4 ;write the byte
BR BYB ;goto top
;--- if no input file or output file exists, type message
;
BOOBOO: PRTTAB 15,23
TYPE <File spec error or file already exists>
MOV #7,D1 ;get a bell
TTY ;beep!
BR EXIT
;--- EOF hit, so close files, finish gizmo effects!
;
EOF: CLOSE @A5
CLOSE @A4
EXIT: TYPECR <!>
EXIT
END