home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / RADOOR30.ZIP / SEARCH.ZIP / SEARCH.PAS < prev   
Encoding:
Pascal/Delphi Source File  |  1994-04-12  |  9.9 KB  |  298 lines

  1. {$A+,B-,D-,E-,F-,I-,L-,N-,O-,R-,S+,V-}
  2. {$M 20000,0,0}
  3. {╔═════════════════════════════════════════════════════════════════════════╗
  4.  ║                                                                         ║
  5.  ║                   (c) CopyRight LiveSystems 1990, 1994                  ║
  6.  ║                                                                         ║
  7.  ║ Author    : Gerhard Hoogterp                                            ║
  8.  ║ FidoNet   : 2:282/100.5   2:283/7.33                                    ║
  9.  ║ BitNet    : GERHARD@LOIPON.WLINK.NL                                     ║
  10.  ║                                                                         ║
  11.  ║ SnailMail : Kremersmaten 108                                            ║
  12.  ║             7511 LC Enschede                                            ║
  13.  ║             The Netherlands                                             ║
  14.  ║                                                                         ║
  15.  ║        This module is part of the RADoor BBS doorwriters toolbox.       ║
  16.  ║                                                                         ║
  17.  ╚═════════════════════════════════════════════════════════════════════════╝}
  18. Program RASearch;
  19. Uses DOS,
  20.      CRT,
  21.  
  22.      UOsys,      { UserOn support                                }
  23.      UserHook,   { Demo/default userhook procedures              }
  24.      GlobInfo,   { the global record with all the nessecary info }
  25.      DoorSys,    { Misc. Door routines.                          }
  26.      Fossil,     { The fossil routines + Timing etc.             }
  27.      Filter,     { The default output filter                     }
  28.      LowLevel,   { The lowlevel stuff                            }
  29.  
  30.      RA,         { The RA init code                              }
  31.      SuperBBS,   { The SBBS init code                            }
  32.      QuickBBS,   { The QBBS init code                            }
  33.  
  34.      BBStypes;   { check for the used BBS                        }
  35.  
  36.  
  37. Const  ProgramName    = 'Search';
  38.        ProgramVersion = '1.3';
  39.        LastUpdate     = '09 May 1992';
  40.  
  41. Var    Foss           : FossilObject;
  42.        DoIt           : UserDoesObject;
  43.  
  44. {----------------------------------------------------------------------------|
  45.  Start here your own procedures and functions
  46. |----------------------------------------------------------------------------}
  47.  
  48. Type Str12     = String[12];
  49.  
  50. Var Path       : ComStr;
  51.     Name       : Str12;
  52.     Dir        : String[4];
  53.  
  54.     Drives     : String[20];
  55.     DriveCount : Byte;
  56.     Found      : Word;
  57.  
  58.     Dum        : Char;
  59.     Lines      : Byte;
  60.     Stop       : Boolean;
  61.  
  62.  
  63. Procedure SearchDir(Dir : ComStr;FileSpec : Str12); { Recursive procedure }
  64. Var Search : SearchRec;
  65. Begin
  66. CompletePath(Dir);
  67. FindFirst(Dir+FileSpec,AnyFile,Search);
  68. While (Not Stop) And (DosError=0) Do
  69.  Begin
  70.  If Not Foss.Carrier
  71.     Then Exit;
  72.  
  73.  If (Search.Attr And Archive)=Archive
  74.     Then Begin
  75.          Foss.WriteLnF(Dir+Search.Name);
  76.          Inc(Found);
  77.          Inc(Lines);
  78.          End;
  79.  
  80.  If (GlobalInfo.UseMoreYN) And
  81.     (Lines=(GlobalInfo.ScreenLength-2))
  82.     Then Begin
  83.          Foss.WriteLnF('');
  84.          Stop:=Foss.PressEnterOrStop;
  85.          If Not Stop
  86.             Then Begin
  87.                  Foss.ClrScrF;
  88.                  Foss.WriteLnF('^4^!'+Center('-=( Searching drive '+Drives[Drivecount]+': )=-')+'^0');
  89.                  Foss.WriteLnF('');
  90.                  Lines:=4;
  91.                  End;
  92.          End;
  93.  FindNext(Search);
  94.  End;
  95.  
  96. FindFirst(Dir+'*.*',Directory,Search);
  97. While (Not Stop) And (DosError=0) Do
  98.  Begin
  99.  If Not Foss.Carrier
  100.     Then Exit;
  101.  
  102.  If ((Search.Attr And Directory)=Directory) And
  103.     (Search.Name[1]<> '.')
  104.     Then SearchDir(Dir+Search.Name,FileSpec);
  105.  FindNext(Search);
  106.  End;
  107. End;
  108.  
  109.  
  110. {----------------------------------------------------------------------------|
  111.  Start of main module
  112. |----------------------------------------------------------------------------}
  113. Begin
  114.  
  115. { Clear the local screen and show the copyright notice. }
  116.  
  117. ClrScr;
  118. WriteLn(ProgramName,' ',ProgramVersion,' (c) LiveSystems 1992,1993   ALL RIGHTS RESERVED,  NO GUARANTEES');
  119. WriteLn('Written by G.Hoogterp. E-mail address 2:283/1.2 Last Revision '+LastUpdate);
  120. WriteLn('Use SEARCH -? to see commandline parameter summary.');
  121.  
  122. If ExistParameter('?')  { Wana see the parameters? }
  123.    Then Begin
  124.         WriteLn('Usage: ');
  125.         WriteLn;
  126.         WriteLn(' SEARCH.EXE [-T:<TimeLimit>] [-N:*N] [-P:*P] [-NOS]');
  127.         WriteLn;
  128.         WriteLn(' -T:       Limit the time available in the door.');
  129.         WriteLn(' -N:       Give nodenumber for multiline setups.');
  130.         WriteLn(' -P:       Give ComPort to use.');
  131.         WriteLn(' -NOS      Turn local sounds OFF for default.');
  132.         WriteLn(' -DRIVES:  Which drives to search. F.e. -DRIVES:CDEF');
  133.         Halt;
  134.         End;
  135.  
  136. {----------------------------------------------------------------------------|
  137.  Grab the BBS specific stuff into the GlobalInfo record
  138. |----------------------------------------------------------------------------}
  139.  
  140. Case CurrentBBStype Of
  141.  RA_BBS : InitRA;
  142.  S_BBS  : InitSBBS;
  143.  Q_BBS  : InitQBBS;
  144. End;
  145.  
  146. { Anounce which program is running.. }
  147.  
  148. LogIt('Started: '+ProgramName+' '+ProgramVersion+' under '+GlobalInfo.BBSName);
  149.  
  150. { And tell the rest of the world too..;-) }
  151.  
  152. DoIt.Init('Is using LiveSystems File Search to find some files..');
  153. DoIt.SetIt;
  154.  
  155. { Ok, our own parameters... }
  156.  
  157. If ExistParameter('DRIVES:')
  158.    Then Drives:=GrabParameter('DRIVES:')
  159.    Else Begin
  160.         LogIt('Hmpz.. No DRIVES specification!');
  161.         Halt;
  162.         End;
  163.  
  164. {----------------------------------------------------------------------------|
  165.   Fossil initializations
  166. |----------------------------------------------------------------------------}
  167.  
  168. With GlobalInfo Do
  169.  Begin
  170.  Foss.AssignF(ComPort-1,BaudRate);
  171.  If Foss.Error<>0
  172.     Then Begin
  173.          WriteLn(#254' Couldn''t initialize fossil!');
  174.          LogIt('Couldn''t init fossil!');
  175.          Halt;
  176.          End;
  177.  
  178.  Foss.InitTimer(                        { Init the timeout procedures              }
  179.                 GlobalInfo.Warnings,    { Warning before pushed back to the BBS    }
  180.                 GlobalInfo.TimeOutTime  { Timeout time before and between warnings }
  181.                 );
  182.  
  183.  
  184.  Foss.InitOutputFilter(UsedFilter);
  185.  Foss.InitInputFilter(FileCharSet);
  186.  
  187.  Foss.InitSysopKeys(SysopKeys);
  188.  Foss.InitStatLine(StatusLine);
  189.  
  190.  InitUsedFilter(UseGraphics,UseAVATAR,LeftBracket,RightBracket,'^');
  191.  End;
  192.  
  193. { Language Strings }
  194.  
  195. PressEnterOrStopString := '^0Press ^[^1ENTER^0^] to continue, ^[^1S^0^] to Stop: ^2';
  196. PressEnterString       := '^0Press ^[^1ENTER^0^] to continue: ^2';
  197. Warning1String         := '^1^[You have only 2 minutes left!^]^0';
  198. Warning2String         := '^1^[You have only 1 minute left!^]^0';
  199. AttentionString        := 'HELLO???';
  200. LockOutString          := '^1You''ve been locked out of the system! Don''t call back..';
  201. HangUpString           := '^1The Sysop hungup the phone, call back an other time.';
  202. TimeUpString           := '^1Sorry, you reached your daily timelimit. Hope to see you back an other time.';
  203. UsedStopKey            := 'S';
  204.  
  205. { Color table }
  206.  
  207. ColorTable[0]:=LightCyan;           { Normal text color            }
  208. ColorTable[1]:=LightRed;            { Hotkey's and lines           }
  209. ColorTable[2]:=White;               { Userinput and info highlight }
  210. ColorTable[3]:=Yellow;              { Info                         }
  211. ColorTable[4]:=(Blue Shl 4)+White;  { Statusline color             }
  212. ColorTable[5]:=LightRed;            { Lines and frames             }
  213. ColorTable[6]:=(Red Shl 4)+White;   { Inputfields                  }
  214.  
  215.  
  216. {----------------------------------------------------------------------------|
  217.   The main program body.
  218. |----------------------------------------------------------------------------}
  219.  
  220. { first the header }
  221.  
  222. Foss.ClrScrF;
  223. Foss.WriteLnF('^4^!'+Center('-=( LiveSystems '+ProgramName+' '+ProgramVersion+' )=- ')+'^0');
  224. Foss.WriteLnF('');
  225.  
  226. { Ask for a file specification. }
  227.  
  228. Name:='';
  229. Foss.WriteF('^0Give a FileSpec: ^6');
  230. Foss.ReadLnF(Name,12);
  231. Foss.WriteF('^0');
  232.  
  233. { and if the spec isn't empty, search the drives... }
  234.  
  235. If Name<>''
  236.    Then Begin
  237.         LogIt('User Searches drive(s) '+Drives+' for '+Name);
  238.  
  239.         DriveCount:=1;
  240.         Dum:=#00;
  241.  
  242.         Stop:=False;
  243.  
  244.         While (DriveCount<=Length(Drives)) And (Not Stop) Do
  245.           Begin
  246.           Lines:=4;
  247.           Found:=0;
  248.  
  249.           { The FindFile header }
  250.  
  251.           Foss.ClrScrF;
  252.           Foss.WriteLnF('^4^!'+Center('-=( Searching drive '+Drives[Drivecount]+': )=-')+'^0');
  253.           Foss.WriteLnF('');
  254.           SearchDir(Drives[DriveCount]+':\',Name);
  255.  
  256.           If Found=0
  257.              Then Begin
  258.                   Foss.WriteLnF('');
  259.                   Foss.WriteLnF('^1'+Center('To bad.. Nothing found..')+'^0');
  260.                   Inc(Lines,2);
  261.                   End;
  262.  
  263.           While Lines <= GlobalInfo.ScreenLength Do
  264.            Begin
  265.            Foss.WriteLnF('');
  266.            Inc(Lines);
  267.            End;
  268.  
  269.           Stop:=Foss.PressEnterOrStop;
  270.           Inc(DriveCount);
  271.           End;
  272.  
  273.         End;
  274.  
  275. {----------------------------------------------------------------------------|
  276.    Say thank you, and finalize the program.
  277. |----------------------------------------------------------------------------}
  278.  
  279. Foss.ClrScrF;
  280. Foss.WriteLnF('Thanks for using '+ProgramName+' '+ProgramVersion);
  281. Delay(1000);
  282.  
  283. Case CurrentBBStype Of
  284.  RA_BBS : If Not RAUpdateExitInfo
  285.              Then LogIt('Couldn''t update the EXITINFO.BBS!');
  286.  S_BBS  : If Not SBBSUpdateExitInfo
  287.              Then LogIt('Couldn''t update the EXITINFO.BBS!');
  288.  Q_BBS  : If Not QBBSUpdateExitInfo
  289.              Then LogIt('Couldn''t update the EXITINFO.BBS!');
  290. End;
  291.  
  292. DoIt.ClearIt; { Clear the UserDoes string }
  293.  
  294.  
  295. LogIt('Stopped: '+ProgramName+' '+ProgramVersion);
  296. Foss.CloseF;
  297. End.
  298.