Skip to content
Snippets Groups Projects
Commit 06f184c1 authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

Implement reading from stdin

parent 6916ec71
Branches
No related tags found
No related merge requests found
......@@ -553,12 +553,15 @@ Error: $msg\n";
sub read_file {
my ($fn) = @_;
if (!(open FH, $fn))
{
my $res = "";
if ($fn eq "-") {
while (<STDIN>) { $res .= $_; } # read all lines
} else {
if (!(open FH, $fn)) {
return "";
}
my $res = "";
while (<FH>) { $res .= $_; } # read all lines
close (FH);
while (<FH>) { $res .= $_; } # read all lines
close (FH);
}
return $res;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment