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

  1. {A+,B-,D-,E-,F-,I-,L-,N-,O-,R-,S+,V-}
  2. {$M 30000,5000,5000}
  3. {NOTE: This demo eats raw stack for breakfast! Keep it BIG...}
  4. {╔═════════════════════════════════════════════════════════════════════════╗
  5.  ║                                                                         ║
  6.  ║                   (c) CopyRight LiveSystems 1990, 1994                  ║
  7.  ║                                                                         ║
  8.  ║ Author    : Gerhard Hoogterp                                            ║
  9.  ║ FidoNet   : 2:282/100.5   2:283/7.33                                    ║
  10.  ║ BitNet    : GERHARD@LOIPON.WLINK.NL                                     ║
  11.  ║                                                                         ║
  12.  ║ SnailMail : Kremersmaten 108                                            ║
  13.  ║             7511 LC Enschede                                            ║
  14.  ║             The Netherlands                                             ║
  15.  ║                                                                         ║
  16.  ║        This module is part of the RADoor BBS doorwriters toolbox.       ║
  17.  ║                                                                         ║
  18.  ╚═════════════════════════════════════════════════════════════════════════╝}
  19. Program RASearchk;
  20. Uses DOS,
  21.      CRT,
  22.      BBSTypes,   { BBS detection routine                         }
  23.      UserHook,   { Demo/default userhook procedures              }
  24.      Language,   { The multilanguage support                     }
  25.      MLFilter,   { The default Multilanguage output filter       }
  26.      LowLevel,   { The lowlevel stuff                            }
  27.      DoorSys,    { Misc. Door routines.                          }
  28.      GlobInfo,   { the global record with all the nessecary info }
  29.      RA,         { The RA init code                              }
  30.      SuperBBS,   { The SBBS init Code                            }
  31.      QuickBBS,   { the QBBS init Code                            }
  32.      Fossil;     { The fossil routines + Timing. This is the     }
  33.                  {  body of the door!                            }
  34.  
  35. {----------------------------------------------------------------------------|
  36.   The name and the version of the program together with the FossilObject
  37.   variable which every door needs.
  38. |----------------------------------------------------------------------------}
  39.  
  40.  
  41. Const  ProgramName    = 'RA-Search';
  42.        ProgramVersion = '2.0';
  43.        LastUpdate     = '09 Oct 1991';
  44.        ProgName       = 'RASEARCH';
  45.  
  46. Var Foss       : FossilObject;
  47.     Slang      : String[3];
  48.  
  49.  
  50. {----------------------------------------------------------------------------|
  51.  Start here your own variables, procedures and functions.
  52. |----------------------------------------------------------------------------}
  53.  
  54. Type Str12     = String[12];
  55.  
  56. Var Path       : ComStr;
  57.     Name       : Str12;
  58.     Dir        : String[4];
  59.  
  60.     Drives     : String[20];
  61.     DriveCount : Byte;
  62.  
  63.     Dum        : Char;
  64.     Lines      : Byte;
  65.     Stop       : Boolean;
  66.  
  67.  
  68. Procedure SearchDir(Dir : ComStr;FileSpec : Str12);
  69. Var Search : SearchRec;
  70. Begin
  71. CompletePath(Dir);
  72. FindFirst(Dir+FileSpec,AnyFile,Search);
  73. While (Not Stop) And (DosError=0) Do
  74.  Begin
  75.  If Not Foss.Carrier
  76.     Then Exit;
  77.  
  78.  If (Search.Attr And Archive)=Archive
  79.     Then Begin
  80.          Foss.WriteLnF(Dir+Search.Name);
  81.          Inc(Lines);
  82.          End;
  83.  
  84.  If (GlobalInfo.UseMoreYN) And
  85.     (Lines=(GlobalInfo.ScreenLength-2))
  86.     Then Begin
  87.          Foss.WriteLnF('');
  88.          Stop:=Foss.PressEnterOrStop;
  89.          If Not Stop
  90.             Then Begin
  91.                  Foss.ClrScrF;
  92.                  Foss.WriteLnF('^4^!'+Center(ExpandString(']100]102'+Drives[Drivecount]+']103]101'))+'^0');
  93.                  Foss.WriteLnF('');
  94.                  Lines:=4;
  95.                  End;
  96.          End;
  97.  FindNext(Search);
  98.  End;
  99.  
  100. FindFirst(Dir+'*.*',Directory,Search);
  101. While (Not Stop) And (DosError=0) Do
  102.  Begin
  103.  If Not Foss.Carrier
  104.     Then Exit;
  105.  
  106.  If ((Search.Attr And Directory)=Directory) And
  107.     (Search.Name[1]<> '.')
  108.     Then SearchDir(Dir+Search.Name,FileSpec);
  109.  FindNext(Search);
  110.  End;
  111. End;
  112.  
  113. {----------------------------------------------------------------------------|
  114.  Start of main module
  115. |----------------------------------------------------------------------------}
  116. Begin
  117.  
  118. WriteLn(ProgramName,' ',ProgramVersion,' (c) LiveSystems 1990,1991  ALL RIGHTS RESERVED, NO GUARANTEES');
  119. WriteLn('Written by G.Hoogterp. E-mail address 2:283/1.2 Last Revision '+LastUpdate);
  120. WriteLn('Use <FileName> -? to see commandline parameter summary.');
  121.  
  122. If ExistParameter('?')
  123.    Then Begin
  124.         WriteLn('Usage: ');
  125.         WriteLn;
  126.         WriteLn(' <PATH>RASEARCH.EXE [-T:<TimeLimit>] [-N:*N] [-P:*P] [-NOS]');
  127.         WriteLn('                    -DRIVES:<DriveChars>');
  128.         WriteLn;
  129.         WriteLn(' -T:      Limit the time available in the door.');
  130.         WriteLn(' -N:      Give nodenumber for multiline setups.');
  131.         WriteLn(' -P:      Give ComPort to use.');
  132.         WriteLn(' -NOS     Turn local sounds OFF for default.');
  133.         WriteLn(' -DRIVES: Specify the drives to search. Only the chars!');
  134.         WriteLn('          f.e. -DRIVES:CDE');
  135.         Halt;
  136.         End;
  137.  
  138. { The parameters mentioned here are read in the RA.PAS unit as they are more
  139.   or less RA dependend and the result has to be stuffed into the global info
  140.   record. }
  141.  
  142. {----------------------------------------------------------------------------|
  143.  Grab the BBS specific stuff into the GlobalInfo record
  144. |----------------------------------------------------------------------------}
  145.  
  146. Case CurrentBBStype Of
  147.  RA_BBS : InitRA;
  148.  S_BBS  : InitSBBS;
  149.  Q_BBS  : InitQBBS;
  150. End;
  151.  
  152. {----------------------------------------------------------------------------|
  153.  Check for the language info..
  154. |----------------------------------------------------------------------------}
  155.  
  156. Slang:=GlobalInfo.Language;
  157.  
  158. If Not ExistFile(GlobalInfo.HomeDir+ProgName+'.'+Slang)
  159.    Then Begin
  160.         If Not ExistFile(GlobalInfo.HomeDir+ProgName+'.ENG')
  161.            Then Begin
  162.                 LogIt('Couldn''t find language file..');
  163.                 WriteLn(#254' Couldn''t find language file..');
  164.                 Halt;
  165.                 End
  166.            Else Slang:='ENG';
  167.         End;
  168.  
  169.  
  170. {----------------------------------------------------------------------------|
  171.  And let the LOGfile know who's talking.
  172. |----------------------------------------------------------------------------}
  173.  
  174. LogIt('Started: '+ProgramName+' '+ProgramVersion+' under '+GlobalInfo.BBSName);
  175.  
  176. {----------------------------------------------------------------------------|
  177.   Initialize the userhooks, Timeout detection etc.
  178. |----------------------------------------------------------------------------}
  179.  
  180. With GlobalInfo Do
  181.  Begin
  182.  Foss.AssignF(ComPort-1,BaudRate);   { Inti the fossil }
  183.  If Foss.Error<>0
  184.     Then Begin
  185.          WriteLn(#254' Couldn''t initialize fossil!');
  186.          LogIt('Couldn''t init fossil!');
  187.          Halt;
  188.          End;
  189.  
  190.  Foss.InitTimer(    { Init the timeout procedures              }
  191.                 GlobalInfo.Warnings,   { Warning before pushed back to the BBS    }
  192.                 GlobalInfo.TimeOutTime { Timeout time before and between warnings }
  193.                 );
  194.  
  195.  
  196.  Foss.InitOutputFilter(UsedFilter); { Set the output filter            }
  197.  Foss.InitInputFilter(FileCharSet);  { Set the input filter for ReadLnF }
  198.  
  199.  Foss.InitSysopKeys(SysopKeys);     { Set the SYSOP keys procedure     }
  200.  Foss.InitStatLine(StatusLine);     { Set the statusline procedure     }
  201.  
  202.  { Initialize the output filter using the info in the GlobalInfo record}
  203.  
  204.  InitUsedFilter(UseGraphics,UseAVATAR,GlobalInfo.HomeDir+ProgName+'.'+Slang,'^');
  205.  End;
  206.  
  207.  
  208. { Copy the colors as defined in the language support. I Use a move since the
  209.   two array's aren't defined using the same TYPE definition }
  210.  
  211. Move(Specials.Colors,ColorTable,10);
  212.  
  213. PressEnterString       := ']001';
  214. PressEnterOrStopString := ']002';
  215. Warning1String         := ']004';
  216. Warning2String         := ']005';
  217. AttentionString        := ']006';
  218. LockOutString          := ']007';
  219. HangUpString           := ']008';
  220. TimeUpString           := ']009';
  221. UsedStopKey            := Specials.StopDef;
  222.  
  223. {----------------------------------------------------------------------------|
  224.   The mainbody of the DOOR goes here.
  225. |----------------------------------------------------------------------------}
  226.  
  227. Drives:=UpStr(GrabParameter('DRIVES:'));
  228.  
  229. Foss.ClrScrF;
  230. Foss.WriteLnF('^4^!'+
  231.               Center(']100LiveSystems '+
  232.               ProgramName+' '+
  233.               ProgramVersion+']101')+
  234.               '^0');
  235. Foss.WriteLnF('');
  236.  
  237. Name:='';
  238. Foss.WriteF(']104');
  239. Foss.ReadLnF(Name,12);
  240. If Name<>''
  241.    Then Begin
  242.         LogIt('User Searches drive(s) '+Drives+' for '+Name);
  243.  
  244.         DriveCount:=1;
  245.         Dum:=#00;
  246.  
  247.         Stop:=False;
  248.  
  249.         While (DriveCount<=Length(Drives)) And (Not Stop) Do
  250.           Begin
  251.           Lines:=4;
  252.           Foss.ClrScrF;
  253.           Foss.WriteLnF('^4^!'+Center(ExpandString(']100]102'+Drives[Drivecount]+']103]101'))+'^0');
  254.           Foss.WriteLnF('');
  255.           SearchDir(Drives[DriveCount]+':\',Name);
  256.  
  257.           Foss.WriteLnF('');
  258.           Foss.PressEnter;
  259.           Inc(DriveCount);
  260.           End;
  261.           End;
  262.  
  263. {----------------------------------------------------------------------------|
  264.   Finalize the DOOR and say a nice thank you to the user for spending his
  265.   online time and money on your door..
  266. |----------------------------------------------------------------------------}
  267.  
  268. Case GlobalInfo.BBSTag Of
  269.  RABBS : If Not RAUpdateExitInfo
  270.             Then LogIt('Couldn''t update the EXITINFO.BBS!');
  271.  SBBS  : If Not SBBSUpdateExitInfo
  272.             Then LogIt('Couldn''t update the EXITINFO.BBS!');
  273.  QBBS  : If Not QBBSUpdateExitInfo
  274.             Then LogIt('Couldn''t update the EXITINFO.BBS!');
  275.  
  276. End;
  277.  
  278. Foss.ClrScrF;  { Clear the screen }
  279. Foss.WriteLnF(']010'+ProgramName+'.');
  280.  
  281. {----------------------------------------------------------------------------|
  282.   Tell the LogFile that we're finished. Gives the fossil some extra time
  283.   to get the ThankYou out of it's mouth....
  284. |----------------------------------------------------------------------------}
  285.  
  286. LogIt('Stopped: '+ProgramName+' '+ProgramVersion);
  287.  
  288. {----------------------------------------------------------------------------|
  289.  And close the fossil again..
  290. |----------------------------------------------------------------------------}
  291.  
  292. Foss.CloseF;
  293. End.
  294.  
  295. {----------------------------------------------------------------------------|
  296.    And that's it! That's all.. I can't make things simpler..
  297.    Oh well, actualy I could, but not without giving up flexability and
  298.    usability.....
  299. |----------------------------------------------------------------------------}
  300.