sysutils.pp 19 KB

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