{ GETFREE.PAS Copyright (c) TrSek alias Zdeno Sekerak } { Program spocita velkost zozipovanych suborov tak, ze rozbali } { ich hlavicky a spocita cisla na pozicii kde je velkost suboru. } { Vytvara pritom subor temporary vyh.$$$. } { } { Datum:07.10.1994 http://www.trsek.com } {$M 21192,0,55360} program vrat_velkost_zipov; uses crt,dos,trsek; var f:text; s:string; i:integer; size:longint; procedure chyba(i:integer); var ch:char; schyby:string; begin if i=0 then exit; Write('Nastala chyba cislo ', i, ': ' ); case i of 2:WriteLn('Nenasiel som soubor.'); 3:WriteLn('Nenasiel som cestu.'); 5:WriteLn('Zakazany pristup.'); 6:WriteLn('Neplatny deskriptor suboru.'); 8:WriteLn('Nedostatok pameti.'); 10:WriteLn('Neplatne prostredie.'); 11:WriteLn('Neplatny format.'); 18:WriteLn('Dalsie subory neexistuju.'); 94:WriteLn('Nemozem vytvorit subor na cielovom disku.'); 95:WriteLn('Malo miesta na disku pre instalaciu.'); 96:WriteLn('Nemozem vytvorit adresar na cielovom disku.'); else WriteLn('Tuto chybu nemam definovanu.'); end; halt(i); end; procedure prikaz(s:string); begin SwapVectors; Exec(GetEnv('COMSPEC'), '/C '+s); SwapVectors; if doserror<>0 then chyba(doserror); sound(250);delay(30);nosound; end; function size_zip(cesta:string):longint; var f:text; s:string; i:integer; velkost:longint; begin s:=cesta; prikaz('pkunzip '+s+' -v >vyh.$$$'); {$I-} assign(f,'vyh.$$$'); reset(f); {$I+} if ioresult<>0 then chyba(94); readln(f,s); while (not(eof(f))) do readln(f,s); close(f); prikaz('del vyh.$$$'); i:=1; while ((s[i] =' ') and (length(s)>i)) do i:=i+1; while ((s[i] in ['0'..'9']) and (length(s)>i)) do i:=i+1; s:=copy(s,1,i); val(s,velkost,i); while ((i>0) and (length(s)>0)) do begin delete(s,i,1); val(s,velkost,i); end; size_zip:=velkost; end; begin clrscr; writeln('Urcim velkost velkost zozipovanych suborov Software by TrSek'); write('Zadaj cestu so zipom :'); if(ParamCount < 1) then readln(s) else s:=ParamStr(1); size:=size_zip(s); writeln('Velkost rozipovanych suborov je:',size); end.