projects
/
ssic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6ada252
)
Support "-" file names (STDIN and STDOUT).
author
P. J. McDermott
<pjm@nac.net>
Sun, 22 Sep 2013 19:10:54 +0000
(15:10 -0400)
committer
P. J. McDermott
<pjm@nac.net>
Sun, 22 Sep 2013 19:10:54 +0000
(15:10 -0400)
src/ssic.pl
patch
|
blob
|
history
diff --git
a/src/ssic.pl
b/src/ssic.pl
index db7a39f047c033c381daa95e3fc40c7037069b94..e5fa2be81774fa9052bd7ef21e2cb6c923bce75f 100644
(file)
--- a/
src/ssic.pl
+++ b/
src/ssic.pl
@@
-112,11
+112,19
@@
sub compile
error(4, "Input and output files are equal\n");
}
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 = (
}
%ENV = (