Frommax source code
From
Nick Andre@618:500/24 to
All on Wednesday, July 26, 2023 17:45:25
I forget who asked me for this... Sean?
Freepascal util to convert Maximum FILES.BBS to a more standard format.
Enjoy...
program frommax;
uses dos;
(* ConstStr is a function that returns a string of char, N many times. *)
function conststr(c : char; n : byte) : string;
var s : string;
begin
if n<0 then
n:=0;
s[0]:=chr(n);
fillchar(s[1],n,c);
conststr:=s;
end;
var bbsfilein,bbsfileout : text;
c : char;
x : integer;
(* Think of X as the cursor column position on a line and assume an 80 *) (* column display. We first open files and then begin a loop to read one *) (* character at a time. As the character is read, X is incremented. When *) (* we reach column 60, we write a CR+LF and 13 spaces and set X to 13. *) (* *) (* If you do not want to filter leading blank-spaces on the description *) (* lines, remove the "Repeat until" block. *)
begin
writeln('FROMMAX: Convert Maximus FILES.BBS to "standard" FILES.NEW');
writeln;assign(bbsfilein,'FILES.BBS'); (*$I-*) reset(bbsfilein);
if ioresult=0 then
begin
assign(bbsfileout,'FILES.NEW'); (*$I-*) rewrite(bbsfileout);
if ioresult=0 then
begin
x:=0;
while not eof(bbsfilein) do
begin
x:=x+1;
read(bbsfilein,c);
if (x=14) and (c=chr(32)) then
begin
repeat
read(bbsfilein,c);
until (c<>chr(32));
end;
if (c=chr(13)) or (c=chr(10)) then x:=0;
if x<61 then write(bbsfileout,c);
if (x=60) then
begin
write(bbsfileout,chr(13)+chr(10)+conststr(' ',13));
x:=13;
end;
end;
close(bbsfilein);writeln('Done.');
end
else
writeln('Error writing FILES.NEW');
end
else
writeln('Error loading FILES.BBS');
close(bbsfileout);
end.
Nick
--- Renegade vY2Ka2
* Origin: Joey, do you like movies about gladiators? (618:500/24)