home *** CD-ROM | disk | FTP | other *** search
- program reformat;
- const
- ProgData = 'MAKE1- Free DOS utility: text line joiner.';
- ProgDat2 = 'V1.00: August 19, 1993. (c) 1993 by David Daniel Anderson - Reign Ware.';
-
- usage = 'Usage: MAKE1 <infile> <outfile>';
- var
- infile, outfile : text ;
- theline,
- nextline : string ;
-
- procedure showhelp ;
- begin
- writeln (usage) ;
- halt ;
- end;
-
- procedure initializeall;
- begin
- Writeln ( ProgData );
- Writeln ( ProgDat2 );
- Writeln ;
-
- if paramcount <> 2 then
- showhelp ;
-
- assign (infile, paramstr ( 1 ));
- {$i-} reset (infile); {$i+}
- if ioresult <> 0 then
- showhelp ;
-
- assign (outfile, paramstr ( 2 ));
- {$i-} rewrite (outfile); {$i+}
- if ioresult <> 0 then
- showhelp ;
-
- write ( ' Converting ' ,paramstr (1),' to ', paramstr (2) );
- end;
-
- procedure joinlines;
- begin
- while (nextline[ length (nextline)] = ' ' ) do
- delete (nextline,length ( nextline ),1 );
-
- if (nextline <> '') then
- while ((nextline[1] = ' ' ) or ( nextline [1] = '|' )) do
- delete (nextline,1,1);
-
- theline := theline + ' ' + nextline;
- end;
-
- begin
- initializeall;
-
- { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ }
-
- readln (infile,nextline);
-
- while not eof (infile) do
- begin
-
- theline := nextline;
-
- readln (infile,nextline);
-
- while (theline[ length (theline)] = ' ') do
- delete (theline,length (theline),1);
-
- while (nextline[1] = ' ') do
- begin
- joinlines;
- if not eof (infile) then
- readln (infile,nextline);
- end;
-
- if (theline <> '') then
- writeln (outfile,theline);
- end;
-
- { ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ }
-
- if pos (nextline,theline) = 0 then
- writeln (outfile,nextline);
-
- close (infile);
- close (outfile);
- writeln ( ', done!' );
-
- end.
-