Commit 06f184c1 authored by Reinhold Kainhofer's avatar Reinhold Kainhofer
Browse files

Implement reading from stdin

parent 6916ec71
......@@ -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;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment