'Author : Daniel, Master Sourcerer at Kitana's Castle 'Last change: January 30, 2004 'Email : sourcerer@kitana.org 'Replaces Unix lines breaks (LF) with DOS line breaks (CR/LF) in a file #DIM ALL 'Main program FUNCTION PBMAIN& LOCAL F$,P$ LOCAL A$,I&,J&,N& 'read file name F$=TRIM$(COMMAND$) IF F$=""THEN 'no file name specified so prompt user LINE INPUT"File to convert: ",F$ F$=TRIM$(F$) IF F$=""THEN EXIT FUNCTION END IF 'check if file exists and get its long file name I&=INSTR(-1,F$,"\") P$=LEFT$(F$,I&) F$=DIR$(F$) 'DIR$ converts short file names to long file names IF F$=""THEN PRINT"File not found" EXIT FUNCTION END IF F$=P$+F$ 'read file OPEN F$ FOR BINARY AS #1 GET$ #1,LOF(1),A$ CLOSE #1 'replace single LF with CF/LF N&=0 J&=1 DO I&=INSTR(J&,A$,CHR$(10)) 'find next LF IF I&=0 THEN EXIT LOOP IF MID$(A$,I&-1,1)<>CHR$(13) AND MID$(A$,I&+1,1)<>CHR$(13) THEN 'this LF is standing alone so replace it A$=LEFT$(A$,I&-1)+CHR$(13)+MID$(A$,I&) N&=N&+1 I&=I&+1 END IF J&=I&+1 LOOP 'write file back to disk IF N&>0 THEN OPEN F$ FOR OUTPUT AS #1 PRINT #1,A$; CLOSE #1 PRINT"File ";F$;" successfully converted" ELSE PRINT"Nothing to do, file already in DOS format" END IF END FUNCTION