10 ' CR.BAS - Add carriage returns to text files
20 KEY OFF
30 CLS:LOCATE 18,1:FILES:GOTO 1000
100 IN$="":IN$=INKEY$:IF IN$="" THEN 100 ELSE RETURN
200 CHOP=INSTR(A$,"."):IF CHOP>.001 THEN A$=LEFT$(A$,CHOP-1)
210 A$=A$+".OUT"
220 RETURN
1000 LOCATE 1,21:PRINT"Software from MENTOR Computer Services"
1002 LOCATE 5,15:PRINT "CR -- Inserts carriage returns to downloaded files."
1010 LOCATE 8,10:PRINT "Source Drive (B: default): ";:GOSUB 100:IF IN$<"A" THEN INDRIVE$="B:" ELSE INDRIVE$=IN$+":"
1020 IGNORE=0:PRINT INDRIVE$
1030 LOCATE 9,10:PRINT"Destination Drive (C: default): ";:GOSUB 100:IF IN$<"A" THEN OUTDRIVE$="C:" ELSE OUTDRIVE$=IN$+":"
1040 PRINT OUTDRIVE$
1050 SOURCE$="":LOCATE 11,20:LINE INPUT "Input file: ";A$:SOURCE$=INDRIVE$+A$
1055 IF OUTDRIVE$=INDRIVE$ THEN GOSUB 200
1060 DEST$=OUTDRIVE$+A$
1070 LOCATE 14,25:PRINT "W O R K I N G . . .";
1080 OPEN "I",1,SOURCE$: OPEN "O",2,DEST$
1090 TE$="":IF EOF(1) THEN GOTO 1130
1100 LINE INPUT#1,TE$:IF INSTR(TE$,CHR$(7))>.001 THEN GOTO 1090
1101 IF IGNORE=1 THEN GOTO 1110
1102 IF VAL(LEFT$(TE$,2))<.001 THEN LINER=1:BEEP:LOCATE 14,1:PRINT TE$;SPACE$(75-POS(0)):PRINT"Not a BASIC statement.  (C)ontinue, (D)elete or (A)bort";:GOSUB 100:IF IN$="D" THEN GOTO 1090 ELSE IF IN$="A" THEN CLOSE:CLS:GOTO 30 ELSE IGNORE=1
1104 IF LINER=1 THEN LINER=0:FOR X=14 TO 17:LOCATE X,1:PRINT SPACE$(79);:NEXT:LOCATE 14,25:PRINT "W O R K I N G . . .";
1110 PRINT#2,TE$
1120 GOTO 1090
1130 CLOSE:LOCATE 14,25:PRINT "    D O N E !";SPACE$(25):
1140 FOR TONE=1 TO 2:SOUND 800,3:SOUND 400,3:NEXT
1150 LOCATE 16,20:PRINT"Do another? ";:GOSUB 100:IF IN$="Y" THEN FOR X=11 TO 17:LOCATE X,1:PRINT SPACE$(79):NEXT:GOTO 1050
1160 CLS:END