浏览代码

* fsearch should only find files

peter 21 年之前
父节点
当前提交
b0f94e46a7
共有 1 个文件被更改,包括 17 次插入13 次删除
  1. 17 13
      rtl/unix/unix.pp

+ 17 - 13
rtl/unix/unix.pp

@@ -33,11 +33,11 @@ Uses UnixUtil,BaseUnix;
 ********************}
 ********************}
 
 
 Const
 Const
-  P_IN  = 1;			// pipes (?)
+  P_IN  = 1;                    // pipes (?)
   P_OUT = 2;
   P_OUT = 2;
 
 
 Const
 Const
-  LOCK_SH = 1;			// flock constants ?
+  LOCK_SH = 1;                  // flock constants ?
   LOCK_EX = 2;
   LOCK_EX = 2;
   LOCK_UN = 8;
   LOCK_UN = 8;
   LOCK_NB = 4;
   LOCK_NB = 4;
@@ -140,7 +140,7 @@ Function AssignPipe  (var pipe_in,pipe_out:file):cint;
 Function PClose      (Var F:text) : cint;
 Function PClose      (Var F:text) : cint;
 Function PClose      (Var F:file) : cint;
 Function PClose      (Var F:file) : cint;
 Function POpen       (var F:text;const Prog:String;rw:char):cint;
 Function POpen       (var F:text;const Prog:String;rw:char):cint;
-Function POpen	     (var F:file;const Prog:String;rw:char):cint;
+Function POpen       (var F:file;const Prog:String;rw:char):cint;
 function AssignStream(Var StreamIn,Streamout:text;Const Prog:String) : cint;
 function AssignStream(Var StreamIn,Streamout:text;Const Prog:String) : cint;
 function AssignStream(var StreamIn, StreamOut, StreamErr: Text; const prog: String): cint;
 function AssignStream(var StreamIn, StreamOut, StreamErr: Text; const prog: String): cint;
 
 
@@ -178,7 +178,7 @@ const
 
 
 Function  FExpand  (Const Path: PathStr):PathStr;
 Function  FExpand  (Const Path: PathStr):PathStr;
 Function  FSearch  (const path:pathstr;dirlist:string):pathstr;
 Function  FSearch  (const path:pathstr;dirlist:string):pathstr;
-Function  Glob	   (Const path:pathstr):pglob;
+Function  Glob     (Const path:pathstr):pglob;
 Procedure Globfree (var p:pglob);
 Procedure Globfree (var p:pglob);
 
 
 procedure SigRaise (sig:integer);
 procedure SigRaise (sig:integer);
@@ -203,7 +203,7 @@ Uses Strings,Syscall;
 {$i filerec.inc}
 {$i filerec.inc}
 
 
 { Raw System calls are in Syscalls.inc}
 { Raw System calls are in Syscalls.inc}
-{$ifdef Linux}			// Linux has more "oldlinux" compability.
+{$ifdef Linux}                  // Linux has more "oldlinux" compability.
 {$i sysc11.inc}
 {$i sysc11.inc}
 {$else}
 {$else}
 {$i syscalls.inc}
 {$i syscalls.inc}
@@ -331,7 +331,7 @@ Function Execv(const path:pathstr;args:ppchar):cint;
   the current environment is passed on.
   the current environment is passed on.
 }
 }
 begin
 begin
-  Execv:=fpExecve(path,args,envp); 
+  Execv:=fpExecve(path,args,envp);
 end;
 end;
 
 
 Function Execvp(Path:Pathstr;Args:ppchar;Ep:ppchar):cint;
 Function Execvp(Path:Pathstr;Args:ppchar;Ep:ppchar):cint;
@@ -481,7 +481,7 @@ begin
      fpExit(127);  // was Exit(127)
      fpExit(127);  // was Exit(127)
    end
    end
   else if (pid<>-1) then // Successfull started
   else if (pid<>-1) then // Successfull started
-   Shell:=WaitProcess(pid) 
+   Shell:=WaitProcess(pid)
   else // no success
   else // no success
    Shell:=-1; // indicate an error
    Shell:=-1; // indicate an error
   FreeShellArgV(p);
   FreeShellArgV(p);
@@ -503,7 +503,7 @@ begin { Changes as above }
      fpExit(127); // was exit(127)!! We must exit the Process, not the function
      fpExit(127); // was exit(127)!! We must exit the Process, not the function
    end
    end
   else if (pid<>-1) then // Successfull started
   else if (pid<>-1) then // Successfull started
-   Shell:=WaitProcess(pid) 
+   Shell:=WaitProcess(pid)
   else // no success
   else // no success
    Shell:=-1;
    Shell:=-1;
   FreeShellArgV(p);
   FreeShellArgV(p);
@@ -755,8 +755,8 @@ begin
       end;
       end;
     fminput : Begin
     fminput : Begin
                 textrec(f).bufend:=fpread(textrec(f).handle,pchar(textrec(f).bufptr),textrec(f).bufsize);
                 textrec(f).bufend:=fpread(textrec(f).handle,pchar(textrec(f).bufptr),textrec(f).bufsize);
-		IOPipe:=textrec(f).bufend;
-	      End;
+                IOPipe:=textrec(f).bufend;
+              End;
   end;
   end;
   textrec(f).bufpos:=0;
   textrec(f).bufpos:=0;
 end;
 end;
@@ -810,7 +810,7 @@ Function AssignPipe(var pipe_in,pipe_out:file):cint;
 {
 {
   Sets up a pair of file variables, which act as a pipe. The first one can
   Sets up a pair of file variables, which act as a pipe. The first one can
   be read from, the second one can be written to.
   be read from, the second one can be written to.
-  If the operation was unsuccesful, 
+  If the operation was unsuccesful,
 }
 }
 var
 var
   f_in,f_out : cint;
   f_in,f_out : cint;
@@ -1268,7 +1268,8 @@ Begin
         NewDir:=NewDir+'/';
         NewDir:=NewDir+'/';
        NewDir:=NewDir+Path;
        NewDir:=NewDir+Path;
        Delete(DirList,1,p1);
        Delete(DirList,1,p1);
-       if FpStat(NewDir,Info)>=0 then
+       if (FpStat(NewDir,Info)>=0) and
+          (not fpS_ISDIR(Info.st_Mode)) then
         Begin
         Begin
           If Pos('./',NewDir)=1 Then
           If Pos('./',NewDir)=1 Then
            Delete(NewDir,1,2);
            Delete(NewDir,1,2);
@@ -1380,7 +1381,10 @@ End.
 
 
 {
 {
   $Log$
   $Log$
-  Revision 1.51  2003-11-19 17:11:40  marco
+  Revision 1.52  2003-12-08 17:16:30  peter
+    * fsearch should only find files
+
+  Revision 1.51  2003/11/19 17:11:40  marco
    * termio unit
    * termio unit
 
 
   Revision 1.50  2003/11/19 10:54:32  marco
   Revision 1.50  2003/11/19 10:54:32  marco