mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-12-03 20:57:22 +01:00
+ Grep read check added
This commit is contained in:
parent
a32b46cb5e
commit
81323ed5e2
@ -147,9 +147,9 @@ var
|
|||||||
Control : PView;
|
Control : PView;
|
||||||
IL1,IL2 : PInputLine;
|
IL1,IL2 : PInputLine;
|
||||||
s : string;
|
s : string;
|
||||||
p,lineNb : longint;
|
p,lineNb,GrepOutputLine : longint;
|
||||||
error : word;
|
error : word;
|
||||||
showmsg : boolean;
|
showmsg,error_in_reading : boolean;
|
||||||
ToFocus : sw_integer;
|
ToFocus : sw_integer;
|
||||||
searchword,
|
searchword,
|
||||||
GrepExe,GrepArgs,Line,ModuleName : String;
|
GrepExe,GrepArgs,Line,ModuleName : String;
|
||||||
@ -218,7 +218,7 @@ begin
|
|||||||
{ Linux ? }
|
{ Linux ? }
|
||||||
AddToolCommand(GrepExe+' -n '+GrepArgs);
|
AddToolCommand(GrepExe+' -n '+GrepArgs);
|
||||||
ToFocus:=ToolMessages^.count-1;
|
ToFocus:=ToolMessages^.count-1;
|
||||||
if not ExecuteRedir(GrepExe,GrepArgs,'',GrepOutName,GrepErrName) then
|
if not ExecuteRedir(GrepExe,'-n '+GrepArgs,'',GrepOutName,GrepErrName) then
|
||||||
Begin
|
Begin
|
||||||
{ 2 as exit code just means that
|
{ 2 as exit code just means that
|
||||||
some file vwere not found ! }
|
some file vwere not found ! }
|
||||||
@ -233,9 +233,12 @@ begin
|
|||||||
showmsg:=true;
|
showmsg:=true;
|
||||||
Assign(GrepOut,GrepOutName);
|
Assign(GrepOut,GrepOutName);
|
||||||
Reset(GrepOut);
|
Reset(GrepOut);
|
||||||
|
error_in_reading:=false;
|
||||||
|
GrepOutputLine:=0;
|
||||||
While not eof(GrepOut) do
|
While not eof(GrepOut) do
|
||||||
begin
|
begin
|
||||||
readln(GrepOut,Line);
|
readln(GrepOut,Line);
|
||||||
|
Inc(GrepOutputLine);
|
||||||
p:=pos(':',line);
|
p:=pos(':',line);
|
||||||
if p>0 then
|
if p>0 then
|
||||||
begin
|
begin
|
||||||
@ -244,14 +247,25 @@ begin
|
|||||||
p:=pos(':',Line);
|
p:=pos(':',Line);
|
||||||
val(copy(Line,1,p-1),lineNb,error);
|
val(copy(Line,1,p-1),lineNb,error);
|
||||||
if error=0 then
|
if error=0 then
|
||||||
AddToolMessage(ModuleName,Copy(Line,p+1,255),LineNb,1);
|
AddToolMessage(ModuleName,Copy(Line,p+1,255),LineNb,1)
|
||||||
|
else
|
||||||
|
error_in_reading:=true;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
Close(GrepOut);
|
Close(GrepOut);
|
||||||
Erase(GrepOut);
|
if not error_in_reading then
|
||||||
|
Erase(GrepOut)
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
Params[0]:=GrepOutputLine;
|
||||||
|
WarningBox(#3'Error reading Grep output'#13#3'In line %d of '+GrepOutName,@Params);
|
||||||
|
end;
|
||||||
{ Delete also grep$$.err }
|
{ Delete also grep$$.err }
|
||||||
Assign(GrepOut,GrepErrName);
|
if not error_in_reading then
|
||||||
Erase(GrepOut);
|
begin
|
||||||
|
Assign(GrepOut,GrepErrName);
|
||||||
|
Erase(GrepOut);
|
||||||
|
end;
|
||||||
{$I+}
|
{$I+}
|
||||||
EatIO;
|
EatIO;
|
||||||
end;
|
end;
|
||||||
@ -268,7 +282,10 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.14 1999-09-22 16:17:31 pierre
|
Revision 1.15 1999-10-08 15:25:25 pierre
|
||||||
|
+ Grep read check added
|
||||||
|
|
||||||
|
Revision 1.14 1999/09/22 16:17:31 pierre
|
||||||
+ HistList for Grep
|
+ HistList for Grep
|
||||||
|
|
||||||
Revision 1.13 1999/08/03 20:22:35 peter
|
Revision 1.13 1999/08/03 20:22:35 peter
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user