syslinux.pp 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743
  1. {
  2. $Id$
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 1993,97 by Michael Van Canneyt,
  5. member of the Free Pascal development team.
  6. See the file COPYING.FPC, included in this distribution,
  7. for details about the copyright.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  11. **********************************************************************}
  12. { These things are set in the makefile, }
  13. { But you can override them here.}
  14. { If you want to link to the C library, set the conditional crtlib }
  15. { $define crtlib}
  16. { If you use an aout system, set the conditional AOUT}
  17. { $Define AOUT}
  18. Unit SysLinux;
  19. {$I os.inc}
  20. Interface
  21. {$ifdef m68k}
  22. { used for single computations }
  23. const
  24. BIAS4 = $7f-1;
  25. {$endif}
  26. {$I systemh.inc}
  27. {$I heaph.inc}
  28. const
  29. {$ifndef VER0_99_5}
  30. {$ifndef VER0_99_6}
  31. UnusedHandle = -1;
  32. {$else}
  33. UnusedHandle = $ffff;
  34. {$endif}
  35. {$else}
  36. UnusedHandle = $ffff;
  37. {$endif}
  38. StdInputHandle = 0;
  39. StdOutputHandle = 1;
  40. StdErrorHandle = 2;
  41. var
  42. argc : longint;
  43. argv : ppchar;
  44. envp : ppchar;
  45. Implementation
  46. {$I system.inc}
  47. {$ifdef crtlib}
  48. Procedure _rtl_exit(l: longint); cdecl;
  49. Function _rtl_paramcount: longint; cdecl;
  50. Procedure _rtl_paramstr(st: pchar; l: longint); cdecl;
  51. Function _rtl_open(f: pchar; flags: longint): longint; cdecl;
  52. Procedure _rtl_close(h: longint); cdecl;
  53. Procedure _rtl_write(h: longint; addr: longInt; len : longint); cdecl;
  54. Procedure _rtl_erase(p: pchar); cdecl;
  55. Procedure _rtl_rename(p1: pchar; p2 : pchar); cdecl;
  56. Function _rtl_read(h: longInt; addr: longInt; len : longint) : longint; cdecl;
  57. Function _rtl_filepos(Handle: longint): longint; cdecl;
  58. Procedure _rtl_seek(Handle: longint; pos:longint); cdecl;
  59. Function _rtl_filesize(Handle:longint): longInt; cdecl;
  60. Procedure _rtl_rmdir(buffer: pchar); cdecl;
  61. Procedure _rtl_mkdir(buffer: pchar); cdecl;
  62. Procedure _rtl_chdir(buffer: pchar); cdecl;
  63. {$else}
  64. { used in syscall to report errors.}
  65. var
  66. Errno : longint;
  67. { Include constant and type definitions }
  68. {$i errno.inc } { Error numbers }
  69. {$i sysnr.inc } { System call numbers }
  70. {$i sysconst.inc } { Miscellaneous constants }
  71. {$i systypes.inc } { Types needed for system calls }
  72. { Read actual system call definitions. }
  73. {$i syscalls.inc }
  74. {$endif}
  75. {*****************************************************************************
  76. Misc. System Dependent Functions
  77. *****************************************************************************}
  78. {$ASMMODE DIRECT}
  79. Procedure Halt(ErrNum: Byte);
  80. Begin
  81. ExitCode:=Errnum;
  82. ErrorAddr:=nil;
  83. Do_Exit;
  84. {$ifdef i386}
  85. asm
  86. jmp _haltproc
  87. end;
  88. {$else}
  89. {$endif}
  90. End;
  91. Function ParamCount: Longint;
  92. Begin
  93. {$ifdef crtlib}
  94. ParamCount:=_rtl_paramcount;
  95. {$else}
  96. Paramcount:=argc-1
  97. {$endif}
  98. End;
  99. Function ParamStr(l: Longint): String;
  100. Var
  101. {$ifndef crtlib}
  102. i : longint;
  103. pp : ppchar;
  104. {$else}
  105. b : Array[0..255] of Char;
  106. {$endif}
  107. Begin
  108. {$ifdef crtlib}
  109. _rtl_paramstr(@b, l);
  110. ParamStr:=StrPas(b);
  111. {$else}
  112. if l>argc then
  113. begin
  114. paramstr:='';
  115. exit
  116. end;
  117. pp:=argv;
  118. i:=0;
  119. while (i<l) and (pp^<>nil) do
  120. begin
  121. pp:=pp+4;
  122. inc(i);
  123. end;
  124. if pp^<>nil then
  125. Paramstr:=StrPas(pp^)
  126. else
  127. ParamStr:='';
  128. {$endif}
  129. End;
  130. Procedure Randomize;
  131. Begin
  132. {$ifdef crtlib}
  133. _rtl_gettime(longint(@randseed));
  134. {$else}
  135. randseed:=sys_time;
  136. {$endif}
  137. End;
  138. {*****************************************************************************
  139. Heap Management
  140. *****************************************************************************}
  141. { ___fpc_brk_addr is defined and allocated in prt1.as }
  142. Function Get_Brk_addr : longint;assembler;
  143. {$ifdef i386}
  144. asm
  145. movl ___fpc_brk_addr,%eax
  146. end ['EAX'];
  147. {$else}
  148. asm
  149. end;
  150. {$endif}
  151. Procedure Set_brk_addr (NewAddr : longint);assembler;
  152. {$ifdef i386}
  153. asm
  154. movl NewAddr,%eax
  155. movl %eax,___fpc_brk_addr
  156. end ['EAX'];
  157. {$else}
  158. asm
  159. end;
  160. {$endif}
  161. {$ASMMODE ATT}
  162. Function brk(Location : longint) : Longint;
  163. { set end of data segment to location }
  164. var
  165. t : syscallregs;
  166. dummy : longint;
  167. begin
  168. t.reg2:=Location;
  169. dummy:=syscall(syscall_nr_brk,t);
  170. set_brk_addr(dummy);
  171. brk:=dummy;
  172. end;
  173. Function init_brk : longint;
  174. begin
  175. if Get_Brk_addr=0 then
  176. begin
  177. Set_brk_addr(brk(0));
  178. if Get_brk_addr=0 then
  179. exit(-1);
  180. end;
  181. init_brk:=0;
  182. end;
  183. Function sbrk(size : longint) : Longint;
  184. var
  185. Temp : longint;
  186. begin
  187. if init_brk=0 then
  188. begin
  189. Temp:=Get_Brk_Addr+size;
  190. if brk(temp)=-1 then
  191. exit(-1);
  192. if Get_brk_addr=temp then
  193. exit(temp-size);
  194. end;
  195. exit(-1);
  196. end;
  197. { include standard heap management }
  198. {$I heap.inc}
  199. {*****************************************************************************
  200. Low Level File Routines
  201. *****************************************************************************}
  202. {
  203. The lowlevel file functions should take care of setting the InOutRes to the
  204. correct value if an error has occured, else leave it untouched
  205. }
  206. Procedure Errno2Inoutres;
  207. {
  208. Convert ErrNo error to the correct Inoutres value
  209. }
  210. begin
  211. if ErrNo=0 then { Else it will go through all the cases }
  212. exit;
  213. case ErrNo of
  214. Sys_ENFILE,
  215. Sys_EMFILE : Inoutres:=4;
  216. Sys_ENOENT : Inoutres:=2;
  217. Sys_EBADF : Inoutres:=6;
  218. Sys_ENOMEM,
  219. Sys_EFAULT : Inoutres:=217;
  220. Sys_EINVAL : Inoutres:=218;
  221. Sys_EPIPE,
  222. Sys_EINTR,
  223. Sys_EIO,
  224. Sys_EAGAIN,
  225. Sys_ENOSPC : Inoutres:=101;
  226. Sys_ENAMETOOLONG,
  227. Sys_ELOOP,
  228. Sys_ENOTDIR : Inoutres:=3;
  229. Sys_EROFS,
  230. Sys_EEXIST,
  231. Sys_EACCES : Inoutres:=5;
  232. Sys_ETXTBSY : Inoutres:=162;
  233. end;
  234. end;
  235. Procedure Do_Close(Handle:Longint);
  236. Begin
  237. {$ifdef crtlib}
  238. _rtl_close(Handle);
  239. {$else}
  240. sys_close(Handle);
  241. {$endif}
  242. End;
  243. Procedure Do_Erase(p:pchar);
  244. Begin
  245. {$ifdef crtlib}
  246. _rtl_erase(p);
  247. {$else}
  248. sys_unlink(p);
  249. Errno2Inoutres;
  250. {$endif}
  251. End;
  252. Procedure Do_Rename(p1,p2:pchar);
  253. Begin
  254. {$ifdef crtlib}
  255. _rtl_rename(p1,p2);
  256. {$else }
  257. sys_rename(p1,p2);
  258. Errno2Inoutres;
  259. {$endif}
  260. End;
  261. Function Do_Write(Handle,Addr,Len:Longint):longint;
  262. Begin
  263. {$ifdef crtlib}
  264. _rtl_write(Handle,addr,len);
  265. Do_Write:=Len;
  266. {$else}
  267. Do_Write:=sys_write(Handle,pchar(addr),len);
  268. Errno2Inoutres;
  269. {$endif}
  270. if Do_Write<0 then
  271. Do_Write:=0;
  272. End;
  273. Function Do_Read(Handle,Addr,Len:Longint):Longint;
  274. Begin
  275. {$ifdef crtlib}
  276. Do_Read:=_rtl_read(Handle,addr,len);
  277. {$else}
  278. Do_Read:=sys_read(Handle,pchar(addr),len);
  279. Errno2Inoutres;
  280. {$endif}
  281. if Do_Read<0 then
  282. Do_Read:=0;
  283. End;
  284. Function Do_FilePos(Handle: Longint): Longint;
  285. Begin
  286. {$ifdef crtlib}
  287. Do_FilePos:=_rtl_filepos(Handle);
  288. {$else}
  289. Do_FilePos:=sys_lseek(Handle, 0, Seek_Cur);
  290. Errno2Inoutres;
  291. {$endif}
  292. End;
  293. Procedure Do_Seek(Handle,Pos:Longint);
  294. Begin
  295. {$ifdef crtlib}
  296. _rtl_seek(Handle, Pos);
  297. {$else}
  298. sys_lseek(Handle, pos, Seek_set);
  299. {$endif}
  300. End;
  301. Function Do_SeekEnd(Handle:Longint): Longint;
  302. begin
  303. {$ifdef crtlib}
  304. Do_SeekEnd:=_rtl_filesize(Handle);
  305. {$else}
  306. Do_SeekEnd:=sys_lseek(Handle,0,Seek_End);
  307. {$endif}
  308. end;
  309. Function Do_FileSize(Handle:Longint): Longint;
  310. {$ifndef crtlib}
  311. var
  312. regs : Syscallregs;
  313. Info : Stat;
  314. {$endif}
  315. Begin
  316. {$ifdef crtlib}
  317. Do_FileSize:=_rtl_filesize(Handle);
  318. {$else}
  319. regs.reg2:=Handle;
  320. regs.reg3:=longint(@Info);
  321. if SysCall(SysCall_nr_fstat,regs)=0 then
  322. Do_FileSize:=Info.Size
  323. else
  324. Do_FileSize:=0;
  325. Errno2Inoutres;
  326. {$endif}
  327. End;
  328. Procedure Do_Truncate(Handle,Pos:longint);
  329. {$ifndef crtlib}
  330. var
  331. sr : syscallregs;
  332. {$endif}
  333. begin
  334. {$ifndef crtlib}
  335. sr.reg2:=Handle;
  336. sr.reg3:=Pos;
  337. syscall(syscall_nr_ftruncate,sr);
  338. Errno2Inoutres;
  339. {$endif}
  340. end;
  341. Procedure Do_Open(var f;p:pchar;flags:longint);
  342. {
  343. FileRec and textrec have both Handle and mode as the first items so
  344. they could use the same routine for opening/creating.
  345. when (flags and $10) the file will be append
  346. when (flags and $100) the file will be truncate/rewritten
  347. when (flags and $1000) there is no check for close (needed for textfiles)
  348. }
  349. var
  350. {$ifndef crtlib}
  351. oflags : longint;
  352. {$endif}
  353. Begin
  354. { close first if opened }
  355. if ((flags and $1000)=0) then
  356. begin
  357. case FileRec(f).mode of
  358. fminput,fmoutput,fminout : Do_Close(FileRec(f).Handle);
  359. fmclosed : ;
  360. else
  361. begin
  362. inoutres:=102; {not assigned}
  363. exit;
  364. end;
  365. end;
  366. end;
  367. { reset file Handle }
  368. FileRec(f).Handle:=UnusedHandle;
  369. { We do the conversion of filemodes here, concentrated on 1 place }
  370. case (flags and 3) of
  371. 0 : begin
  372. oflags :=Open_RDONLY;
  373. FileRec(f).mode:=fminput;
  374. end;
  375. 1 : begin
  376. oflags :=Open_WRONLY;
  377. FileRec(f).mode:=fmoutput;
  378. end;
  379. 2 : begin
  380. oflags :=Open_RDWR;
  381. FileRec(f).mode:=fminout;
  382. end;
  383. end;
  384. if (flags and $100)=$100 then
  385. oflags:=oflags or (Open_CREAT or Open_TRUNC)
  386. else
  387. if (flags and $10)=$10 then
  388. oflags:=oflags or (Open_APPEND);
  389. { empty name is special }
  390. if p[0]=#0 then
  391. begin
  392. case FileRec(f).mode of
  393. fminput : FileRec(f).Handle:=StdInputHandle;
  394. fmoutput,
  395. fmappend : begin
  396. FileRec(f).Handle:=StdOutputHandle;
  397. FileRec(f).mode:=fmoutput; {fool fmappend}
  398. end;
  399. end;
  400. exit;
  401. end;
  402. { real open call }
  403. {$ifdef crtlib}
  404. FileRec(f).Handle:=_rtl_open(p, oflags);
  405. if FileRec(f).Handle<0 then
  406. InOutRes:=2
  407. else
  408. InOutRes:=0;
  409. {$else}
  410. FileRec(f).Handle:=sys_open(p,oflags,438);
  411. if (ErrNo=Sys_EROFS) and ((OFlags and Open_RDWR)<>0) then
  412. begin
  413. Oflags:=Oflags and not(Open_RDWR);
  414. FileRec(f).Handle:=sys_open(p,oflags,438);
  415. end;
  416. Errno2Inoutres;
  417. {$endif}
  418. End;
  419. Function Do_IsDevice(Handle:Longint):boolean;
  420. {
  421. Interface to Unix ioctl call.
  422. Performs various operations on the filedescriptor Handle.
  423. Ndx describes the operation to perform.
  424. Data points to data needed for the Ndx function. The structure of this
  425. data is function-dependent.
  426. }
  427. var
  428. sr: SysCallRegs;
  429. Data : array[0..255] of byte; {Large enough for termios info}
  430. begin
  431. sr.reg2:=Handle;
  432. sr.reg3:=$5401; {=TCGETS}
  433. sr.reg4:=Longint(@Data);
  434. Do_IsDevice:=(SysCall(Syscall_nr_ioctl,sr)=0);
  435. end;
  436. {*****************************************************************************
  437. UnTyped File Handling
  438. *****************************************************************************}
  439. {$i file.inc}
  440. {*****************************************************************************
  441. Typed File Handling
  442. *****************************************************************************}
  443. {$i typefile.inc}
  444. {*****************************************************************************
  445. Text File Handling
  446. *****************************************************************************}
  447. {$DEFINE SHORT_LINEBREAK}
  448. {$DEFINE EXTENDED_EOF}
  449. {$i text.inc}
  450. {*****************************************************************************
  451. Directory Handling
  452. *****************************************************************************}
  453. Procedure MkDir(Const s: String);[IOCheck];
  454. Var
  455. Buffer: Array[0..255] of Char;
  456. Begin
  457. If InOutRes <> 0 then exit;
  458. Move(s[1], Buffer, Length(s));
  459. Buffer[Length(s)] := #0;
  460. {$ifdef crtlib}
  461. _rtl_mkdir(@buffer);
  462. {$else}
  463. sys_mkdir(@buffer, 511);
  464. Errno2Inoutres;
  465. {$endif}
  466. End;
  467. Procedure RmDir(Const s: String);[IOCheck];
  468. Var
  469. Buffer: Array[0..255] of Char;
  470. Begin
  471. If InOutRes <> 0 then exit;
  472. Move(s[1], Buffer, Length(s));
  473. Buffer[Length(s)] := #0;
  474. {$ifdef crtlib}
  475. _rtl_rmdir(@buffer);
  476. {$else}
  477. sys_rmdir(@buffer);
  478. Errno2Inoutres;
  479. {$endif}
  480. End;
  481. Procedure ChDir(Const s: String);[IOCheck];
  482. Var
  483. Buffer: Array[0..255] of Char;
  484. Begin
  485. If InOutRes <> 0 then exit;
  486. Move(s[1], Buffer, Length(s));
  487. Buffer[Length(s)] := #0;
  488. {$ifdef crtlib}
  489. _rtl_chdir(@buffer);
  490. {$else}
  491. sys_chdir(@buffer);
  492. Errno2Inoutres;
  493. {$endif}
  494. End;
  495. procedure getdir(drivenr : byte;var dir : string);
  496. {$ifndef crtlib}
  497. var
  498. thisdir : stat;
  499. rootino,
  500. thisino,
  501. dotdotino : longint;
  502. rootdev,
  503. thisdev,
  504. dotdotdev : word;
  505. thedir,dummy : string[255];
  506. dirstream : pdir;
  507. d : pdirent;
  508. mountpoint : boolean;
  509. predot : string[255];
  510. procedure dodispose (p : pdir);
  511. begin
  512. dispose (p^.buf);
  513. dispose (p)
  514. end;
  515. {$endif}
  516. begin
  517. drivenr:=0;
  518. dir:='';
  519. {$ifndef crtlib}
  520. thedir:='/'#0;
  521. if sys_stat(@thedir[1],thisdir)<0 then
  522. exit;
  523. rootino:=thisdir.ino;
  524. rootdev:=thisdir.dev;
  525. thedir:='.'#0;
  526. if sys_stat(@thedir[1],thisdir)<0 then
  527. exit;
  528. thisino:=thisdir.ino;
  529. thisdev:=thisdir.dev;
  530. { Now we can uniquely identify the current and root dir }
  531. thedir:='';
  532. predot:='';
  533. while not ((thisino=rootino) and (thisdev=rootdev)) do
  534. begin
  535. { Are we on a mount point ? }
  536. dummy:=predot+'..'#0;
  537. if sys_stat(@dummy[1],thisdir)<0 then
  538. exit;
  539. dotdotino:=thisdir.ino;
  540. dotdotdev:=thisdir.dev;
  541. mountpoint:=(thisdev<>dotdotdev);
  542. { Now, Try to find the name of this dir in the previous one }
  543. dirstream:=opendir (@dummy[1]);
  544. if dirstream=nil then
  545. exit;
  546. repeat
  547. d:=sys_readdir (dirstream);
  548. if (d<>nil) and
  549. (not ((d^.name[0]='.') and ((d^.name[1]=#0) or ((d^.name[1]='.') and (d^.name[2]=#0))))) and
  550. (mountpoint or (d^.ino=thisino)) then
  551. begin
  552. dummy:=predot+'../'+strpas(@(d^.name[0]))+#0;
  553. if sys_stat (@(dummy[1]),thisdir)<0 then
  554. d:=nil;
  555. end;
  556. until (d=nil) or ((thisdir.dev=thisdev) and (thisdir.ino=thisino) );
  557. if (closedir (dirstream)<0) or (d=nil) then
  558. begin
  559. dodispose (dirstream);
  560. exit;
  561. end;
  562. { At this point, d.name contains the name of the current dir}
  563. thedir:='/'+strpas(@(d^.name[0]))+thedir;
  564. thisdev:=dotdotdev;
  565. thisino:=dotdotino;
  566. predot:=predot+'../';
  567. { We don't want to clutter op the heap with DIR records... }
  568. dodispose (dirstream);
  569. end;
  570. { Now rootino=thisino and rootdev=thisdev so we've reached / }
  571. dir:=thedir
  572. {$endif}
  573. end;
  574. {*****************************************************************************
  575. SystemUnit Initialization
  576. *****************************************************************************}
  577. Procedure SegFaultHandler (Sig : longint);
  578. begin
  579. if sig=11 then
  580. HandleError (216);
  581. end;
  582. Procedure InstallSegFaultHandler;
  583. var
  584. sr : syscallregs;
  585. begin
  586. sr.reg2:=11;
  587. sr.reg3:=longint(@SegFaultHandler);
  588. syscall(syscall_nr_signal,sr);
  589. end;
  590. Begin
  591. { Set up segfault Handler }
  592. InstallSegFaultHandler;
  593. { Setup heap }
  594. InitHeap;
  595. { Setup stdin, stdout and stderr }
  596. OpenStdIO(Input,fmInput,StdInputHandle);
  597. OpenStdIO(Output,fmOutput,StdOutputHandle);
  598. OpenStdIO(StdErr,fmOutput,StdErrorHandle);
  599. { Reset IO Error }
  600. InOutRes:=0;
  601. End.
  602. {
  603. $Log$
  604. Revision 1.15 1998-09-06 19:41:40 peter
  605. * fixed unusedhandle for 0.99.5
  606. Revision 1.14 1998/09/04 18:16:16 peter
  607. * uniform filerec/textrec (with recsize:longint and name:0..255)
  608. Revision 1.13 1998/08/14 11:59:41 carl
  609. + m68k fixes
  610. Revision 1.12 1998/08/12 14:01:37 michael
  611. + Small m68k fixes
  612. Revision 1.11 1998/08/11 08:30:37 michael
  613. + Fixed paramstr() - sometimes there are no 255 characters available.
  614. Revision 1.10 1998/07/30 13:26:15 michael
  615. + Added support for ErrorProc variable. All internal functions are required
  616. to call HandleError instead of runerror from now on.
  617. This is necessary for exception support.
  618. Revision 1.9 1998/07/20 23:40:20 michael
  619. changed sbrk to fc_sbrk, to avoid conflicts with C library.
  620. Revision 1.8 1998/07/13 21:19:14 florian
  621. * some problems with ansi string support fixed
  622. Revision 1.7 1998/07/02 12:36:21 carl
  623. * IOCheck/InOutRes check for mkdir, chdir and rmdir as in TP
  624. Revision 1.6 1998/07/01 15:30:01 peter
  625. * better readln/writeln
  626. Revision 1.4 1998/05/30 14:18:43 peter
  627. * fixed to remake with -Rintel in the ppc386.cfg
  628. Revision 1.3 1998/05/12 10:42:48 peter
  629. * moved getopts to inc/, all supported OS's need argc,argv exported
  630. + strpas, strlen are now exported in the systemunit
  631. * removed logs
  632. * removed $ifdef ver_above
  633. Revision 1.2 1998/05/06 12:35:26 michael
  634. + Removed log from before restored version.
  635. }