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"; ...@@ -553,12 +553,15 @@ Error: $msg\n";
sub read_file { sub read_file {
my ($fn) = @_; my ($fn) = @_;
if (!(open FH, $fn)) my $res = "";
{ if ($fn eq "-") {
while (<STDIN>) { $res .= $_; } # read all lines
} else {
if (!(open FH, $fn)) {
return ""; return "";
} }
my $res = ""; while (<FH>) { $res .= $_; } # read all lines
while (<FH>) { $res .= $_; } # read all lines close (FH);
close (FH); }
return $res; return $res;
} }
Supports Markdown
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