mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 06:49:13 +02:00
* Environment corruption fix by Ladislav Lacina
git-svn-id: trunk@5562 -
This commit is contained in:
parent
6b1c820dfe
commit
139408b512
@ -181,27 +181,32 @@ var
|
|||||||
execblock : texecblock;
|
execblock : texecblock;
|
||||||
c,p : string;
|
c,p : string;
|
||||||
|
|
||||||
function paste_to_dos(src : string;cr : boolean) : boolean;
|
function paste_to_dos(src : string;cr : boolean; n : longint) : boolean;
|
||||||
|
{Changed by Laaca - added parameter N}
|
||||||
var
|
var
|
||||||
c : pchar;
|
c : pchar;
|
||||||
CLen : cardinal;
|
CLen : cardinal;
|
||||||
|
ls : longint;
|
||||||
begin
|
begin
|
||||||
paste_to_dos:=false;
|
paste_to_dos:=false;
|
||||||
if current_dos_buffer_pos+length(src)+3>transfer_buffer+tb_size then
|
if current_dos_buffer_pos+length(src)+3>transfer_buffer+tb_size then
|
||||||
RunError(217);
|
RunError(217);
|
||||||
getmem(c,length(src)+3);
|
|
||||||
move(src[0],c^,length(src)+1);
|
ls:=Length(src)-n;
|
||||||
|
|
||||||
|
getmem(c,ls+3);
|
||||||
|
move(src[n],c^,ls+1);
|
||||||
if cr then
|
if cr then
|
||||||
begin
|
begin
|
||||||
c[length(src)+1]:=#13;
|
c[ls+1]:=#13;
|
||||||
c[length(src)+2]:=#0;
|
c[ls+2]:=#0;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
c[length(src)+1]:=#0;
|
c[ls+1]:=#0;
|
||||||
CLen := StrLen (C) + 1;
|
CLen := StrLen (C) + 1;
|
||||||
seg_move(get_ds,longint(c),dosmemselector,current_dos_buffer_pos,CLen);
|
seg_move(get_ds,longint(c),dosmemselector,current_dos_buffer_pos,CLen);
|
||||||
current_dos_buffer_pos:=current_dos_buffer_pos+CLen;
|
current_dos_buffer_pos:=current_dos_buffer_pos+CLen;
|
||||||
freemem(c,length(src)+3);
|
freemem(c,ls+3);
|
||||||
paste_to_dos:=true;
|
paste_to_dos:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -223,13 +228,14 @@ begin
|
|||||||
current_dos_buffer_pos:=la_env;
|
current_dos_buffer_pos:=la_env;
|
||||||
{ copy environment }
|
{ copy environment }
|
||||||
for i:=1 to envcount do
|
for i:=1 to envcount do
|
||||||
paste_to_dos(envstr(i),false);
|
paste_to_dos(envstr(i),false,1);
|
||||||
paste_to_dos(chr(0),false); { adds a double zero at the end }
|
{the behaviour is still suboptimal because variable COMMAND is stripped out}
|
||||||
|
paste_to_dos(chr(0),false,1); { adds a double zero at the end }
|
||||||
{ allow slash as backslash }
|
{ allow slash as backslash }
|
||||||
la_p:=current_dos_buffer_pos;
|
la_p:=current_dos_buffer_pos;
|
||||||
paste_to_dos(p,false);
|
paste_to_dos(p,false,0);
|
||||||
la_c:=current_dos_buffer_pos;
|
la_c:=current_dos_buffer_pos;
|
||||||
paste_to_dos(c,true);
|
paste_to_dos(c,true,0);
|
||||||
la_e:=current_dos_buffer_pos;
|
la_e:=current_dos_buffer_pos;
|
||||||
fcb1_la:=la_e;
|
fcb1_la:=la_e;
|
||||||
la_e:=la_e+16;
|
la_e:=la_e+16;
|
||||||
|
Loading…
Reference in New Issue
Block a user