home *** CD-ROM | disk | FTP | other *** search
/ PC Online 1996 October / PCO_10.ISO / filesbbs / xphy2201.arj / EXTRACT.PAS next >
Encoding:
Pascal/Delphi Source File  |  1996-08-28  |  1.5 KB  |  84 lines

  1. Unit Extract;
  2.  
  3. INTERFACE
  4.  
  5. Uses dos;
  6.  
  7. FUNCTION GetLogPath(eintrag:string;wo:string):string;
  8.  
  9.  
  10. IMPLEMENTATION
  11.  
  12. FUNCTION Back(s:STRING):STRING;
  13. BEGIN
  14.   Back:=s;
  15.   IF (Length(s)>0) AND (s[Length(S)]<>'\') THEN
  16.     Back:=s+'\'
  17. END;
  18.  
  19. FUNCTION LTrim(St:STRING):STRING;
  20.  
  21.  Begin
  22.  WHILE (Length(St)>0) AND ( (St[1]=#32) OR (St[1]=#9) ) DO begin
  23.     Delete(St,1,1);
  24.   LTrim:=St;
  25.  end;
  26.   LTrim:=St;
  27.  end;
  28.  
  29. FUNCTION RTrim(St:STRING):STRING;
  30.  
  31.  Begin
  32.   WHILE (Length(St)>0) AND ( (St[Length(St)]=#32) OR (St[Length(St)]=#9) ) DO begin
  33.     Delete(St,Length(St),1);
  34.   RTrim:=St;
  35.  END;
  36.   RTRIM:=St;
  37. end;
  38.  
  39. FUNCTION  Trim(St:STRING):STRING;
  40.  
  41. BEGIN
  42.   Trim:=LTrim(RTrim(St));
  43. END;
  44.  
  45.  
  46. FUNCTION  UCase(St:STRING):STRING; {leicht modifiziert, es wird nur
  47.                                     bis zum '=' umgewandelt, spart
  48.                                     vielleicht noch eine Nanosekunde ;) }
  49. VAR
  50.   i : BYTE;
  51. BEGIN
  52.   FOR i:=1 TO pos('=',St) DO
  53.     St[i]:=UpCase(St[i]);
  54.   UCase:=St;
  55. END;
  56.  
  57. FUNCTION GetLogPath(eintrag:string;wo:string):string;
  58.  
  59.  VAR t:text;
  60.      found:boolean;
  61.      p:byte;
  62.      s:string;
  63.  
  64. BEGIN
  65.   found:=false;
  66.   assign(t,wo);
  67.   reset(t);
  68.   while not (eof(t) or (found=true)) do
  69.     begin
  70.     readln(t,s);
  71.     if not ( (pos('#',s)>0) or (pos('=',s)=0) ) then
  72.       if (pos(eintrag,ucase(s))>0) then
  73.       found:=true;
  74.     end;
  75.   close(t);
  76.   if found then
  77.     begin
  78.     p:=pos('=',s);
  79.     Delete(s,(p-(p-1)),p);
  80.     GetLogPath:=Back(Trim(s));
  81.     end
  82.   else GetLogPath:='\';
  83. end;
  84. END.