Browse Source

* use_getcwd updates because FPC_USE_LIBC uses that

marco 21 years ago
parent
commit
4fc157970d
1 changed files with 14 additions and 26 deletions
  1. 14 26
      rtl/linux/osmain.inc

+ 14 - 26
rtl/linux/osmain.inc

@@ -377,7 +377,6 @@ Begin
    InOutRes:=0;
    InOutRes:=0;
 End;
 End;
 
 
-
 Procedure RmDir(Const s: String);[IOCheck];
 Procedure RmDir(Const s: String);[IOCheck];
 Var
 Var
   Buffer: Array[0..255] of Char;
   Buffer: Array[0..255] of Char;
@@ -412,8 +411,6 @@ Begin
    InOutRes:=3;
    InOutRes:=3;
 End;
 End;
 
 
-{ // $define usegetcwd}
-
 procedure getdir(drivenr : byte;var dir : shortstring);
 procedure getdir(drivenr : byte;var dir : shortstring);
 var
 var
 {$ifndef usegetcwd}
 {$ifndef usegetcwd}
@@ -424,13 +421,20 @@ var
   d            : pdirent;
   d            : pdirent;
   name         : string[255];
   name         : string[255];
   thisdir      : stat;
   thisdir      : stat;
-{$endif}
   tmp          : string[255];
   tmp          : string[255];
+{$else}
+  tmp	       : array[0..4095] of char;
+{$endif}
 
 
 begin
 begin
 {$ifdef usegetcwd}
 {$ifdef usegetcwd}
- Fpgetcwd(@tmp[1],255);
- dir:=tmp;
+ if Fpgetcwd(@tmp,10240+512)<>NIL then
+  dir:=pchar(@tmp)
+ else 
+  begin
+    dir:='';
+    writeln(geterrno);
+  end;
 {$else}
 {$else}
   dir:='';
   dir:='';
   thedir:='';
   thedir:='';
@@ -515,7 +519,6 @@ begin
   FpSigAction(SIGILL,@act,@oldact);
   FpSigAction(SIGILL,@act,@oldact);
 end;
 end;
 
 
-
 procedure SetupCmdLine;
 procedure SetupCmdLine;
 var
 var
   bufsize,
   bufsize,
@@ -574,27 +577,12 @@ begin
   FreeMem(buf,ARG_MAX);
   FreeMem(buf,ARG_MAX);
 end;
 end;
 
 
-(*
-Begin
-{ Set up signals handlers }
-   InstallSignals;
-{ Setup heap }
-  InitHeap;
-  InitExceptions;
-{ Arguments }
-  SetupCmdLine;
-{ Setup stdin, stdout and stderr }
-  OpenStdIO(Input,fmInput,StdInputHandle);
-  OpenStdIO(Output,fmOutput,StdOutputHandle);
-  OpenStdIO(StdOut,fmOutput,StdOutputHandle);
-  OpenStdIO(StdErr,fmOutput,StdErrorHandle);
-{ Reset IO Error }
-  InOutRes:=0;
-End.
-*)
 {
 {
  $Log$
  $Log$
- Revision 1.11  2003-12-30 16:26:10  marco
+ Revision 1.12  2004-01-01 14:19:55  marco
+  * use_getcwd updates because FPC_USE_LIBC uses that
+
+ Revision 1.11  2003/12/30 16:26:10  marco
   * some more fixes. Testing on idefix
   * some more fixes. Testing on idefix
 
 
  Revision 1.10  2003/12/21 20:30:49  peter
  Revision 1.10  2003/12/21 20:30:49  peter