#!/bin/sh
echo MANGLED_ON_PURPOSE.7784
exit
#!/usr/bin/perl -w

# Script for semiautomatically "fixing" warnings about unused parameters
#   in function headers.
# Input: path/file.c
# Output: path/file.c.new-unused

use strict;

if ($#ARGV != 0) {
  die "Interesting - please call with exactly one filename.c\n";
}

$ARGV[0] =~ /(.*\/)(.*)/;

my ($path, $file);
if ($1) {
  $path=$1;
  $file=$2;
} else {
  $path=".";
  $file=$ARGV[0];
}
chdir($path) || die "Failed to change dir to $path: $!\n";;

open (INFILE, "<$file") || die "Failed to open $file for input: $!\n";
my @infile=<INFILE>;
close INFILE;

(my $ofile=$file)=~s/(.*)\.c$/$1.o/;
unlink $ofile; # This may fail because the file doesn't exist
		# I won't check for non writeable files and such - too lazy
open (MAKE, "make $ofile 2>&1 |") || die "Failed to create make $ofile-pipe: $!\n";
while (<MAKE>) {
print " >$_";
  if (/.*:(\d+): warning: unused parameter `(.+)'/) {
    my $line=$1-1;
    my $var=$2;
    $infile[$line] =~ s/ (\*|)$var([ ),])/ $1$var _U_$2/;
  }
}

open (OUTFILE, ">$file.new-unused") ||
	die "Failed to open $file.new-unused for output: $!\n";
foreach (@infile) {
  print OUTFILE;
}
close OUTFILE;

exit 0;

__END__

termporary junk goes here:
