#!/usr/bin/perl
#
# Author: Peter Keel <killer@discordia.ch>
#
# Aimed at converting DOS Microsoft-C to Borland C using libXbgi.
# 
# Linking with -lXbgi
#

die "Usage: $0 filenames\n"       unless($ARGV[0]);

foreach $file_name (@ARGV) {
    $temp_file="/tmp/$file_name";
    open(IN_FILE,"<$file_name") || die "Cannot open $file_name for input\n";
    open(TEMP,">$temp_file");
    while(<IN_FILE>){
    	$_ =~ s/_VRES16COLOR//g;
	$_ =~ s/_DEFAULTMODE//g;
	$_ =~ s/_GBORDER/g;
	$_ =~ s/_GFILLINTERIOR//g;
	$_ =~ s/_GCURSORON//g;
	$_ =~ s/_GCURSOROFF//g;
	$_ =~ s/_huge//g; # don't need memory models. 
	$_ =~ s/_GPSET//g; #whats this param to putimage? 
        print TEMP ($_);
    }
    close IN;
    close TEMP;
    system ("mv $temp_file $file_name");
}
