projects
/
ssic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Only warn if input and output files are equal.
[ssic.git]
/
src
/
ssic.pl
diff --git
a/src/ssic.pl
b/src/ssic.pl
index d678556be7716789249ad70d4c540e31f266ad71..750c77be6b9021a72284ed8cec2d844390c52c5d 100644
(file)
--- a/
src/ssic.pl
+++ b/
src/ssic.pl
@@
-111,8
+111,8
@@
sub compile
my $var_name;
my $var_value;
my $var_name;
my $var_value;
- if ($input eq $output) {
-
error(4,
"Input and output files are equal\n");
+ if ($input eq $output
and $input ne "-"
) {
+
warning(
"Input and output files are equal\n");
}
if ($input eq "-") {
}
if ($input eq "-") {
@@
-127,8
+127,8
@@
sub compile
if ($output eq "-") {
$output_fh = *STDOUT;
} else {
if ($output eq "-") {
$output_fh = *STDOUT;
} else {
- if (not open($output_fh, ">", $output)) {
- error(4, "%s: %s\n", $output, $!);
+ if (not open($output_fh, ">", $output
. "~"
)) {
+ error(4, "%s: %s\n", $output
. "~"
, $!);
}
}
}
}
@@
-152,6
+152,17
@@
sub compile
}
print($output_fh $ssi->process(<$input_fh>));
}
print($output_fh $ssi->process(<$input_fh>));
+
+ if ($input ne "-") {
+ close($input_fh);
+ }
+ if ($output ne "-") {
+ close($output_fh);
+ }
+
+ if (not rename($output . "~", $output)) {
+ error(4, "%s: %s\n", $output, $!);
+ }
}
main();
}
main();