1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-10 00:23:32 +02:00
Files
dox2-src
help
images
lib-src
locale
m4
mac
nyquist
plug-ins
presets
qa
scripts
mw2html_audacity
dot-emacs
mac_release_build
mailman-discard.pl
makeindex.pl
maketarball
maketarball.sh
mkdmg
pipe-test.pl
reindent
src
tests
win
LICENSE.txt
Makefile.in
README.txt
audacity.dox
config.guess
config.sub
configure
configure.in
install-sh
todo.txt
audacity/scripts/reindent

41 lines
945 B
Perl
Executable File

#!/usr/bin/perl -w
sub mydie {
my $message = shift;
print "ERROR: $message\n";
exit 1;
}
print "reindent - reformat specified files to match Audacity guidelines.\n";
# check for indent and correct version
$indent = `which indent`;
chomp $indent;
-x $indent || mydie "GNU indent must be installed and in your path";
$version = `$indent --version`;
($major, $minor, $subminor) = ($version =~ /(\d+)\.(\d+)\.(\d+)/);
if($major < 2 ||
($major == 2 && $minor < 2) ||
($major == 2 && $minor == 2 && $subminor < 4)) {
mydie "GNU indent must be at least version 2.2.6 (found: $major.$minor.$subminor)";
}
mydie "no files specified" unless @ARGV;
# everything checks out, proceed...
foreach my $file (@ARGV) {
mydie "file \"$file\" does not exist" unless -e $file;
print "indenting $file...\n";
system("$indent -kr -nut -i3 -nsob $file");
system("rm $file~");
}
# arch-tag: b30b2ac9-5f36-4226-8b79-cb8ebfb908e1