mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 21:09:27 +02:00
* Better error handling
git-svn-id: trunk@2350 -
This commit is contained in:
parent
44ee4f6a39
commit
f1e849a469
@ -65,7 +65,7 @@ var thistty:string;
|
|||||||
ttystat:stat;
|
ttystat:stat;
|
||||||
s:string[15];
|
s:string[15];
|
||||||
c:char;
|
c:char;
|
||||||
pid,parent,dummy:integer;
|
ppid,pid,parent,dummy:integer;
|
||||||
device:longint;
|
device:longint;
|
||||||
f:text;
|
f:text;
|
||||||
found_vcsa:boolean;
|
found_vcsa:boolean;
|
||||||
@ -81,7 +81,10 @@ begin
|
|||||||
assign(f,'/proc/'+s+'/stat');
|
assign(f,'/proc/'+s+'/stat');
|
||||||
reset(f);
|
reset(f);
|
||||||
if ioresult<>0 then
|
if ioresult<>0 then
|
||||||
break;
|
begin
|
||||||
|
found_vcsa:=false;
|
||||||
|
break;
|
||||||
|
end;
|
||||||
read(f,dummy);
|
read(f,dummy);
|
||||||
read(f,c);
|
read(f,c);
|
||||||
repeat
|
repeat
|
||||||
@ -90,14 +93,15 @@ begin
|
|||||||
repeat
|
repeat
|
||||||
read(f,c);
|
read(f,c);
|
||||||
until c=' ';
|
until c=' ';
|
||||||
|
ppid:=pid;
|
||||||
read(f,pid);
|
read(f,pid);
|
||||||
read(f,dummy);
|
read(f,dummy);
|
||||||
read(f,dummy);
|
read(f,dummy);
|
||||||
read(f,device);
|
read(f,device);
|
||||||
close(f);
|
close(f);
|
||||||
if device=0 then
|
|
||||||
break; {Not attached to a terminal, i.e. an xterm.}
|
|
||||||
found_vcsa:=device and $ffffff00=$00000400; {/dev/tty*}
|
found_vcsa:=device and $ffffff00=$00000400; {/dev/tty*}
|
||||||
|
if (device=0) or (pid=-1) or (ppid=pid) then
|
||||||
|
break; {Not attached to a terminal, i.e. an xterm.}
|
||||||
until found_vcsa;
|
until found_vcsa;
|
||||||
if found_vcsa then
|
if found_vcsa then
|
||||||
begin
|
begin
|
||||||
|
Loading…
Reference in New Issue
Block a user