diff options
author | Reuben Thomas <rrt@sc3d.org> | 2009-08-06 22:32:42 +0100 |
---|---|---|
committer | Reuben Thomas <rrt@sc3d.org> | 2009-08-06 22:32:42 +0100 |
commit | 2ff01bdb018a1a1bc9e5800314d70e06972192cc (patch) | |
tree | 1eec511eacfbdc94632ec1e9b768e0c4e713289c | |
parent | 2cd8cada9e6c0c6cd0421993920c2592637382ac (diff) | |
download | autoconf-archive-2ff01bdb018a1a1bc9e5800314d70e06972192cc.tar.gz |
Fix case of macro in "OBSOLETE" section.
Make error messages more legible.
-rwxr-xr-x | rename-macro.pl | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/rename-macro.pl b/rename-macro.pl index 4eadbe0..487857e 100755 --- a/rename-macro.pl +++ b/rename-macro.pl @@ -14,22 +14,25 @@ my ($old_prefix, $new_prefix, $old_file, $new_file) = @ARGV; # Extract names from file names my $old_name = $old_file; $old_name =~ s/\..*$//; +my $uc_old_name = uc($old_name); +$old_name = lc($old_name); my $new_name = $new_file; $new_name =~ s/\..*$//; +my $uc_new_name = uc($new_name); +$new_name = lc($new_name); # Read file -open IN, $old_file or die "could not read $old_file\n"; +open IN, $old_file or die "could not read `$old_file'\n"; my $text = do { local $/, <IN> }; # Make new macro my $new_text = $text; $new_text =~ s/$old_name/$new_name/g; # Change name (lower case) -my $uc_old_name = uc($old_name); $new_text =~ s/$uc_old_name/uc($new_name)/ge; # Change name (upper case) $new_text =~ s/$old_prefix/$new_prefix/g; # Change other references to prefix (upper case) my $lc_old_prefix = lc($old_prefix); $new_text =~ s/$lc_old_prefix/lc($new_prefix)/ge; # Change other references to prefix (lower case) -open OUTFILE, ">$new_file" or die "could not read $new_file"; +open OUTFILE, ">$new_file" or die "could not read `$new_file'"; print OUTFILE $new_text; system "git add $new_file"; @@ -37,11 +40,11 @@ system "git add $new_file"; my $insertion = <<END; # OBSOLETE MACRO # -# Renamed to $new_name +# Renamed to $uc_new_name # END chomp $insertion; my $old_text = $text; $old_text =~ s/^\# SYNOPSIS/"$insertion\n\# SYNOPSIS"/me; -open OUTFILE, ">$old_file" or die "could not write $old_file"; +open OUTFILE, ">$old_file" or die "could not write `$old_file'"; print OUTFILE $old_text; |