From 0d071c9f0c0edaf55a714dbeff4651e80ea42ebd Mon Sep 17 00:00:00 2001 From: "Janet B. Anderson" Date: Thu, 19 Feb 2004 22:39:12 +0000 Subject: [PATCH] Added binmode on output file and some comments. --- configure/tools/dos2unix.pl | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/configure/tools/dos2unix.pl b/configure/tools/dos2unix.pl index c1001930e..441f9af15 100644 --- a/configure/tools/dos2unix.pl +++ b/configure/tools/dos2unix.pl @@ -20,10 +20,14 @@ foreach( @files ) { open(INPUT, "<$_"); $backup = "$_.bak"; rename( $_, $backup) || die "Unable to rename $_\n$!\n"; + # Make the output be binary so it won't convert /n back to /r/n + binmode OUTPUT, ":raw"; open(OUTPUT, ">$_"); + binmode OUTPUT, ":raw"; while() { - s/\r\n/\n/; - print OUTPUT; + # Remove CR-LF sequences + s/\r\n/\n/; + print OUTPUT; } close INPUT; close OUTPUT;