From 47a02764cb8409fe0ace3dc31eb592db546bcef9 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Sat, 8 Sep 2001 17:41:51 +0000 Subject: (substInFile): automatic adding of "\n" for the last line if it's not "\n" terminated --- MDK/Common/File.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/MDK/Common/File.pm b/MDK/Common/File.pm index 87923ee..9b6ee0b 100644 --- a/MDK/Common/File.pm +++ b/MDK/Common/File.pm @@ -135,7 +135,11 @@ sub substInFile(&@) { if (-s $file) { local @ARGV = $file; local ($^I, $_) = ''; - while (<>) { &$f($_); print } + while (<>) { + $_ .= "\n" if eof && !/\n/; + &$f($_); + print; + } } else { local *F; my $old = select F; # that way eof return true local $_ = ''; -- cgit v1.2.1