Browse Source

--- Merging r29526 into '.':
U rtl/os2/dos.pas
--- Merging r29531 into '.':
G rtl/os2/dos.pas
--- Merging r29532 into '.':
G rtl/os2/dos.pas
--- Merging r29539 into '.':
U rtl/os2/system.pas
--- Merging r29540 into '.':
U compiler/systems/t_os2.pas

# revisions: 29526,29531,29532,29539,29540

git-svn-id: branches/fixes_3_0@29543 -

marco 10 years ago
parent
commit
7f47ce3ff8
3 changed files with 51 additions and 19 deletions
  1. 3 7
      compiler/systems/t_os2.pas
  2. 47 11
      rtl/os2/dos.pas
  3. 1 1
      rtl/os2/system.pas

+ 3 - 7
compiler/systems/t_os2.pas

@@ -330,17 +330,13 @@ begin
     if index<>0 then
         begin
             str(index,tmp3);
-(*
-            tmp3:=func+'='+module+'.'+tmp3;
-*)
             tmp3:=Name+'='+module+'.'+tmp3;
         end
     else
-        tmp3:=Name+'='+module+'.'+name;
-(*
-        tmp3:=func+'='+module+'.'+name;
-    aout_sym(tmp2,n_imp1+n_ext,0,0,0);
+(*        tmp3:=Name+'='+module+'.'+name;
 *)
+        tmp3 := MangledName + '=' + module + '.' + target_info.Cprefix + name;
+
     aout_sym(tmp2,n_imp1+n_ext,0,0,0);
     aout_sym(tmp3,n_imp2+n_ext,0,0,0);
     aout_finish;

+ 47 - 11
rtl/os2/dos.pas

@@ -105,17 +105,50 @@ begin
 end;
 
 
-function fsearch(path:pathstr;dirlist:string):pathstr;
-Var
-  A: array [0..255] of char;
-  D, P: AnsiString;
+function FSearch (Path: PathStr; DirList: string): PathStr;
+var
+  i,p1   : longint;
+  s      : searchrec;
+  newdir : pathstr;
 begin
-  P:=Path;
-  D:=DirList;
-  DosError := DosSearchPath (dsIgnoreNetErrs, PChar(D), PChar(P), @A, 255);
-  if DosError <> 0 then
-   OSErrorWatch (DosError);
-  fsearch := StrPas (@A);
+{ check if the file specified exists }
+  findfirst(path,anyfile and not(directory),s);
+  if doserror=0 then
+   begin
+     findclose(s);
+     fsearch:=path;
+     exit;
+   end;
+{ No wildcards allowed in these things }
+  if (pos('?',path)<>0) or (pos('*',path)<>0) then
+    fsearch:=''
+  else
+    begin
+       { allow slash as backslash }
+       DoDirSeparators(dirlist);
+       repeat
+         p1:=pos(';',dirlist);
+         if p1<>0 then
+          begin
+            newdir:=copy(dirlist,1,p1-1);
+            delete(dirlist,1,p1);
+          end
+         else
+          begin
+            newdir:=dirlist;
+            dirlist:='';
+          end;
+         if (newdir<>'') and (not (newdir[length(newdir)] in ['\',':'])) then
+          newdir:=newdir+'\';
+         findfirst(newdir+path,anyfile and not(directory),s);
+         if doserror=0 then
+          newdir:=newdir+path
+         else
+          newdir:='';
+       until (dirlist='') or (newdir<>'');
+       fsearch:=newdir;
+    end;
+  findclose(s);
 end;
 
 
@@ -213,6 +246,7 @@ var
   SR: SearchRec;
   MaxArgsSize: PtrUInt; (* Amount of memory reserved for arguments in bytes. *)
   MaxArgsSizeInc: word;
+  PathZ: array [0..255] of char;
 
 begin
 {  LastDosExitCode := Exec (Path, ExecRunFlags (ExecFlags), efDefault, ComLine);}
@@ -235,6 +269,8 @@ begin
    begin
     Args0 := nil;
     Args := nil;
+    StrPCopy (PathZ, Path);
+    RC := DosQueryAppType (@PathZ [0], ExecAppType);
    end
   else
    begin
@@ -266,9 +302,9 @@ begin
     Args^ [ArgSize] := 0;
     Inc (ArgSize);
     Args^ [ArgSize] := 0;
+    RC := DosQueryAppType (PChar (Args), ExecAppType);
    end;
 
-  RC := DosQueryAppType (PChar (Args), ExecAppType);
   if RC <> 0 then
    OSErrorWatch (RC)
   else

+ 1 - 1
rtl/os2/system.pas

@@ -1055,7 +1055,7 @@ begin
 (* ArgLen contains size of command line arguments including leading space. *)
   ArgLen := Succ (StrLen (PC));
 
-  SysReallocMem (CmdLine, ArgVLen + ArgLen);
+  SysReallocMem (CmdLine, ArgVLen + Succ (ArgLen));
 
   Move (PC^, CmdLine [ArgVLen], Succ (ArgLen));