The following program may be used to compare two text files to
determine their differences. It is especially useful for SK*DOS
users who receive updates to the configuration disk, and want to
determine the differences between the old and new files.

The program starts by asking for the name of each file (including
any directory info and extension). Then it asks for a search
string. If XXX is entered, it will start comparing from line 1
of each file. If a search string is entered, it will skip the
beginning of each file and start at the first line beginning with
that search string.

It then reads the two text files, one line at a time, and
compares them. As long as the lines are identical, it just
prints them and continues reading. But when a difference is
found, it prints out the two different lines along with ^
marks under those characters which differ in the two files,
and waits for a command. You may give one of the following
commands:

  1 = read next line from file 1 and compare again
  2 = read next line from file 2 and compare again
  3 = read a line from each file and compare again
 11 = read lines from file 1 until a match is found with file 2
 22 = read lines from file 2 until a match is found with file 1

When one of the files contains lines which are not in the other,
these commands allow you to manually resynchronize the files.

To use the program, us an editor or word processor (in its ASCII mode)
to remove this explanation, and then use the remainder with BASIC.

5 PRINT "COMPARISON OF TWO TEXT FILES"
6 REPEAT=0 :REM REPEAT FLAG
10 INPUT "ENTER FILE NAME 1: ", FIRST$
20 INPUT "ENTER FILE NAME 2: ", SECOND$
30 OPEN FIRST$ FOR INPUT AS 1
40 OPEN SECOND$ FOR INPUT AS 2
45 INPUT "ENTER SEARCH STRING, OR 'XXX' IF NONE: ", SSTRNG$
46 IF SSTRNG$="XXX" GOTO 100
48 L=LEN(SSTRNG$)
50 LINE INPUT #1, FILE1$
55 IF LEFT$(FILE1$,L)<>SSTRNG$ THEN 50
60 LINE INPUT #2, FILE2$
65 IF LEFT$(FILE2$,L)<>SSTRNG$ THEN 60
70 GOTO 120
100 LINE INPUT #1, FILE1$
110 LINE INPUT #2, FILE2$
120 PRINT FILE1$
130 IF FILE1$=FILE2$ THEN REPEAT=0 : GOTO 100
135 PRINT
140 PRINT F$; ":"; TAB(16);FILE1$
150 PRINT S$; ":"; TAB(16);FILE2$
155 PRINT TAB(16);
160 L=LEN(FILE1$) : IF LEN(FILE2$)<L THEN L=LEN(FILE2$)
165 FOR I=1 TO L
170 IF MID$(FILE1$,I,1)<>MID$(FILE2$,I,1) THEN PRINT "^"; ELSE PRINT " ";
180 NEXT I
185 PRINT
190 IF REPEAT<>0 THEN 205
200 INPUT CHOICE
205 IF CHOICE=11 THEN REPEAT=1
206 IF CHOICE=22 THEN REPEAT=2
210 IF CHOICE=1 OR REPEAT=1 THEN LINE INPUT #1, FILE1$ : GOTO 120
220 IF CHOICE=2 OR REPEAT=2 GOTO 110
230 IF CHOICE=3 GOTO 100
240 GOTO 200

