#! /usr/bin/perl -w
use strict;

# Very simple and stupid.  You have to be in the dir of the file
# you're going to convert, or use its full path.
# have no idea if this will run in windows or not, probably fails there due
# to perl line terminator magic in chomp.
# If you figure out how to fix that (should be possible with regexes)
# then how about sending me a fixed up copy at info@coultersmithing.com
# You know, that whole GPL-V2 thing.


# If this works, it was written by Doug Coulter.  If not, I haven't a clue
# who wrote it.

#usage:
# lin2win filename
# result - another new file with .win tacked on the end of the name


my $line;
my $infile = $ARGV[0];
my $outfile = $infile .".win";

print "outfile:$outfile\n";

open (INFILE, "< $infile") or die "Couldn't open infile:$infile $!";
open (OUTFILE, "> $outfile") or die "Couldn't open outfile:$outfile $!";

while ($line = <INFILE>)
{
 chomp $line; # get rid of current line terminator
 $line .= "\r\n"; # put windows line terminator on instead
 print OUTFILE $line; 

}
close INFILE or die "Couldn't close infile:$infile $!";
close OUTFILE or die "Couldn't close outfile:$outfile $!";
