{ TURBO PASCAL version of ULCAT.COM compile at 3A00 a program designed to update the MASTL.CAT listing which includes most possible files from a disk. Works with the LCAT.COM, MASTL.CAT and CATL.COM files. } program ULCAT; {$U+} type name = string[50]; var oldfile, entryfile, catfile, newfile: text; catdisk, diskname, entry, list: name; nofile: array[1..20] of name; i, t, x: integer; OK: boolean; new: string[1]; label QUIT,NEXT,NEXT1,START,TEST,GETCAT,GETENTRY,CATONLY,ENTRYONLY,CLOSEFILES; function exist(filename: name): boolean; var fil: file; begin assign(fil, filename); {$I-} reset(fil); {$I+} if IOresult <> 0 then exist := false else exist := true; end; begin writeln('ULCAT.COM v1.0 (C) Paul Nance, 10/6/84'); if exist('NAMESLBR.SUB') then goto NEXT; writeln; writeln('ERROR -- No NAMESLBR.SUB file available on this directory!'); writeln(' LBRCAT.COM sould be run before ULCAT.COM is used.'); goto QUIT; NEXT: assign(entryfile, 'NAMESLBR.SUB'); reset(entryfile); readln(entryfile, entry); if entry[1] <> '-' then begin writeln('First file in NAMESLBR.SUB is ', entry); writeln('Catalogued disks should have a title entry.'); writeln('>>>> -diskname.013'); writeln('First character should be a ''-'', then up to seven lettters'); writeln('for the disk name. The number in the extent could be any number'); writeln('but should be sequential.'); goto QUIT; end; diskname := entry; repeat diskname := copy(diskname, 2, length(diskname) - 1); until diskname[1] <> '-'; if exist('MASTL.CAT') then goto NEXT1; writeln; writeln('ERROR -- No MASTL.CAT file available on this directory!'); writeln(' LCAT.COM, ULCAT.COM and MASTL.CAT must be used'); writeln(' in the same directory.'); writeln; write('NOTE -- If this is first use, do you need a MASTL.CAT file? (Y/N)'); read(trm, new); writeln; if (new = 'Y') or (new = 'y') then begin writeln('In the first MASTL.CAT two files are removed from the catalog'); writeln('list, PIP.COM and DIR.COM. If any changes are needed they can'); writeln('be done with any text editor'); writeln('Be sure the format of the removed file area stays the same,'); writeln('do not remove the parentheses.'); writeln('EXAMPLE -- no files.'); writeln(' ('); writeln(' )'); assign(catfile, 'MASTL.CAT'); rewrite(catfile); writeln(catfile, '(DIR.COM'); writeln(catfile, 'PIP.COM)'); close(catfile); end; goto QUIT; NEXT1: assign(catfile, 'MASTL.CAT'); reset(catfile); i := 0; assign(newfile, 'MASTL.$$$'); rewrite(newfile); x := 0; t := 0; while (t = 0) do begin readln(catfile, list); writeln(newfile, list); writeln(list); t := pos(')', list); if t = 0 then begin list := copy(list, pos('(', list) + 1, length(list)); i := i + 1; nofile[i] := list; end else begin if length(list) <> 1 then begin i := i + 1; nofile[i] := copy(list, 1, length(list) - 1); end; end; end; if EOF(catfile) then goto ENTRYONLY; START: repeat if EOF(entryfile) then goto CATONLY; OK := true; readln(entryfile, entry); for t := 1 to i do if copy(entry, 1, pos('.', entry) + 3) = nofile[t] then OK := false; until OK; entry := entry + ',' + diskname; if EOF(catfile) then goto ENTRYONLY; readln(catfile, list); TEST: if list = entry then begin writeln(newfile, list); x := x + 1; end; if list = entry then goto START; catdisk := copy(list, pos(',', list) + 1, length(list) - pos(',', list)); if catdisk = diskname then writeln('delete: ',copy(list, 1, pos(',', list) - 1)); if catdisk = diskname then goto GETCAT; if entry < list then goto GETENTRY; begin writeln(newfile, list); x := x + 1; end; GETCAT: if EOF(catfile) then goto ENTRYONLY; readln(catfile, list); goto TEST; GETENTRY: writeln(newfile, entry); x := x + 1; writeln(' add: ', copy(entry, 1, pos(',', entry) - 1)); repeat if EOF(entryfile) then goto CATONLY; OK := true; readln(entryfile, entry); for t := 1 to i do if copy(entry, 1, pos('.', entry) + 3) = nofile[t] then OK := false; until OK; entry := entry + ',' + diskname; goto TEST; CATONLY: if EOF(catfile) then goto CLOSEFILES; readln(catfile, list); catdisk := copy(list, pos(',', list) + 1, length(list) - pos(',', list)); if catdisk = diskname then writeln('delete: ',copy(list, 1, pos(',', list) - 1)); if catdisk = diskname then goto GETCAT; writeln(newfile, list); x := x + 1; goto CATONLY; ENTRYONLY: if EOF(entryfile) then goto CLOSEFILES; readln(entryfile, entry); writeln(' add: ', entry); entry := entry + ',' + diskname; writeln(newfile, entry); x := x + 1; goto ENTRYONLY; CLOSEFILES: assign(oldfile, 'MASTL.BAK'); close(entryfile); close(newfile); close(catfile); if exist('MASTL.BAK') then erase(oldfile); rename(catfile, 'MASTL.BAK'); rename(newfile, 'MASTL.CAT'); erase(entryfile); QUIT: if x <> 0 then begin writeln; writeln('MASTL.CAT now has ', x, ' entries.'); end; end.