uses dos,crt,gen,strl,records;

type strrec=record
            str : string[100];
            dsc : String[100];
            mci : string[3];
            del : boolean;
            end;

var strf : file;
    str  : strrec;
    se   : array[1..9] of longint;
    x    : BYTE;
    y    : longint;
    c    : char;
    temp : String;
    gx   : byte;
    kx   : byte;

Procedure Read_In_Config;
Var Temp : String;
 begin
   assign(configf,'LUCID.CFG');
 {$I-}   reset(configf); {$I+}
    if ioresult<>0 then
    begin
    writeln('Lucid.cfg Does Not Exist, Please Configur Lucid ');
    halt(1);
    end;
    write('Reading In Configuration');
  {--}
   With Config do
    Begin
     Readln(ConfigF,LongName);
     Readln(ConfigF,Shortname);
     Readln(ConfigF,SysOpName);
     Readln(ConfigF,BoardPhone);
     Readln(ConfigF,RegistrationCode);
     Readln(ConfigF,NodeNumber);
     Readln(ConfigF,TotalNodes);
     Readln(ConfigF,DefaultUserNote);
     Readln(ConfigF,Temp);
     If Pos('T',Temp) <> 0 then Use_NUV := True else Use_NUV := False;
     Readln(ConfigF,Temp);
     If Pos('T',Temp) <> 0 then Use_SPW := True else Use_SPW := False;
    {----------------------- Passwords & Shit ----------------------}
     Readln(ConfigF,NUPS[1]);
     Readln(ConfigF,NUPS[2]);
     Readln(ConfigF,NUPS[3]);
     Readln(ConfigF,NUPS[4]);
     Readln(ConfigF,NUPS[5]);
     Readln(ConfigF,NUPAccess[1]);
     Readln(ConfigF,NUPAccess[2]);
     Readln(ConfigF,NUPAccess[3]);
     Readln(ConfigF,NUPAccess[4]);
     Readln(ConfigF,NUPAccess[5]);
     Readln(ConfigF,SystemPW);
     Readln(ConfigF,BadBaudPW);
     Readln(ConfigF,ShellPW);
     Readln(ConfigF,ExitPW);
     Readln(ConfigF,SysOpPW);
     Readln(ConfigF,ChatPW);
    {------------------------- Directory Shit ----------------------}
    Readln(ConfigF,Lucid_dir);
    Readln(ConfigF,Text_dir);
    Readln(ConfigF,Board_Dir);
    Readln(ConfigF,Data_Dir);
    Readln(ConfigF,Textfile_dir);
    Readln(ConfigF,Door_dir);
    Readln(ConfigF,work_dir);
    Readln(ConfigF,menu_dir);
    Readln(ConfigF,prot_dir);
    readln(configf,arch_dir);
    Readln(ConfigF,Extract_dir);
    {-------------------------- Modem Shit -------------------------}
    Readln(ConfigF,Comport);
    Readln(ConfigF,LockBaud);
    Readln(ConfigF,LowestBaud);
    Readln(ConfigF,AnswerStr);
    Readln(ConfigF,InitStr);
    Readln(ConfigF,hangup);
    Readln(ConfigF,Temp);
    If Pos('F',Temp) <> 0 then fossil:= True else
    if Pos('A',temp) <> 0 then fossil:= false else
    if pos('T',temp) <> 0 then begin;
                               fossil:=true;
                               end;
   Readln(ConfigF,Temp);
   If Pos('T',Temp) <> 0 then changepage:= True else
   if Pos('F',temp) <> 0 then changepage:= false;

   End;
  close(configf);
  write('Done Reading Config');
end;

procedure getstr(var s:Strrec;x:byte);
var g:strrec;
begin
seek(strf,se[X]);
blockread(strf,g,sizeof(g));
s:=g;
end;

procedure shownextfive(X:LONGINT);
VAR Y,Z:INTEGER;
begin
kx:=1;
fillchar(se,sizeof(Se),#0);
clrscr;
print('|B0|05L|13ucid |05B|13BS |15v1b  |05B|13y |08Judge Dredd'+#10#13);
print('|B0|13ÄÄÄ-Ä|05ÄÄ--|08ÄÄ -   -'+#10#13);
SEEK(STRF,SIZEOF(STR)*X);
z:=1;
FOR y:=1 TO 9 DO
BEGIN
if eof(strf) then break;
se[y]:=filepos(strf);
inc(kx);
BLOCKREAD(STRF,STR,SIZEOF(STR));
bufstr:=70;
PRINT('|B0|13<|05'+STRR(y)+'|08,'+chr(64+y)+',|05'+strr(filepos(strf) div sizeof(Str))+'|08> ');
gx:=wherex;
print('|15'+str.mci+' |08š '+str.str);
writeln;

END;
PRINT('|B0|13<|05]|08> |15Next'+#10#13);
PRINT('|B0|13<|05[|08> |15Prev'+#10#13);
PRINT('|B0|13<|05+|08> |15Add'+#10#13);
PRINT('|B0|13<|05-|08> |15Delete'+#10#13);
Print('|B0|131 |05to |085 |15to edit String'+#10#13);
print('|B0|13ÄÄÄ-Ä|05ÄÄ--|08ÄÄ -   - |08 Prompt Command > '+#10#13);
end;

procedure writestring;
begin
seek(strf,filesize(strf));
blockwrite(strf,str,sizeof(str));
end;

{$I strs.pas}

var kc:string[1];
    kg:char;
begin
read_in_config;
fillchar(se,sizeof(se),#0);
bufstr:=255;
HIDECURSOR;
assign(strf,config.data_dir+'STRINGS.DAT');
CHECKSTRINGS;
RESET(STRF,1);
textattr:=7;
clrscr;
y:=1;
x:=0;
shownextfive(x);

repeat
c:=readkey;
case upcase(c) of

#77,']': if filepos(strf)<filesize(strf) then
    begin
    inc(x,9);
    shownextfive(x);
    end;
#75,'[':if x-9>-9 then
    begin;
    dec(x,9);
    shownextfive(x);
    end;

'A'..'I':BEGIN
         if ord(c)-64<kx then begin
         WRITELN('SDFKASDJFASDF');
         gotoxy(gx,(2+49-ord(c)));
         textattr:=7;
         clreol;
         getstr(str,49-ord(c));
         showcursor;
         temp:=str.mci;
         edstr(temp,
               gx,
               2+49-ord(c),
               3,
               15,
               1,
               100);
         str.mci:=temp;
         seek(strf,se[49-ord(c)]);
         blockwrite(strf,str,sizeof(str));
         hidecursor;
         shownextfive(X);
         end;

         END;

'+':begin
    seek(strf,filesize(strf));
    str.str:='New String';
    Str.dsc:='None';
    blockwrite(Strf,str,sizeof(Str));
    end;
'1'..'9':if valu(c)<kx then begin
         gotoxy(gx+6,(2+valu(c)));
         textattr:=7;
         clreol;
         getstr(str,{se[}valu(c){]});
         showcursor;
         temp:=str.str;
         edstr(temp,
               gx+6,
               2+valu(c),
               65,
               15,
               1,
               100);
         str.str:=temp;
         seek(strf,se[valu(c)]);
         blockwrite(strf,str,sizeof(str));
         hidecursor;
         shownextfive(X);
         end;

end;
until c=#27;
end.