#!/usr/bin/perl -dw
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
#NAME
#  mkhdrfiles -
#
#SYNOPSIS
#  mkhdrfiles [file]..
#
#REQUIRES
#
#DESCRIPTION
#
#OPTIONS
#
#EXAMPLES
#
#FILES
#
#BUGS
#
#SEE ALSO
#
#AUTHOR
#  John Chambers <jc@trillian.mit.edu>
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #

$| = 1;
$exitstat = 0;
($P = $0) =~ s".*/"";
$V = $ENV{"V_$P"} || $ENV{"D_$P"} || 2;	# Verbose level.

for $file (@ARGV) {
	($title = $file) =~ s"hdr/"";
	$title =~ s/\.hdr$//;
	print "$title:\n";
	if ($title =~ /^AGW/) {
		$title =~ s/AGW0*/ Scottish Waltzes /
	} else {
		$title =~ s/([A-Z])/ $1/g;
	}
	if (open(FILE,">$file")) {
		print FILE "X: 0\n";
		print FILE "T:$title\n";
		print FILE "K:\n";
		close FILE;
	} else {
		print STDERR "### Can't write '$file' ($!) ###\n";
	}
}

print "$P: Exit with status $exitstat.\n" if $V>1;
exit $exitstat;

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #
