sysutils.pp 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1999-2000 by Florian Klaempfl
  5. member of the Free Pascal development team
  6. Sysutils unit for linux
  7. See the file COPYING.FPC, included in this distribution,
  8. for details about the copyright.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  12. **********************************************************************}
  13. unit sysutils;
  14. interface
  15. {$MODE objfpc}
  16. { force ansistrings }
  17. {$H+}
  18. {$DEFINE HAS_SLEEP}
  19. {$DEFINE HAS_OSERROR}
  20. uses
  21. Unix,errors,sysconst;
  22. { Include platform independent interface part }
  23. {$i sysutilh.inc}
  24. implementation
  25. Uses UnixUtil,Baseunix,UnixType;
  26. {$Define OS_FILEISREADONLY} // Specific implementation for Unix.
  27. { Include platform independent implementation part }
  28. {$i sysutils.inc}
  29. {****************************************************************************
  30. File Functions
  31. ****************************************************************************}
  32. Function FileOpen (Const FileName : string; Mode : Integer) : Longint;
  33. Var LinuxFlags : longint;
  34. BEGIN
  35. LinuxFlags:=0;
  36. Case (Mode and 3) of
  37. 0 : LinuxFlags:=LinuxFlags or O_RdOnly;
  38. 1 : LinuxFlags:=LinuxFlags or O_WrOnly;
  39. 2 : LinuxFlags:=LinuxFlags or O_RdWr;
  40. end;
  41. FileOpen:=fpOpen (FileName,LinuxFlags);
  42. //!! We need to set locking based on Mode !!
  43. end;
  44. Function FileCreate (Const FileName : String) : Longint;
  45. begin
  46. FileCreate:=fpOpen(FileName,O_RdWr or O_Creat or O_Trunc);
  47. end;
  48. Function FileCreate (Const FileName : String;Mode : Longint) : Longint;
  49. Var LinuxFlags : longint;
  50. BEGIN
  51. LinuxFlags:=0;
  52. Case (Mode and 3) of
  53. 0 : LinuxFlags:=LinuxFlags or O_RdOnly;
  54. 1 : LinuxFlags:=LinuxFlags or O_WrOnly;
  55. 2 : LinuxFlags:=LinuxFlags or O_RdWr;
  56. end;
  57. FileCreate:=fpOpen(FileName,LinuxFlags or O_Creat or O_Trunc);
  58. end;
  59. Function FileRead (Handle : Longint; Var Buffer; Count : longint) : Longint;
  60. begin
  61. FileRead:=fpRead (Handle,Buffer,Count);
  62. end;
  63. Function FileWrite (Handle : Longint; const Buffer; Count : Longint) : Longint;
  64. begin
  65. FileWrite:=fpWrite (Handle,Buffer,Count);
  66. end;
  67. Function FileSeek (Handle,FOffset,Origin : Longint) : Longint;
  68. begin
  69. FileSeek:=fplSeek (Handle,FOffset,Origin);
  70. end;
  71. Function FileSeek (Handle : Longint; FOffset,Origin : Int64) : Int64;
  72. begin
  73. {$warning need to add 64bit call }
  74. FileSeek:=fplSeek (Handle,FOffset,Origin);
  75. end;
  76. Procedure FileClose (Handle : Longint);
  77. begin
  78. fpclose(Handle);
  79. end;
  80. Function FileTruncate (Handle,Size: Longint) : boolean;
  81. begin
  82. FileTruncate:=fpftruncate(Handle,Size)>=0;
  83. end;
  84. Function UnixToWinAge(UnixAge : time_t): Longint;
  85. Var
  86. Y,M,D,hh,mm,ss : word;
  87. begin
  88. EpochToLocal(UnixAge,y,m,d,hh,mm,ss);
  89. Result:=DateTimeToFileDate(EncodeDate(y,m,d)+EncodeTime(hh,mm,ss,0));
  90. end;
  91. Function FileAge (Const FileName : String): Longint;
  92. Var Info : Stat;
  93. Y,M,D,hh,mm,ss : word;
  94. begin
  95. If fpstat (FileName,Info)<0 then
  96. exit(-1)
  97. else
  98. Result:=UnixToWinAge(info.st_mtime);
  99. end;
  100. Function FileExists (Const FileName : String) : Boolean;
  101. Var Info : Stat;
  102. begin
  103. FileExists:=fpstat(filename,Info)>=0;
  104. end;
  105. Function DirectoryExists (Const Directory : String) : Boolean;
  106. Var Info : Stat;
  107. begin
  108. DirectoryExists:=(fpstat(Directory,Info)>=0) and fpS_ISDIR(Info.st_mode);
  109. end;
  110. Function LinuxToWinAttr (FN : Pchar; Const Info : Stat) : Longint;
  111. begin
  112. Result:=faArchive;
  113. If fpS_ISDIR(Info.st_mode) then
  114. Result:=Result or faDirectory;
  115. If (FN[0]='.') and (not (FN[1] in [#0,'.'])) then
  116. Result:=Result or faHidden;
  117. If (Info.st_Mode and S_IWUSR)=0 Then
  118. Result:=Result or faReadOnly;
  119. If fpS_ISSOCK(Info.st_mode) or fpS_ISBLK(Info.st_mode) or fpS_ISCHR(Info.st_mode) or fpS_ISFIFO(Info.st_mode) Then
  120. Result:=Result or faSysFile;
  121. end;
  122. {
  123. GlobToSearch takes a glob entry, stats the file.
  124. The glob entry is removed.
  125. If FileAttributes match, the entry is reused
  126. }
  127. Type
  128. TGlobSearchRec = Record
  129. Path : String;
  130. GlobHandle : PGlob;
  131. end;
  132. PGlobSearchRec = ^TGlobSearchRec;
  133. Function GlobToTSearchRec (Var Info : TSearchRec) : Boolean;
  134. Var SInfo : Stat;
  135. p : Pglob;
  136. GlobSearchRec : PGlobSearchrec;
  137. begin
  138. GlobSearchRec:=Info.FindHandle;
  139. P:=GlobSearchRec^.GlobHandle;
  140. Result:=P<>Nil;
  141. If Result then
  142. begin
  143. GlobSearchRec^.GlobHandle:=P^.Next;
  144. Result:=Fpstat(GlobSearchRec^.Path+StrPas(p^.name),SInfo)>=0;
  145. If Result then
  146. begin
  147. Info.Attr:=LinuxToWinAttr(p^.name,SInfo);
  148. Result:=(Info.ExcludeAttr and Info.Attr)=0;
  149. If Result Then
  150. With Info do
  151. begin
  152. Attr:=Info.Attr;
  153. If P^.Name<>Nil then
  154. Name:=strpas(p^.name);
  155. Time:=UnixToWinAge(Sinfo.st_mtime);
  156. Size:=Sinfo.st_Size;
  157. end;
  158. end;
  159. P^.Next:=Nil;
  160. GlobFree(P);
  161. end;
  162. end;
  163. Function DoFind(Var Rslt : TSearchRec) : Longint;
  164. Var
  165. GlobSearchRec : PGlobSearchRec;
  166. begin
  167. Result:=-1;
  168. GlobSearchRec:=Rslt.FindHandle;
  169. If (GlobSearchRec^.GlobHandle<>Nil) then
  170. While (GlobSearchRec^.GlobHandle<>Nil) and not (Result=0) do
  171. If GlobToTSearchRec(Rslt) Then Result:=0;
  172. end;
  173. Function FindFirst (Const Path : String; Attr : Longint; Var Rslt : TSearchRec) : Longint;
  174. Var
  175. GlobSearchRec : PGlobSearchRec;
  176. begin
  177. New(GlobSearchRec);
  178. GlobSearchRec^.Path:=ExpandFileName(ExtractFilePath(Path));
  179. GlobSearchRec^.GlobHandle:=Glob(Path);
  180. Rslt.ExcludeAttr:=Not Attr and (faHidden or faSysFile or faVolumeID or faDirectory); //!! Not correct !!
  181. Rslt.FindHandle:=GlobSearchRec;
  182. Result:=DoFind (Rslt);
  183. end;
  184. Function FindNext (Var Rslt : TSearchRec) : Longint;
  185. begin
  186. Result:=DoFind (Rslt);
  187. end;
  188. Procedure FindClose (Var F : TSearchrec);
  189. Var
  190. GlobSearchRec : PGlobSearchRec;
  191. begin
  192. GlobSearchRec:=F.FindHandle;
  193. GlobFree (GlobSearchRec^.GlobHandle);
  194. Dispose(GlobSearchRec);
  195. end;
  196. Function FileGetDate (Handle : Longint) : Longint;
  197. Var Info : Stat;
  198. begin
  199. If (fpFStat(Handle,Info))<0 then
  200. Result:=-1
  201. else
  202. Result:=Info.st_Mtime;
  203. end;
  204. Function FileSetDate (Handle,Age : Longint) : Longint;
  205. begin
  206. // Impossible under Linux from FileHandle !!
  207. FileSetDate:=-1;
  208. end;
  209. Function FileGetAttr (Const FileName : String) : Longint;
  210. Var Info : Stat;
  211. begin
  212. If FpStat (FileName,Info)<0 then
  213. Result:=-1
  214. Else
  215. Result:=LinuxToWinAttr(Pchar(FileName),Info);
  216. end;
  217. Function FileSetAttr (Const Filename : String; Attr: longint) : Longint;
  218. begin
  219. Result:=-1;
  220. end;
  221. Function DeleteFile (Const FileName : String) : Boolean;
  222. begin
  223. Result:=fpUnLink (FileName)>=0;
  224. end;
  225. Function RenameFile (Const OldName, NewName : String) : Boolean;
  226. begin
  227. RenameFile:=BaseUnix.FpRename(OldNAme,NewName)>=0;
  228. end;
  229. Function FileIsReadOnly(const FileName: String): Boolean;
  230. begin
  231. Result := fpAccess(PChar(FileName),W_OK)<>0;
  232. end;
  233. {****************************************************************************
  234. Disk Functions
  235. ****************************************************************************}
  236. {
  237. The Diskfree and Disksize functions need a file on the specified drive, since this
  238. is required for the statfs system call.
  239. These filenames are set in drivestr[0..26], and have been preset to :
  240. 0 - '.' (default drive - hence current dir is ok.)
  241. 1 - '/fd0/.' (floppy drive 1 - should be adapted to local system )
  242. 2 - '/fd1/.' (floppy drive 2 - should be adapted to local system )
  243. 3 - '/' (C: equivalent of dos is the root partition)
  244. 4..26 (can be set by you're own applications)
  245. ! Use AddDisk() to Add new drives !
  246. They both return -1 when a failure occurs.
  247. }
  248. Const
  249. FixDriveStr : array[0..3] of pchar=(
  250. '.',
  251. '/fd0/.',
  252. '/fd1/.',
  253. '/.'
  254. );
  255. var
  256. Drives : byte;
  257. DriveStr : array[4..26] of pchar;
  258. Procedure AddDisk(const path:string);
  259. begin
  260. if not (DriveStr[Drives]=nil) then
  261. FreeMem(DriveStr[Drives],StrLen(DriveStr[Drives])+1);
  262. GetMem(DriveStr[Drives],length(Path)+1);
  263. StrPCopy(DriveStr[Drives],path);
  264. inc(Drives);
  265. if Drives>26 then
  266. Drives:=4;
  267. end;
  268. Function DiskFree(Drive: Byte): int64;
  269. var
  270. fs : tstatfs;
  271. Begin
  272. if ((Drive<4) and (not (fixdrivestr[Drive]=nil)) and (statfs(StrPas(fixdrivestr[drive]),fs)<>-1)) or
  273. ((not (drivestr[Drive]=nil)) and (statfs(StrPas(drivestr[drive]),fs)<>-1)) then
  274. Diskfree:=int64(fs.bavail)*int64(fs.bsize)
  275. else
  276. Diskfree:=-1;
  277. End;
  278. Function DiskSize(Drive: Byte): int64;
  279. var
  280. fs : tstatfs;
  281. Begin
  282. if ((Drive<4) and (not (fixdrivestr[Drive]=nil)) and (statfs(StrPas(fixdrivestr[drive]),fs)<>-1)) or
  283. ((not (drivestr[Drive]=nil)) and (statfs(StrPas(drivestr[drive]),fs)<>-1)) then
  284. DiskSize:=int64(fs.blocks)*int64(fs.bsize)
  285. else
  286. DiskSize:=-1;
  287. End;
  288. Function GetCurrentDir : String;
  289. begin
  290. GetDir (0,Result);
  291. end;
  292. Function SetCurrentDir (Const NewDir : String) : Boolean;
  293. begin
  294. {$I-}
  295. ChDir(NewDir);
  296. {$I+}
  297. result := (IOResult = 0);
  298. end;
  299. Function CreateDir (Const NewDir : String) : Boolean;
  300. begin
  301. {$I-}
  302. MkDir(NewDir);
  303. {$I+}
  304. result := (IOResult = 0);
  305. end;
  306. Function RemoveDir (Const Dir : String) : Boolean;
  307. begin
  308. {$I-}
  309. RmDir(Dir);
  310. {$I+}
  311. result := (IOResult = 0);
  312. end;
  313. {****************************************************************************
  314. Misc Functions
  315. ****************************************************************************}
  316. procedure Beep;
  317. begin
  318. end;
  319. {****************************************************************************
  320. Locale Functions
  321. ****************************************************************************}
  322. Procedure GetLocalTime(var SystemTime: TSystemTime);
  323. begin
  324. Unix.GetTime(SystemTime.Hour, SystemTime.Minute, SystemTime.Second);
  325. Unix.GetDate(SystemTime.Year, SystemTime.Month, SystemTime.Day);
  326. SystemTime.MilliSecond := 0;
  327. end ;
  328. Procedure InitAnsi;
  329. Var
  330. i : longint;
  331. begin
  332. { Fill table entries 0 to 127 }
  333. for i := 0 to 96 do
  334. UpperCaseTable[i] := chr(i);
  335. for i := 97 to 122 do
  336. UpperCaseTable[i] := chr(i - 32);
  337. for i := 123 to 191 do
  338. UpperCaseTable[i] := chr(i);
  339. Move (CPISO88591UCT,UpperCaseTable[192],SizeOf(CPISO88591UCT));
  340. for i := 0 to 64 do
  341. LowerCaseTable[i] := chr(i);
  342. for i := 65 to 90 do
  343. LowerCaseTable[i] := chr(i + 32);
  344. for i := 91 to 191 do
  345. LowerCaseTable[i] := chr(i);
  346. Move (CPISO88591LCT,LowerCaseTable[192],SizeOf(CPISO88591UCT));
  347. end;
  348. Procedure InitInternational;
  349. begin
  350. InitAnsi;
  351. end;
  352. function SysErrorMessage(ErrorCode: Integer): String;
  353. begin
  354. Result:=StrError(ErrorCode);
  355. end;
  356. {****************************************************************************
  357. OS utility functions
  358. ****************************************************************************}
  359. Function GetEnvironmentVariable(Const EnvVar : String) : String;
  360. begin
  361. Result:=StrPas(BaseUnix.FPGetenv(PChar(EnvVar)));
  362. end;
  363. {$define FPC_USE_FPEXEC} // leave the old code under IFDEF for a while.
  364. function ExecuteProcess(Const Path: AnsiString; Const ComLine: AnsiString):integer;
  365. var
  366. pid : longint;
  367. err : longint;
  368. e : EOSError;
  369. CommandLine: AnsiString;
  370. cmdline2 : ppchar;
  371. Begin
  372. { always surround the name of the application by quotes
  373. so that long filenames will always be accepted. But don't
  374. do it if there are already double quotes!
  375. }
  376. {$ifdef FPC_USE_FPEXEC} // Only place we still parse
  377. cmdline2:=nil;
  378. if Comline<>'' Then
  379. begin
  380. CommandLine:=ComLine;
  381. cmdline2:=StringtoPPChar(CommandLine,1);
  382. cmdline2^:=pchar(Path);
  383. end
  384. else
  385. begin
  386. getmem(cmdline2,2*sizeof(pchar));
  387. cmdline2^:=pchar(Path);
  388. cmdline2[1]:=nil;
  389. end;
  390. {$else}
  391. if Pos ('"', Path) = 0 then
  392. CommandLine := '"' + Path + '"'
  393. else
  394. CommandLine := Path;
  395. if ComLine <> '' then
  396. CommandLine := Commandline + ' ' + ComLine;
  397. {$endif}
  398. pid:=fpFork;
  399. if pid=0 then
  400. begin
  401. {The child does the actual exec, and then exits}
  402. {$ifdef FPC_USE_FPEXEC}
  403. fpexecv(pchar(Path),Cmdline2);
  404. {$else}
  405. Execl(CommandLine);
  406. {$endif}
  407. { If the execve fails, we return an exitvalue of 127, to let it be known}
  408. fpExit(127);
  409. end
  410. else
  411. if pid=-1 then {Fork failed}
  412. begin
  413. e:=EOSError.CreateFmt(SExecuteProcessFailed,[CommandLine,-1]);
  414. e.ErrorCode:=-1;
  415. raise e;
  416. end;
  417. { We're in the parent, let's wait. }
  418. result:=WaitProcess(pid); // WaitPid and result-convert
  419. if (result>=0) and (result<>127) then
  420. result:=0
  421. else
  422. begin
  423. e:=EOSError.CreateFmt(SExecuteProcessFailed,[CommandLine,result]);
  424. e.ErrorCode:=result;
  425. raise e;
  426. end;
  427. End;
  428. function ExecuteProcess(Const Path: AnsiString; Const ComLine: Array Of AnsiString):integer;
  429. var
  430. pid : longint;
  431. err : longint;
  432. e : EOSError;
  433. Begin
  434. { always surround the name of the application by quotes
  435. so that long filenames will always be accepted. But don't
  436. do it if there are already double quotes!
  437. }
  438. pid:=fpFork;
  439. if pid=0 then
  440. begin
  441. {The child does the actual exec, and then exits}
  442. fpexecl(Path,Comline);
  443. { If the execve fails, we return an exitvalue of 127, to let it be known}
  444. fpExit(127);
  445. end
  446. else
  447. if pid=-1 then {Fork failed}
  448. begin
  449. e:=EOSError.CreateFmt(SExecuteProcessFailed,[Path,-1]);
  450. e.ErrorCode:=-1;
  451. raise e;
  452. end;
  453. { We're in the parent, let's wait. }
  454. result:=WaitProcess(pid); // WaitPid and result-convert
  455. if (result>=0) and (result<>127) then
  456. result:=0
  457. else
  458. begin
  459. e:=EOSError.CreateFmt(SExecuteProcessFailed,[Path,result]);
  460. e.ErrorCode:=result;
  461. raise e;
  462. end;
  463. End;
  464. procedure Sleep(milliseconds: Cardinal);
  465. Var
  466. fd : Integer;
  467. fds : TfdSet;
  468. timeout : TimeVal;
  469. begin
  470. fd:=FileOpen('/dev/null',fmOpenRead);
  471. If Not(Fd<0) then
  472. begin
  473. fpfd_zero(fds);
  474. fpfd_set(0,fds);
  475. timeout.tv_sec:=Milliseconds div 1000;
  476. timeout.tv_usec:=(Milliseconds mod 1000) * 1000;
  477. fpSelect(1,Nil,Nil,@fds,@timeout);
  478. end;
  479. end;
  480. Function GetLastOSError : Integer;
  481. begin
  482. Result:=fpgetErrNo;
  483. end;
  484. {****************************************************************************
  485. Initialization code
  486. ****************************************************************************}
  487. Initialization
  488. InitExceptions; { Initialize exceptions. OS independent }
  489. InitInternational; { Initialize internationalization settings }
  490. Finalization
  491. DoneExceptions;
  492. end.
  493. {
  494. $Log$
  495. Revision 1.42 2004-06-15 07:36:03 michael
  496. + Fixed Globtosearchrec to use unixtowinage
  497. Revision 1.41 2004/05/22 14:25:03 michael
  498. + Fixed FindFirst/FindNext so it treats the attributes correctly
  499. Revision 1.40 2004/04/28 20:48:20 peter
  500. * ordinal-pointer conversions fixed
  501. Revision 1.39 2004/04/26 14:50:19 peter
  502. * FileIsReadOnly fixed
  503. Revision 1.38 2004/04/20 18:24:32 marco
  504. * small fix for NIL arg ptr in first executeprocess
  505. Revision 1.37 2004/03/04 22:15:16 marco
  506. * UnixType changes. Please report problems to me.
  507. Revision 1.36 2004/02/13 10:50:23 marco
  508. * Hopefully last large changes to fpexec and friends.
  509. - naming conventions changes from Michael.
  510. - shell functions get alternative under ifdef.
  511. - arraystring function moves to unixutil
  512. - unixutil now regards quotes in stringtoppchar.
  513. - sysutils/unix get executeprocess(ansi,array of ansi), and
  514. both executeprocess functions are fixed
  515. - Sysutils/win32 get executeprocess(ansi,array of ansi)
  516. Revision 1.35 2004/02/12 15:31:06 marco
  517. * First version of fpexec change. Still under ifdef or silently overloaded
  518. Revision 1.34 2004/02/09 17:11:17 marco
  519. * fixed for 1.0 errno->fpgeterrno
  520. Revision 1.33 2004/02/08 14:50:51 michael
  521. + Added fileIsReadOnly
  522. Revision 1.32 2004/02/08 11:01:17 michael
  523. + Implemented getlastoserror
  524. Revision 1.31 2004/01/20 23:13:53 hajny
  525. * ExecuteProcess fixes, ProcessID and ThreadID added
  526. Revision 1.30 2004/01/10 17:34:36 michael
  527. + Implemented sleep() on Unix.
  528. Revision 1.29 2004/01/05 22:42:35 florian
  529. * compilation error fixed
  530. Revision 1.28 2004/01/05 22:37:15 florian
  531. * changed sysutils.exec to ExecuteProcess
  532. Revision 1.27 2004/01/03 09:09:11 marco
  533. * Unix exec(ansistring)
  534. Revision 1.26 2003/11/26 20:35:14 michael
  535. + Some fixes to have everything compile again
  536. Revision 1.25 2003/11/17 10:05:51 marco
  537. * threads for FreeBSD. Not working tho
  538. Revision 1.24 2003/10/25 23:43:59 hajny
  539. * THandle in sysutils common using System.THandle
  540. Revision 1.23 2003/10/07 08:28:49 marco
  541. * fix from Vincent to casetables
  542. Revision 1.22 2003/09/27 12:51:33 peter
  543. * fpISxxx macros renamed to C compliant fpS_ISxxx
  544. Revision 1.21 2003/09/17 19:07:44 marco
  545. * more fixes for Unix<->unixutil
  546. Revision 1.20 2003/09/17 12:41:31 marco
  547. * Uses more baseunix, less unix now
  548. Revision 1.19 2003/09/14 20:15:01 marco
  549. * Unix reform stage two. Remove all calls from Unix that exist in Baseunix.
  550. Revision 1.18 2003/04/01 15:57:41 peter
  551. * made THandle platform dependent and unique type
  552. Revision 1.17 2003/03/30 10:38:00 armin
  553. * corrected typo in DirectoryExists
  554. Revision 1.16 2003/03/29 18:21:42 hajny
  555. * DirectoryExists declaration changed to that one from fixes branch
  556. Revision 1.15 2003/03/28 19:06:59 peter
  557. * directoryexists added
  558. Revision 1.14 2003/01/03 20:41:04 peter
  559. * FileCreate(string,mode) overload added
  560. Revision 1.13 2002/09/07 16:01:28 peter
  561. * old logs removed and tabs fixed
  562. Revision 1.12 2002/01/25 16:23:03 peter
  563. * merged filesearch() fix
  564. }