home *** CD-ROM | disk | FTP | other *** search
- {$I-,S-}
- {$M 8192,8192,655360}
- PROGRAM
- {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
- {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
- {}{}{}{} {}{}{}{}
- {}{}{}{} THE_ULTIMATE_DIRECTORY {}{}{}{}
- {}{}{}{} {}{}{}{}
- {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
- {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
- ;
- Uses Dos,crt;
-
- const
- MaxFiles =1024; {max # of files in any directory}
-
- MonthStr: array[1..12] of string[3] = (
- 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
- 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
-
- subtotals:boolean={false}true;
- paged :boolean=false;
- depth :byte =23;
- clust_size:integer = 1024;
-
- type
- dirptr = ^dirrectype; {a pointer to a record of}
- dirrectype = record {directory names }
- dirname : pathstr;
- nextdir : dirptr; {a pointer to the next record}
- end;
-
- FilPtr = ^FilRec; {why not use just an array of}
- FilRec = record {records rather than an array of}
- Attr: Byte; {pointers to records? Well, I want}
- Time: Longint; {to use the DIRDEMO sort routines}
- Size: Longint; {and that program from Borland uses}
- Name: pathstr; {this structure,so...I used a simi-}
- ext : extstr; {data structure, but added one field}
- end;
- FileAra = array[0..MaxFiles - 1] of FilPtr;
-
- LessFunc= function(X, Y: FilPtr): Boolean;
-
- st5 = string[5];
- st12 = string[12];
- st64 = string[64];
-
- Var
- Files : FileAra;
-
- head ,
- cur : dirptr;
-
- dp : dirrectype;
-
- Less : LessFunc;
-
- Stop ,
- DoChg : boolean;
-
- curdir : st64;
-
- disp : byte;
- Fattr ,
- Filatr : word;
- count ,
- lncnt : integer;
- slack ,
- clusters,
- tot_clusters,
- tot_slack ,
- gr_tot_clusters,
- gr_tot_slack ,
- total ,
- totcount: longint;
- filepath: pathstr;
- mask : st12;
-
- {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
- {} {} {Converts an integer number to}
- {} function NumStr(N, D: Integer): String;{} {a string and pads on the left}
- {} {} {with 0's. }
- {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
-
- begin
- NumStr[0] := Chr(D);
- while D > 0 do
- begin
- NumStr[D] := Chr(N mod 10 + Ord('0'));
- N := N div 10;
- Dec(D);
- end;
- end;
-
- {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
- {} {} {Converts a longint to a string}
- {} function longst(N, D: Longint): String;{} {and pads on the left with blank}
- {} {} {spaces.}
- {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
-
- var LS : String;
- begin
- LS[0] := chr(D);
- while D > 0 do
- begin
- LS[D] := chr(N mod 10 + Ord('0'));
- N := N div 10;
- Dec(D);
- end;
- D:= 1;
- while Ls[D]='0' do
- begin
- Ls[D]:=' ';
- inc(D);
- end;
- Longst := LS;
- end;
-
- {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
- {} {}
- {} function attrstr(a:byte):st5;{} {Turns an attribute byte into a string}
- {} {}
- {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
-
- var attrib : st5;
- begin
- attrib:='.....';
- If a AND archive <> 0 then attrib[1] := 'A'; { If archive bit set }
- If a AND directory<> 0 then attrib[2] := 'D'; { If directory }
- If a AND sysfile <> 0 then attrib[3] := 'S'; { If system }
- If a AND hidden <> 0 then attrib[4] := 'H'; { If hidden }
- If a AND readonly <> 0 then attrib[5] := 'R'; { If read-only }
- attrstr:=attrib;
- end;
-
- {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
- {} {}
- {} Function GetKey : char; {} {replaces ReadKey, eliminates need for}
- {} {} {CRT.TPU}
- {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
-
- var ch : char;
- Begin
- Inline(
- $B4/$0C { MOV AH,$0C ;clear buffer}
- /$B0/$08 { MOV AL,8 ;get a char}
- /$CD/$21 {SPCL: INT $21 ;Call DOS}
- /$3C/$00 { CMP AL,0 ;If it's a 0 byte}
- /$75/$04 { JNZ CHRDY ;is spec., get second byte}
- /$B4/$08 { MOV AH,8 ;else set up for another}
- /$EB/$F6 { JMP SHORT SPCL ;and get it}
- /$88/$46/<CH {CHRDY: MOV <CH[BP],AL ;else put into function return}
- );
- GetKey := Ch;
- end; {Inline function GetKey}
-
-
- {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
- {} {} {Converts a set of date #s }
- {} function JDays(yy,mm,dd:word):longint; {} {to a julian day number. }
- {} {}
- {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
-
- var
- DayFromZero,
- LeapYearDays:longint;
- begin
-
- DayFromZero := ( 365 * yy ) + (31 * Pred(mm)) + Dd ;
- If mm > 2 then DayFromZero := DayFromZero - Trunc(0.4 * mm + 2.3)
- else if mm < 2 then dec(yy);
- LeapYearDays := (yy div 4) - (yy div 100)
- + (yy div 400) - (yy div 4000);
- JDays := DayFromZero + LeapYearDays ;
- end;
-
- (* THE FOLLOWING IS BORROWED FROM THE DIRDEMO.PAS PROGRAM FROM BORLAND *)
- (**) (**)
- (**) {$F+} (**)
- (**) function LessName(X, Y: FilPtr): Boolean; (**)
- (**) begin (**)
- (**) LessName := X^.Name < Y^.Name; (**)
- (**) end; (**)
- (**) function LessSize(X, Y: FilPtr): Boolean; (**)
- (**) begin (**)
- (**) LessSize := X^.Size < Y^.Size; (**)
- (**) end; (**)
- (**) function LessTime(X, Y: FilPtr): Boolean; (**)
- (**) begin (**)
- (**) LessTime := X^.Time > Y^.Time; (**)
- (**) end; (**)
- (**) function LessAttr(X, Y: FilPtr): Boolean; (**)
- (**) begin (**)
- (**) LessAttr := X^.Attr < Y^.Attr; (**)
- (**) end; (**)
- (**) function LessExt(X, Y: FilPtr): Boolean; (**)
- (**) begin (**)
- (**) LessExt := X^.Ext < Y^.Ext; (**)
- (**) end; (**)
- (**) {$F-} (**)
- (**) (**)
- (**) (**)
- (**) procedure QuickSort(L, R: Integer); (**)
- (**) var (**)
- (**) I, J: Integer; (**)
- (**) X, Y: FilPtr; (**)
- (**) begin (**)
- (**) I := L; (**)
- (**) J := R; (**)
- (**) X := Files[(L + R) div 2]; (**)
- (**) repeat (**)
- (**) while Less(Files[I], X) do Inc(I); (**)
- (**) while Less(X, Files[J]) do Dec(J); (**)
- (**) if I <= J then (**)
- (**) begin (**)
- (**) Y := Files[I]; (**)
- (**) Files[I] := Files[J]; (**)
- (**) Files[J] := Y; (**)
- (**) Inc(I); (**)
- (**) Dec(J); (**)
- (**) end; (**)
- (**) until I > J; (**)
- (**) if L < J then QuickSort(L, J); (**)
- (**) if I < R then QuickSort(I, R); (**)
- (**) end; (**)
- (**) (**)
- (**) procedure SortFiles; (**)
- (**) begin (**)
- (**) if (Count <> 0) and (@Less <> nil) then (**)
- (**) QuickSort(0, Count - 1); (**)
- (**) end; (**)
- (**) (**)
- (************************ END OF BORROWED CODE *************************)
-
- {}{}{}{}{}{}{}{}{}{}{}
- {} {}
- {} Procedure Usage; {} {Describes proper usage of switches to the user.}
- {} {}
- {}{}{}{}{}{}{}{}{}{}{}
- begin
- writeln(' +----------------------------------------------------------------------+');
- writeln(' |**** The Ultimate Directory Lister, ver 1.1 (c) FastAid Co.,1990-95***|');
- writeln(' +----------------------------------------------------------------------+');
- writeln('USAGE:');
- writeln('UDIR Path[!] [/A|H|R|S|D] [/n|e|s|t|a|u] [/P] [/T] [/[1|2|3|4|5|6] [/W|X|Y|Z]');
- writeln(' or: @parmfile where PARMFILE contains several sets of parameters');
- writeln('WHERE: ! = Stop the listing after the specified directory.');
- writeln(' /[A|H|R|S|D]=attribute.......................Default is ALL FILES');
- writeln(' /[n|e|s|t|a]=sort name,ext,size,time,attrib..Default is unsorted');
- writeln(' /[W|X|Y|Z]=cluster size:512,1024,2048,4096...Default is 1024');
- writeln(' /P = paging..................................Default is off');
- writeln(' /T = subtotals shown.........................Default is off');
- writeln(' /1 = FileSpec................................Default is "7"');
- writeln(' /2 = %1 FileSpec %2');
- writeln(' /3 = FileSpec + size');
- writeln(' /4 = FileSpec + size + cluster size +slack');
- writeln(' /5 = FileSpec + size + age');
- writeln(' /6 = FileSpec + size + date + time + attrib');
- writeln(' /7 = no FileSpec, directories and totals only');
- writeln(' /? = this screen');
- writeln;
- writeln(' FileSpecs are shown for specified directory and all ');
- writeln(' child directories. The default is the current directory.');
- writeln(' See : UDIR.DOC for examples and instructions on how to');
- write (' interpret the output.');
- halt(1);
- end;
-
- {}{}{}{}{}{}{}{}{}{}{}{}{}{}
- {} {}
- {} procedure testforpage; {} {Called after every writeln() to see if }
- {} {} {there's a need to pause the output. }
- {}{}{}{}{}{}{}{}{}{}{}{}{}{}
-
- var k:char;
- begin
- inc(lncnt);
- if (lncnt mod depth = 0) and paged {Normally, depth is 23, but for }
- then {HP110 it will be 14 for a 16 line}
- begin {screen.}
- write('---MORE---',^M);
- K := getkey;
- write(' ',^M);
- end;
- end;
-
- {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{This is needed because the specified}
- {} {}{directory must be forced into the }
- {}procedure initlist(dname : pathstr);{}{first place in the list. If the root}
- {} {}{directory is specified, that must be}
- {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{put in the list and kept as the first}
- {record in the list.}
- begin
- new(head); {initialize the list}
- head^.dirname := dname; {Put the beginning directory at the}
- head^.nextdir := NIL; {head of the list.}
- end;
-
- {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
- {} {}
- {} Procedure insert_in_list(var headptr:dirptr; FQName : string );{}
- {} {}
- {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
- var temp_ptr : dirptr; {Set up two more dirptrs.}
- search : dirptr;
- found : boolean;
-
- begin
- new(temp_ptr); {Put the directory name in the }
- temp_ptr^.dirname := FQName; {temp record. Set the pointer to }
- temp_ptr^.nextdir := nil; {nil.}
-
- search := headptr; {assign headptr to search(ptr) }
- if search = nil then headptr := temp_ptr
- else {NOW, if search is nil then assign}
- begin {temp_ptr to headptr. This takes }
- {care of the beginning of the list.}
- found := false;
- while (search <> nil) and not found do {OTHERWISE DO A LINEAR }
- if search^.dirname < FQName then {SEARCH!}
- begin
- cur := search;
- search := search^.nextdir;
- end
- else found := true;
- temp_ptr^.nextdir := search;
-
- if search = headptr then headptr := temp_ptr
- else cur^.nextdir := temp_ptr;
- end;
- end;
-
- {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
- {} {} {recursively, find all subdirectories}
- {} Procedure FindDirs(Dir : String);{} {but filter out the "." and ".." }
- {} {} {directories.}
- {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
- var
- sr : searchrec;
- begin
- If DoChg then FindFirst(dir+'*.*', AnyFile, sr);
- While DosError = 0 do
- begin
- If (sr.Attr = $10) and (sr.Name <> '.') and (sr.Name <> '..')
- then
- begin
- insert_in_list(head, dir+sr.Name+'\');
- DoChg := True;
- FindDirs(dir + sr.Name + '\');
- end;
- DoChg := False;
- FindNext(sr);
- end;
- end;
-
- {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
- {} {}
- {} procedure GetParms(var fpath:pathstr; var mask:st12); {}
- {} {}
- {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
- var
- I,J ,
- code: Integer;
- fspec,
- Parm: comStr;
- Dir : DirStr;
- Name: NameStr;
- Ext : ExtStr;
- Fl : File;
-
- begin
- @Less := nil; {start with no sorting as default}
- Fattr := 0; {start with no attributes set}
- disp := 7; {display format : just FQNs }
- fspec := '';
- subtotals:={false}true;
- paged := false;
- stop := false;
- mask := '*.*';
- fspec := curdir + '\';
- if fspec[4]='\' then delete(fspec,4,1);
- if paramcount > 0 then
- begin
- for I := 1 to ParamCount do {read in all the parameters}
- begin
- Parm := ParamStr(I);
- if (Parm[1] = '-') or (Parm[1]='/')
- then
- for J := 2 to Length(Parm) do
- case Parm[J] of
- 'e': Less := LessExt;
- 'n': Less := LessName;
- 's': Less := LessSize;
- 't': Less := LessTime;
- 'a': Less := LessAttr;
- 'A': fattr:= fattr or archive;
- 'H': fattr:= fattr or hidden;
- 'R': fattr:= fattr or readonly;
- 'S': fattr:= fattr or sysfile;
- 'D': fattr:= fattr or directory;
- '1'..
- '7': val(parm[J],disp,code);
- 'p',
- 'P': paged:= true;
- '?',
- 'h',
- 'H': usage;
- 'T': subtotals:=true;
- 'w',
- 'W': clust_size:= 512;
- 'x',
- 'X': clust_size:=1024;
- 'y',
- 'Y': clust_size:=2048;
- 'z',
- 'Z': clust_size:=4096;
- else begin
- WriteLn('Invalid option: ',Parm[1], Parm[J]);
- usage;
- Halt(1);
- end;
- end {case}
- else {a parameter with neither '/'nor'-'}
- begin
- fspec := parm;
- if parm = '' then fspec := curdir+'\';
- end;
- end;
- end; {we now have a filespec}
- {CHECK OUT THE FILESPEC}
- {IT COULD BE ANY OF THE FOLLOWING : \, \XXX, C:, C:\, C:\XXX,
- C:\*.* , C:*.PAS, C:\XXX\*.*,etc}
- {pick up FSpec from default or parm}
- if pos('!',FSpec)<>0 then
- begin
- delete(FSpec,pos('!',FSpec),1);
- stop := true;
- end;
- if FSpec[Length(Fspec)] <> '\' then
- begin {check for \ at end}
- Assign(Fl, FSpec);
- GetFAttr(Fl, FilAtr);
- if (DosError = 0) and (FilAtr and Directory <> 0) then
- Fspec := Fspec + '\'; {if it's a directory,add \ }
- end;
-
- FSpec := fexpand(FSpec); {first, get a complete filespec}
- fsplit (FSpec,Dir,Name,Ext); {then break it up into parts.}
-
- if (Dir[2]=':') and (Dir[1]<>curdir[1]) then
- begin {possible change of disk?}
- {$I-} chdir(Dir); {$I+}
- if ioresult <> 0 then
- begin
- writeln('Invalid path or drive ',copy(Dir,1,3),
- ' is not ready.');
- chdir(curdir);
- halt(1);
- end;
- end;
- if name = '' then name :='*.';
- if ext = '' then ext :='*';
- fpath := dir; mask := name+ext;
- if Fattr = 0 then Fattr := anyfile;
- {if no attributes specified,default to anyfiles.}
- end;
-
- {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
- {} {}
- {} procedure Format_And_Display_Files;{}
- {} {}
- {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
- var
- I, J, P: Integer;
- subtot : Longint;
- T : DateTime;
- N : pathStr;
- E : ExtStr;
- dot : string[1];
- prnbuff,
- padding, subtotstr: string;
- y,dy,m,
- DayOfWeek:word;
- CurrDay,
- FileDay,
- DifferenceInDays : LongInt;
-
- begin
- subtot := 0;
- tot_clusters:=0;
- tot_slack:=0;
-
- if disp = 5 then
- begin {Unpack the date and get currday,once}
- getdate(y,m,dy,dayofweek);
- Currday := JDays(y,m,dy);
- end;
-
- for I := 0 to Count-1 do
- with Files[I]^ do
- begin
- P := Pos('.', Name);
- if P > 1 then
- begin
- N := Copy(Name, 1, P -1);
- E := Copy(Name, P + 1, 3);
- dot:='.';
- end else
- begin
- N := Name;
- E := '';
- dot:=' ';
- end;
- prnbuff := '';
- padding := copy(' ',1,30-length(N+E));
- if disp in [1,3,4,5,6,7] {set up fully qualified filename}
- then prnbuff := prnbuff + N+dot+E;
-
- {add %1 and %2 for special case }
- if disp = 2 then prnbuff := '%1 '+N+dot+E+' %2';
-
- if disp in [3,4,5,6,7] then
- begin
- prnbuff := prnbuff + padding;
- if attr and directory <> 0 then
- prnbuff := prnbuff + ' <DIR>'
- else
- prnbuff := prnbuff + Longst(size,8);
- end;
-
- if disp =4 then
- begin
- clusters:= size div clust_size;
- slack := size mod clust_size;
- if slack > 0 then {compute the slack and adjust up}
- begin
- clusters:=clusters+1;
- slack:= clust_size-slack;
- end;
-
- prnbuff := prnbuff+longst(clusters,6)+'*'+longst(clust_size,4)
- +'= '+longst(clusters*clust_size,8)
- +longst(slack,8)+' loss';
- tot_clusters:=tot_clusters+clusters;
- tot_slack:=tot_slack+slack; {add to accumulators.}
- end;
-
-
-
-
- if disp =5 then {find the age of the file, in days.}
- begin
- unpacktime(time,T);
- if T.month=0 then T.month := 1;
- FileDay := JDays(T.Year,T.month,T.day);
-
- DifferenceInDays := (CurrDay - FileDay);
- if differenceInDays = 0 then
- prnbuff:=prnbuff+' TODAY''S DATE'
- else if DifferenceInDays < 0 then
- prnbuff:=prnbuff+' FUTURE DATE'
- else if differenceindays > 0 then
- prnbuff:=prnbuff+longst(DifferenceinDays,6)+' day(s) old';
- end;
-
- if disp = 6 then
- begin
- unpacktime(time,T);
- if T.month=0 then T.month := 1;
- prnbuff := prnbuff + longst(T.day,4)+'-'+monthstr[T.Month]+'-'+
- Longst(T.year mod 100,2)+
- longst(T.Hour,4)+':'+
- numstr(T.Min,2);
- prnbuff := prnbuff + ' '+attrstr(attr);
- end;
-
- if disp<>7 then writeln(prnbuff)
- {else
- if attr and directory <> 0 then
- begin
- prnbuff := prnbuff + ' <DIR>';
- writeln(prnbuff);
- testforpage;
- end};
- if disp<>7 then testforpage;
- Inc(subTot, Size);
-
- end;
-
- if (subtotals) and (count<>0) then
- begin
- if disp = 4 then
- begin
- writeln('# files ',count:3, subtot:28,tot_clusters:6,
- tot_clusters*clust_size:15,tot_slack:8,' loss');
- inc(gr_tot_clusters,tot_clusters);
- inc(gr_tot_slack, tot_slack);
- end
- else
- begin
- if disp=7 then
- begin
- {filesplit;}
- if subtot<0 then subtot:=0;
- write(cur^.dirname,' ');
- if wherex<50 then gotoxy(50,wherey);
- str(subTot:11,subtotstr);
- if subtot>999 then
- begin
- insert(',',subtotstr,9);
- delete(subtotstr,1,1);
- end;
- if subtot>999999 then
- begin
- insert(',',subtotstr,5);
- delete(subtotstr,1,1);
- end;
- writeln(Count:3,' files ',subtotstr,' bytes');
- end else
- WriteLn(Count:3, ' files, ', subTot:11, ' bytes ');
- end;
- inc(total, subtot);
- inc(totcount,count);
- testforpage;
- end;
- end;
-
- {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
- {} {}
- {} procedure run_thru_list; {}
- {} {}
- {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
- var sr : searchrec;
-
- procedure add_to_filist; {move(,,) means all the data to a}
- var p:byte;xt:extstr;
- begin {new memory location.}
- p := pos('.',sr.name);
- if p = 0 then xt := '' else xt := copy(sr.name,p+1,3);
- GetMem(files[Count], sizeof(files[count]^));
- {Get memory in the size of the }
- {variable files[count]^ and assign}
- {the pointer to the variable to the}
- {pointer variable files[count].}
-
- Move(sr.Attr, Files[Count]^, Length(sr.name) + 10);
- {Now look at the searchrec, "sr".}
- {move everything from the sr.attr}
- {field to files[count]^ up to and}
- {including the time, size, and the}
- {sr.name. Then modify the name field}
- {in files[count]^ and in }
- files[count]^.name := cur^.dirname+sr.name;
- files[count]^.ext := xt; {files[count]^.ext, directly.}
- Inc(Count);
- end;
-
- begin
- total:=0;
- totcount:=0;
- tot_clusters:=0; {initialize variables in the}
- tot_slack:=0; {procedure.}
- cur := head; {go to the head of the list}
-
- while cur <> NIL do {work thru the list until you hit NIL}
- begin
- count:=0;
- fillchar(files,sizeof(files),0);
- findfirst(cur^.dirname+mask, anyfile,sr);
- while (DosError = 0) and (Count < MaxFiles) do
- begin
- if ((fattr=anyfile) or (sr.attr and fattr<>0))
- and (sr.name <> '.')
- and (sr.name <> '..')
- and (sr.attr <> volumeID)
- and (sr.attr <> 15) {15 is attr of LFN junk in directory}
- {IF no attribute is selected then }
- {default is ALL files,even directories}
- then add_to_filist; {otherwise extract files with Fattr}
- {I want to extract all files with }
- {any of the attributes that have been}
- {set BUT no others. AND filter out the}
- {'.' and '..' files.}
- findnext(sr);
- end;
- if count <> 0 then
- begin
- sortfiles; {if sorting is chosen,sort only the}
- Format_And_Display_Files; {chosen files}
- end;
- if count<>0 then
- repeat
- dec(count);
- freemem(files[count],sizeof(files[count]^));
- until count=0;
- cur := cur^.nextdir;
- if stop then cur := NIL;
- end; {go to the next directory}
-
- if subtotals then
- if disp = 4 then
- writeln('TOTALS ',totcount:3, total:28,gr_tot_clusters:6,
- gr_tot_clusters*clust_size:15,
- (gr_tot_slack*100.0/total):8:2,' %loss')
- else
- writeln( TotCount:5,' files ',(total div 1024):27,' total Kbytes.');
- chdir(curdir);
- end;
-
- {}{}{}{}{}{}{}{}{}{}{}{}
- {} {}
- {} procedure GitNGo; {}
- {} {}
- {}{}{}{}{}{}{}{}{}{}{}{}
- begin
- GetParms(filepath,mask);
- initlist(filepath);
- FindDirs(filepath);
- run_thru_list;
- end;
-
- {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
- {} {}
- {} procedure input_from_file; {}
- {} {}
- {}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
- var inf : text;
- fn ,
- param: string;
- ioerr: byte;
-
- begin
- param := paramstr(1);
- if param[1] = '@' then
- begin
- fn := copy (paramstr (1),2,length (paramstr (1)));
- assign(inf,fn);
- {$I-} reset(inf);
- IOerr := IOResult; {$I+}
- if IOerr <> 0 then
- begin
- writeln('@file ',fn,' was not found.');
- halt;
- end
- else if IOerr = 0 then
- while( not eof(inf)) do
- begin
- readln(inf,string(ptr(prefixseg,$80)^)); {jam line into PSP}
- GitNGo;
- writeln;
- end;
- end
- else GitNGo {all by itself}
- end;
-
- {}{}{}{}{}{}{}{}{}{}
- {} {}
- {} procedure init;{}
- {} {}
- {}{}{}{}{}{}{}{}{}{}
-
- begin
- lncnt := 0;
- totcount := 0;
- gr_tot_clusters:=0;
- gr_tot_slack:=0; {initialize variables}
- getdir(0,curdir); {get current dir}
- DoChg := true;
- end;
-
-
- begin
- init;
- input_from_file;{?}
- end.
- (* REVISION HISTORY
- ver 0.50 released to public domain September 3, 1990
- ver 0.60 fixed inability of UDIR without parameters to run in the root
- directory. See lines 380-1. September 4, 1990
- ver 1.10 fixed heap overflow problem (lines 692-696); filtered out false
- directory entries in Win95 LFN structure. September 29, 1995
- *)
-