projects
/
ssic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Support "-" file names (STDIN and STDOUT).
[ssic.git]
/
src
/
ssic.pl
diff --git
a/src/ssic.pl
b/src/ssic.pl
index 553f83d00162787b840086237886d91e2df5ff4b..e5fa2be81774fa9052bd7ef21e2cb6c923bce75f 100644
(file)
--- a/
src/ssic.pl
+++ b/
src/ssic.pl
@@
-86,16
+86,16
@@
sub version
sub warning
{
sub warning
{
- my ($fmt,
$
args) = @_;
+ my ($fmt,
@
args) = @_;
- printf("ssic: Warning: " . $fmt,
$
args);
+ printf("ssic: Warning: " . $fmt,
@
args);
}
sub error
{
}
sub error
{
- my ($status, $fmt,
$
args) = @_;
+ my ($status, $fmt,
@
args) = @_;
- printf("ssic: Error: " . $fmt,
$
args);
+ printf("ssic: Error: " . $fmt,
@
args);
exit($status);
}
exit($status);
}
@@
-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 = (