home *** CD-ROM | disk | FTP | other *** search
- (*
-
- The most important variable to initialize is ONLINE. You can decide
- if the person is online, or it's local dependent on what the commandline
- options are or whatever method you use, but this variable HAS to be
- set correctly, or nothing will work!!
-
- Usage: DEMODOOR Path Port Baud Ansi
-
- Path - use *0 for RA in optional data
- Port - use *P for RA in optional data
- Baud - use *B for RA in optional data, 0 indicates local login.
- Ansi - use *G for RA in optional data, 0-ascii,1-ansi.
-
- *)
-
-
- uses
- dos,
- eco_door, eco_lib
-
- ;
-
-
-
- var
- path : string; { hold the path we want a dir of }
- totalsize : longint; { total size of all files in directory }
- totalnum : word; { total number of files in directory }
-
- procedure getcommand; { see above for explanation of parameters}
- var
- d : searchrec;
- baud : word;
- code : integer;
- ans : byte;
-
- procedure help;
- begin
- writeln('Usage: ', __progname, ' Path Port Baud Ansi');
- writeln;
- writeln('Path - use *0 for RA in optional data');
- writeln('Port - use *P for RA in optional data');
- writeln('Baud - use *B for RA in optional data, 0 indicates local login.');
- writeln('Ansi - use *G for RA in optional data, 0-ascii,1-ansi');
- halt;
- end;
-
- begin
- if paramcount < 4 then help;
- path := paramstr(1);
- val(paramstr(2),port,code);
- if code <> 0 then help;
- dec(port); {ra returns 1-4, so dec by 1}
- val(paramstr(3),baud,code);
- if code <> 0 then help;
- online := baud > 0;
- val(paramstr(4),ans,code);
- if code <> 0 then help;
- user.ansi := ans = 1;
- if path[length(path)] = '\' then delete(path,length(path),1);
- findfirst(path,$3f,d); {let's check if they enter a path other than file...}
- if doserror <> 0 then help;
- if d.attr = $10 then path := path+'\*.*';
- end;
-
-
-
- procedure getdirectory;
- {
- We initialized the line counter, so after 24 lines, the user
- will be prompted for more...therefore our loop will say:
- while (doserror = 0) and (not stop) do
- begin etc...
- stop is a boolean that is false until user says no to more prompt
- }
- var d: searchrec;
-
- function formattime(time: longint): string;
- var dt: datetime;
- begin
- unpacktime(time,dt);
- with dt do formattime :=
- lz(month)+'-'+lz(day)+'-'+ms(year mod 100)+' '+lz(hour)+':'+lz(min);
- {year mod 100 will return the last 2 digits...just what we want!}
- end;
-
- begin
- totalsize := 0;
- totalnum := 0;
-
- findfirst(path,$3f,d);
- while (doserror = 0) and (not stop) do begin
- inc(totalnum);
- send(d.name+rep(#32,13-length(d.name)));
- if d.attr = $10 then send('<DIR> ') else send(
- rep(#32,9-length(ms(d.size)))+ms(d.size)
- );
- sendln(' '+formattime(d.time));
- inc(totalsize,d.size);
- findnext(d);
- end;
- end;
-
-
-
- procedure displaycredits;
- begin
- clrportscr; {first let's clear screen, so it's not a mess!}
- portcolor(14);
- sendln(__progname + ', The first directory program for ONLINE!');
- sendln('(C) MCMXCIII by UltiHouse Software, All Rights Reserved.');
- sendln('');
- send('Directory of: ');
- portcolor(15);
- sendln(uprcase(path));
- sendln('');
- end;
-
-
-
- procedure displaytrailingstuff;
- {
- The line counter initializes STOP to TRUE if the person said NO, so
- "more y/n", so and it might occur in this proc depending on the
- number of file names, and if STOP = true, then we want it to stop
- right??
- }
-
- begin
- portcolor(14);
- if not stop then sendln('');
- if not stop then send(rep(#32,8-length(ms(totalnum)))+ms(totalnum)+' file(s)');
- if not stop then sendln(rep(#32,11-length(ms(totalsize)))+ms(totalsize)+' bytes');
- if not stop then sendln(rep(#32,27-length(ms(diskfree(0))))+ms(diskfree(0))+' bytes free');
- end;
-
-
-
- procedure waitenter;
- var ch: char;
- begin
- portcolor(11);
- send('Press RETURN to continue...');
- ch := waitchar([#13]);
- end;
-
-
- begin
- online := false;
- user.ansi := true; {these are default values that will be changed later}
- port := 0;
-
- resetcounter(24,7);
- { reset the line counter to trigger after 24 lines, and use prompt color 7 }
- getcommand;
- displaycredits;
- getcommand;
- getdirectory;
- displaytrailingstuff;
- waitenter;
- end.
-