home *** CD-ROM | disk | FTP | other *** search
- PROGRAM List;
-
- {
- This program will list any text file, including Pascal
- files, on a printer.
-
- Source: "COPY and LIST for Pascal Source Files", TUG Lines Volume I Issue 6
- Author: Harold Drake
- Application: All systems
- }
-
- var
- fname: string[14]; {name of file to be listed}
- line: string[80]; {one line of the file}
- n: integer; {index variable}
- lgth: integer; {length of filename string}
- f: text; {internal filename}
- pascal: boolean; {flag for pascal file extension}
- begin
- write('Enter file name: '); readln(fname);
- pascal :=true;
- lgth :=length(fname);
- for n :=1 to lgth do if fname[n] ='.' then pascal := false;
- if pascal then insert('.PAS',fname,1+lgth);
- if (not pascal) and (fname[lgth] = '.') then delete(fname,lgth,1);
- assign(f,fname);
- reset(f);
- while not eof(f) do
- begin
- readln(f,line);
- writeln(lst,line);
- end;
- close(f);
- write(lst,chr(12));
- end.