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

Implement reading from stdin

parent 6916ec71
No related branches found
No related tags found
No related merge requests found
...@@ -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;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment