💾 Archived View for blitter.com › OLGA › MUSIC › RESOURCES › MISC › OLGA_BROWSER › OLGA_EXTRACT › SR… captured on 2024-08-18 at 19:39:38.
⬅️ Previous capture (2022-06-12)
-=-=-=-=-=-=-
{$M 16384,0,65536} { preserve space for the external programs } uses crt,dos; const tars = 'allpt*.*'; var s,t : string; i,j,y : integer; c : char; sr : searchrec; ti,ta,tc : text; b,e,a : char; function IToS(i: Longint): string; { make the str procedure to a function } { Convert any Integer type to a string } var s: string[11]; begin Str(i, s); IToS := s; end; procedure read_in (var fi:text; var st:string); begin readln (fi,st); if (pos('symlink',st)=0) and (pos('lrw',st)=0) then begin if (st[1]='d') and (st[length(st)]<>'/') then st:=st+'/'; i:=length (st); repeat dec (i) until (st[i-1]=' ') or (i=1); st:=copy (st,i,length(st)-i+1); end; end; procedure basewin; begin window (1,1,80,25); clrscr; { painting main screen } textcolor (yellow); textbackground (blue); clrscr; for i:=0 to 77 do mem [$B800:2+2*i]:=ord('�'); memL [$B800:4+2*i]:=$1eBA1eBB; mem [$B800:0]:=ord('�'); memL [$B8ef:14]:=$1eC81eBA; for i:=0 to 77 do mem [$B8f0:2+2*i]:=ord('�'); mem [$B8f0:4+2*i]:=ord ('�'); for i:=1 to 22 do memL[$B800:158+160*i]:=$1eBA1eBA; gotoxy (12,1); write ('� OLGA - On-Line Guitar Archive - Installation program �'); window (4,3,79,24); textcolor (lightgray); clrscr; writeln; end; begin basewin; writeln ('Welcome to the OLGA archive browser software.'); writeln; if pos ('TAR.EXE',fexpand(fsearch('tar.exe',getenv('path'))))=0 then begin { tar.exe not present } textcolor (lightred); writeln ('TAR.EXE not found. This program is essential and should be present'); writeln ('in the olgabr.zip. Please make sure that it''s in the current'); writeln ('directory or in a directory where DOS looks for programs.'); writeln; writeln ('Program aborted, press a key.'); c:=readkey; window (1,1,80,25); { restore normal screen conditions } textcolor (lightgray); textbackground (black); clrscr; halt(1); end; writeln ('This is the installation program, and it will take you about 10 minutes'); writeln ('to complete it.'); writeln; writeln ('At first, we will have to determine the name of the archive file(s).'); write ('The current standard pattern is '); textcolor (lightred); write (tars); textcolor (lightgray); writeln ('. If you want to change it enter'); writeln ('the new pattern now, or simply press the return key, if you don''t'); writeln ('want to change it. Please do not include any paths or drives here !'); writeln; write ('Name pattern : '); readln (s); if s='' then s:=tars; writeln; write ('Alright, it''s '); textcolor (lightred); write (s); textcolor (lightgray); writeln (' then.'); writeln; writeln ('Now we must generate a list of the contents of all archives. This'); writeln ('will take most of the installation time. Note that the TAR program'); writeln ('cannot be interrupted with ^C. So PLEASE BE PATIENT!'); writeln; doserror:=0; j:=0; assign (tc,'olga.cfg'); rewrite (tc); { create config file } writeln (tc,'; Configuration file for the OLGA archive browser software.'); writeln (tc,'; Syntax : file_name first_character last_character.'); writeln (tc,'; Example: allpt1.tgz a d'); writeln (tc,'; means: There''s a file called allpt1.tgz, which contains all files beginning'); writeln (tc,'; with a through d.'); writeln (tc,'; Lines beginning with a ";" will be ignored as comment lines.'); findfirst (s,anyfile and not directory, sr); assign (ta,'all.idx'); rewrite (ta); while doserror=0 do begin inc (j); writeln ('Calling TAR to get an index list of ',sr.name,'...'); swapvectors; exec (GetEnv('COMSPEC'),'/C tar -tvf '+sr.name+' >idx'+itos(j)+'.idx'); swapvectors; writeln ('Processing index list...'); assign (ti,'idx'+itos(j)+'.idx'); reset (ti); read_in (ti,s); if (pos('can''t',s)=0) and (pos('error',s)=0) then begin read_in (ti,s); b:=s[1]; e:=s[1]; y:=1; while not eof (ti) do begin if (pos ('byte(s)',s)=0) and (pos ('symlink ',s)=0) and (pos ('lrwx',s)=0) then begin a:=s[1]; if a<e then if ord(e)-ord(a)>3 then begin writeln (tc,sr.name+' '+b+' '+e); b:=s[1]; e:=s[1]; end else if a<b then b:=a; if a>e then if ord(a)-ord(e)<3 then e:=a else begin writeln (tc,sr.name+' '+b+' '+e); b:=s[1]; e:=s[1]; end; writeln (ta,s); t:=s; end; inc(y); gotoxy (1,wherey); write ('Lines processed : ',y); read_in (ti,s); end; writeln; end; writeln (tc,sr.name+' '+b+' '+e); findnext (sr); close (ti); end; close (ta); writeln; writeln ('Trying to sort the index file...'); doserror:=0; swapvectors; exec (GetEnv('COMSPEC'),'/C sort! all.idx all.srt -xmode'); swapvectors; y:=doserror; basewin; doserror:=0; findfirst ('all.srt',anyfile and not directory, sr); if (doserror=0) and (y=0) then begin assign (ti,'all.idx'); erase (ti); assign (ti,'all.srt'); rename (ti,'all.idx'); writeln (tc,'*sorted*'); end else begin writeln ('Failed to sort the index file. You may use the "s" key while running OLGA'); writeln ('to sort the lists.'); end; close (tc); writeln; writeln ('Now cleaning up...'); for i:=1 to j do begin assign (ti,'idx'+itos(i)+'.idx'); erase (ti); end; writeln; write ('Should I remove install.exe, olgabr2.zip, sort!.exe and \src, too (y/n)?'); repeat c:=readkey; c:=upcase(c); until c in ['Y','N']; writeln; if c='Y' then begin {$I-} assign (ta,'setup.exe'); erase (ta); j:=ioresult; assign (ta,'olgabr2.zip'); erase (ta); j:=ioresult; assign (ta,'sort!.exe'); erase (ta); j:=ioresult; assign (ta,'rtm.exe'); erase (ta); j:=ioresult; assign (ta,'dpmi16bi.ovl'); erase (ta); j:=ioresult; chdir ('src'); j:=ioresult; {$I+} doserror:=0; findfirst ('*.*',anyfile and not directory,sr); while doserror=0 do begin assign (ta,sr.name); erase (ta); findnext (sr); end; if doserror=18 then begin {$I-} chdir ('..'); rmdir ('src'); j:=ioresult; {$I+} end; end; clrscr; writeln ('Okay, we''re nearly through. Just one thing: The index list is usually'); writeln ('quite long (>350 KB). We could compress it and so save about 1/2 MB of'); writeln ('permanent disk space. But that would mean you''ll have to wait about'); writeln ('10 more seconds everytime you call the OLGA browser. Decide, if you'); writeln ('have more time or more disk space to waste ;) :'); writeln; write ('Do you want the index file being compressed (y/n)? '); repeat c:=readkey; c:=upcase(c); until c in ['Y','N']; writeln (c); if c='Y' then begin writeln (#10+#13+'Compressing index list...'); swapvectors; exec (GetEnv('COMSPEC'),'/C tar.exe -cv.f all_idx.tgz all.idx>NUL'); swapvectors; doserror:=0; findfirst ('all_idx.tgz',anyfile and not directory, sr); if doserror<>0 then begin writeln ('Failed to compress the file. Alright, it''s not important.'); c:='N'; end; end; writeln; writeln ('Now creating batch file "olgabr.bat" for you to start with...'); assign (ta,'olgabr.bat'); rewrite (ta); writeln (ta,'@echo off'); if c='Y' then writeln (ta,'echo Uncompressing index file, wait please...'); if c='Y' then writeln (ta,'tar -xv.f all_idx.tgz all.idx'); writeln (ta,'olga.exe'); if c='Y' then writeln (ta,'del all.idx'); close (ta); if c='Y' then begin {$I-} assign (ta,'all.idx'); erase (ta); j:=ioresult {$I+} end; writeln; writeln ('That''s it. If everything went right you may now start the'); writeln ('browser program by typing "olgabr".'); writeln; writeln ('Press a key to end this program.'); c:=readkey; window (1,1,80,25); { restore normal screen conditions } textcolor (lightgray); textbackground (black); clrscr; end.