summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2013-09-22 15:10:54 (EDT)
committer P. J. McDermott <pjm@nac.net>2013-09-22 15:10:54 (EDT)
commite09c119b75cfd9f6e62f50083edf4a812be66134 (patch)
treefaca88cd65f3ca1654086736201e3fc6a60d5ed0
parent6ada252e60e6e9904764eeff808e7b0a265840ca (diff)
downloadssic-e09c119b75cfd9f6e62f50083edf4a812be66134.zip
ssic-e09c119b75cfd9f6e62f50083edf4a812be66134.tar.gz
ssic-e09c119b75cfd9f6e62f50083edf4a812be66134.tar.bz2
Support "-" file names (STDIN and STDOUT).
-rw-r--r--src/ssic.pl16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/ssic.pl b/src/ssic.pl
index db7a39f..e5fa2be 100644
--- a/src/ssic.pl
+++ b/src/ssic.pl
@@ -112,11 +112,19 @@ sub compile
error(4, "Input and output files are equal\n");
}
- if (not open($input_fh, "<", $input)) {
- error(4, "%s: %s\n", $input, $!);
+ if ($input eq "-") {
+ $input_fh = *STDIN;
+ } else {
+ if (not open($input_fh, "<", $input)) {
+ error(4, "%s: %s\n", $input, $!);
+ }
}
- if (not open($output_fh, ">", $output)) {
- error(4, "%s: %s\n", $output, $!);
+ if ($output eq "-") {
+ $output_fh = *STDOUT;
+ } else {
+ if (not open($output_fh, ">", $output)) {
+ error(4, "%s: %s\n", $output, $!);
+ }
}
%ENV = (