home *** CD-ROM | disk | FTP | other *** search
- {PROGRAM : LHDOOR
-
- AUTHORS : Jan Maaskant(RBBS) - Expansions - 692-0377 - 1:387/301
- Jon Hamlin(QuickBBS)- The Programmers Paradise - 654-9134 - 1:387/609
-
- PURPOSE : This isn't really a full scale door, and was never
- meant to be, it is meant more as a 'quick fix'
- for use with a new file compression scheme until
- one of the more inspired and talented folks out
- out there decides to make a -real- LHarc door.
-
- OTHER STUFF : Jon and I continually slash at each other's code,
- fact is you'll find a lot in here that was done by
- either of us. However we don't agree on a lot of
- things, and the version of this running on either
- of our BBS's will usually look and feel -different-
- Doesn't bother us, if it bother's you your welcome
- to slash the code into whatever shape you like,
- just leave our names in (or suffer horrible
- agony in the hereafter...) and shoot us a copy
- if you did any good.
- }
-
- {$M $4000,0,0} {Needed since we use the Exec function }
- Uses DOS;
-
- var
- choice : string[1];
- fname : string[8];
- NewFile : String[8];
- file_found : boolean;
- paths : text;
- path : string[255];
- fullfilename : text;
- killarcs : text;
- di : Text;
- ch : string[1];
- Dummy : String[50];
- i : Integer;
- U_Security : Integer;
- U_ANSI : Integer;
- Set_Sec : Integer;
- ValidChoice : Boolean;
- IndFName : String[80];
- Current : String[255];
- CmdStr : String[255];
- DelStr : String[255];
-
- procedure colormenu;
- begin
- writeln('C╔══════════════════════════╡LHDOOR╞═s');
- writeln('u═════════════════════════╗HC║ LHZ/ZIP/PAK/ARCs');
- writeln('u Conversion and Viewing Door ║HC║ s');
- writeln('u Version 1.12 ║HC║ s');
- writeln('u ║');
- writeln('HC║ Inquiries to: Expansions RBBS s');
- writeln('u ║HC║ (512)349-8227 s');
- writeln('u ║HC║ 1:387s');
- writeln('u/301 ║HC║ Quics');
- writeln('ukbbs: The Programmer''s Paradise ║HC║ s');
- writeln('u (512)654-9134 ║Hs');
- writeln('uC║ 1:387/609 s');
- writeln('u ║HC║──────────────────────────────┬───────s');
- writeln('u──────────────────────╢HC║ View s');
- writeln('u │ Conversion ║Hs');
- writeln('uC║ ~~~~ │ ~~~~s');
- writeln('u~~~~~~ ║HC║ [D] Display file ins');
- writeln('uside LHARC│ [E] Self-extractins');
- writeln('ug ║HC║ [L] List s');
- writeln('u│ [P] PAK file ║HC║s');
- writeln('u [O] Old style view │ s');
- writeln('u[S] SEA''s style ARC ║HC║ [Vs');
- writeln('u] View │ [Zs');
- writeln('u] Zip Format ║HC║ [Qs');
- writeln('u] Quit back to BBS ║HC╚════════A');
- writeln('C══════════════════════╧═════════════════════════════╝');
- writeln;
- write(' Choice: ');
- end;
-
- procedure monomenu;
- begin
- writeln;
- writeln(' LHDOOR');
- writeln(' LZH/ZIP/PAK/ARC Conversion and Viewing Door');
- writeln(' Version 1.12');
- writeln;
- writeln(' VIEW LZH file CONVERT');
- writeln(' ---- -------');
- writeln('(L)ist (E) Self Extracting');
- writeln('(V)iew (P) PAK file');
- writeln('(O)ld style view (S) SEA'' style ARC');
- writeln('(D)isplay file inside a LHARC (Z) Zip format');
- writeln;
- writeln(' (Q)uit back to BBS');
- writeln;
- write('Choice: ');
- end;
-
- procedure up_choice;
- var
- ch : char;
- begin
- ch := choice[1];
- ch := upcase(ch);
- choice := ch;
- end;
-
- procedure get_file_name;
- var
- dimwit : boolean;
- begin
- dimwit := true;
- while dimwit do
- begin
- write(' Enter the filename (No Extension) > ');
- readln(Fname);
- writeln;
- dimwit :=false; {intelligent until proven dimwitted}
- if fname='' then
- begin
- writeln('Not even remotely valid...');
- dimwit := true;
- end
- else begin
- i := 1;
- NewFile := '';
- While (fname[i] <> '.') and (i <= Length(fname)) do
- begin
- NewFile := NewFile + fname[i];
- i := i + 1;
- end;
- fname := NewFile;
- end;
- end; {If they added an extension}
- end;
-
- procedure find_file;
- begin
- write(' Now searching for the file');
- reset(paths);
- file_found := false;
- while (not(eof(paths)) and not(file_found)) do
- begin
- path := '';
- ch := 'Y';
- while ((ch <> ' ') and not(eof(paths))) do
- begin
- read(paths,ch);
- if ch <> ' '
- then path := path + ch;
- end;
- ch := '';
- Readln(paths,Set_Sec);
- path := path + '\';
- assign(fullfilename,path+fname+'.LZH');
- {$I-}
- reset(fullfilename);
- {$I+}
- if (IORESULT=0) and (Set_Sec <= U_Security)
- then
- file_found := TRUE
- else
- write('.');
- end;
- writeln;
- end;
-
- PROCEDURE CHOICE_E;
- begin
- writeln;
- writeln(' File located...');
- writeln(' Creating self-extracting file now, please hold...');
- MkDir('\_$LHTMP');
- ChDir('\_$LHTMP');
- Exec('C:\COMMAND.COM',' /C LHARC s '+PATH+FNAME+' > NUL:');
- Exec('C:\COMMAND.COM',' /C COPY '+FNAME+'.COM '+PATH+FNAME+'.COM');
- Exec('C:\COMMAND.COM',' /C DEL '+FNAME+'.COM');
- ChDir(Current);
- RmDir('\_$LHTMP');
- writeln(' The file is ',fname,'.COM, but is not listed.');
- writeln(' It will be DELETED in the nightly event');
- writeln(' so -Get it NOW-');
- Writeln;
- Writeln(' Hit Enter to continue');
- ReadLn;
- assign(killarcs,'KILLARCS.BAT');
- {$I-}
- append(killarcs);
- {$I+}
- if not(ioresult=0) then rewrite(killarcs);
- writeln(killarcs,'DEL ',path+fname,'.EXE');
- close(killarcs);
- end;
-
- procedure choice_VLOD;
- var
- fspec : string[255];
- begin
- if choice='O' then Exec('C:\COMMAND.COM','/C LVIEW '+path+fname);
- if choice='V' then Exec('C:\COMMAND.COM','/C LHARC V '+path+fname);
- if choice='L' then Exec('C:\COMMAND.COM','/C LHARC L '+path+fname);
- if choice='D' then
- begin
- writeln(' LHarc Internal File Display');
- writeln(' ^S <CTRL S> & ^Q to start and stop your display, ^C to abort.');
- writeln;
- Exec('C:\COMMAND.COM','/C LHARC L '+path+fname);
- writeln('Enter the filespec you wish to VIEW or [ENTER] for all files');
- write('within '+fname+': ');
- readln(fspec);
- writeln(' Please turn on CAPTURE now!');
- writeln(' -------Begin Display-------');
- Exec('C:\COMMAND.COM',' /C LHARC P '+path+fname+' '+fspec+' | MORE');
- writeln(' --------End Display--------');
- end;
- Write(' Press [ENTER] to contine: ');
- Readln;
- end;
-
- procedure choice_spz;
- begin
- writeln;
- write(' FOUND! Now creating the archive in ');
- if choice='S' then write ('SEA''s ARC ');
- if choice='P' then write ('NoGate''s PAK ');
- if choice='Z' then write ('Katz''s ZIP ');
- writeln('compatible format');
- writeln(' This could take several moments for a large file!');
- assign(killarcs,'KILLARCS.BAT');
- {$I-}
- append(killarcs);
- {$I+}
- if not(ioresult=0) then rewrite(killarcs);
- if choice <> 'P'
- then writeln(killarcs,'DEL ',path+fname,'.ARC')
- else if choice = 'P'
- then writeln(killarcs,'DEL ',path+fname,'.PAK')
- else writeln(killarcs,'DEL ',path+fname,'.ZIP');
- close(killarcs);
- Mkdir('\_$LHTMP');
- Chdir('\_$LHTMP');
- Exec('C:\COMMAND.COM',' /C LHARC '+path+fname+' > _LHTMP');
- Exec('C:\COMMAND.COM',' /C LHARC e /m '+PATH+FNAME);
- If choice <> 'Z'
- then CmdStr := 'PAK A '
- else CmdStr := 'PKZIP -A -EX ';
- if choice = 'S' then CmdStr := CmdStr+'/C ';
- if choice <> 'Z'
- then CmdStr := CmdStr+'/WA ';
- CmdStr := CmdStr+path+Fname+' ';
- Assign(di,'_LHTMP');
- reset(di);
- ch := 'Z';
- While (ch <> '-') do
- Readln(di,ch);
- ch := 'Z';
- While (ch <> '-') do
- begin
- Read(di,ch);
- If ch <> '-'
- then begin
- IndFName := '';
- While ch = ' ' do
- Read(di,ch);
- IndFName := ch;
- While ch <> ' ' do
- begin
- Read(di,ch);
- IndFname := IndFname + ch;
- end;
- Readln(di);
- CmdStr := CmdStr+IndFName+' ';
- end;
- end;
- Close(di);
- Exec('C:\COMMAND.COM',' /C '+CmdStr);
- reset(di);
- ch := 'Z';
- While (ch <> '-') do
- Readln(di,ch);
- ch := 'Z';
- While (ch <> '-') do
- begin
- Read(di,ch);
- If ch <> '-'
- then begin
- IndFName := '';
- While ch = ' ' do
- Read(di,ch);
- IndFName := ch;
- While ch <> ' ' do
- begin
- Read(di,ch);
- IndFname := IndFname + ch;
- end;
- Readln(di);
- Exec('C:\COMMAND.COM',' /C DEL '+IndFName);
- end;
- end;
- Close(di);
- Exec('C:\COMMAND.COM',' /C DEL _LHTMP');
- ChDir(Current);
- RmDir('\_$LHTMP');
- if choice='S' then
- begin
- Exec('C:\COMMAND.COM',' /C COPY '+path+fname+'.PAK '+path+fname+'.ARC');
- Exec('C:\COMMAND.COM',' /C DEL '+path+fname+'.PAK');
- end;
- writeln;
- if Choice = 'Z'
- then
- writeln(' Conversion complete, file is ',fname,'.ZIP.')
- else if choice <> 'P'
- then
- writeln(' Conversion complete, file is ',fname,'.ARC.')
- else
- writeln(' Conversion complete, file is ',fname,'.PAK.');
-
- writeln(' It is available for download, but is not in');
- writeln(' the file listings.');
- writeln(' NOTE: this file will be DELETED in the nightly event');
- writeln(' -So get it now-');
- Writeln(' Hit Enter to continue');
- ReadLn;
- end;
-
- procedure not_found_msg;
- begin
- writeln;
- writeln(' Sorry, the file ',fname,'.LZH was not found on the disk');
- writeln(' If this is the correct name then please inform the sysop of the');
- writeln(' problem. If this was not the correct name then please feel');
- writeln(' free to try again.');
- writeln;
- write('Press [ENTER] ');
- readln;
- writeln;
- writeln;
- end; {Bad file was entered}
-
- procedure get_user_info;
- begin
- Assign(di,'DORINFO1.DEF');
- Reset(di);
- for i := 1 to 9 do Readln(di, Dummy);
- Readln(di,U_ANSI);
- Readln(di,U_Security);
- Close(di);
- end;
-
- {-------------------Main Loop-------------------}
-
- begin
- while TRUE do
- BEGIN
- GetDir(0,Current);
- get_user_info;
- ValidChoice := False;
- while not ValidChoice do
- begin
- ASSIGN (PATHS,'flsearch.ctl');
- choice := 'Y';
- while not ((choice='P') or
- (choice='D') or
- (choice='S') or
- (choice='Q') or
- (choice='V') or
- (choice='L') or
- (choice='E') or
- (choice='O') or
- (choice='Z')) do
- begin
- if U_ANSI = 0
- then monomenu
- else colormenu;
- readln(choice);
- up_choice;
- end;
-
- IF CHOICE = 'Q' then HALT(0) else
- begin
- get_file_name;
- find_file;
- if not(file_found) then not_found_msg;
- if (file_found) then
- if choice='E' then choice_E;
- if (((choice='V') or
- (choice='L') or
- (choice='O') or
- (choice='D')) and
- file_found) then CHOICE_VLOD;
- if (((choice='S') or
- (choice='P') or
- (choice='Z')) and
- file_found) then CHOICE_SPZ;
- end;
-
- {$I-}
- close(paths);
- {$I+}
- end;
- end; {While not validchoice do}
- end.