Use open_file()/close_file() in copy1

This commit is contained in:
Tom Eastep 2011-01-15 14:33:16 -08:00
parent 978e8e3849
commit 5c4da0b581

View File

@ -1195,6 +1195,8 @@ sub copy( $ ) {
} }
} }
sub close_file();
# #
# This one handles line continuation and 'here documents' # This one handles line continuation and 'here documents'
@ -1204,13 +1206,12 @@ sub copy1( $ ) {
my $result = 0; my $result = 0;
if ( $script || $debug ) { if ( $script || $debug ) {
my $file = $_[0];
open IF , $file or fatal_error "Unable to open $file: $!";
my ( $do_indent, $here_documents ) = ( 1, ''); my ( $do_indent, $here_documents ) = ( 1, '');
while ( <IF> ) { open_file( $_[0] );
while ( $currentfile ) {
while ( <$currentfile> ) {
chomp; chomp;
if ( /^${here_documents}\s*$/ ) { if ( /^${here_documents}\s*$/ ) {
@ -1269,7 +1270,8 @@ sub copy1( $ ) {
} }
} }
close IF; close_file;
}
} }
$lastlineblank = 0; $lastlineblank = 0;