# transformation on file names. Thus, I arrange that all _my_
# variables stay as far out of its likely namespace as they can.
+$usage =
+ "usage: multi [flags] <cmd> <action> <files>\n" .
+ " e.g. multi mv 'tr/A-Z/a-z/' *\n" .
+ " or: multi [flags] - <multiple-word-cmd> - <action> <files>\n" .
+ " e.g. multi - svn mv - 'tr/A-Z/a-z/' *\n" .
+ "where: -n print commands, but do not execute\n" .
+ "where: -q execute commands, but do not print\n" .
+ "where: -r reverse order of filenames passed to commands\n" .
+ " also: multi --version report version number\n" .
+ " multi --help display this help text\n" .
+ " multi --licence display (MIT) licence text\n";
+
+$licence =
+ "multi is copyright 1999-2004 Simon Tatham.\n" .
+ "\n" .
+ "Permission is hereby granted, free of charge, to any person\n" .
+ "obtaining a copy of this software and associated documentation files\n" .
+ "(the \"Software\"), to deal in the Software without restriction,\n" .
+ "including without limitation the rights to use, copy, modify, merge,\n" .
+ "publish, distribute, sublicense, and/or sell copies of the Software,\n" .
+ "and to permit persons to whom the Software is furnished to do so,\n" .
+ "subject to the following conditions:\n" .
+ "\n" .
+ "The above copyright notice and this permission notice shall be\n" .
+ "included in all copies or substantial portions of the Software.\n" .
+ "\n" .
+ "THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\n" .
+ "EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n" .
+ "MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\n" .
+ "NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS\n" .
+ "BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN\n" .
+ "ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n" .
+ "CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n" .
+ "SOFTWARE.\n";
+
$__quiet = $__donothing = $__reverse = 0;
while ($ARGV[0] =~ /^-(.+)$/) {
$__quiet = 1, next if $1 eq "q";
$__quiet = 0, $__donothing = 1, next if $1 eq "n";
$__reverse = 1, next if $1 eq "r";
+ if ($1 eq "-help") {
+ print STDERR $usage;
+ exit 0;
+ } elsif ($1 eq "-version") {
+ if ('$Revision$' =~ /Revision:\s+(\d+)/) {
+ print "multi revision $1\n";
+ } else {
+ print "multi: unknown revision\n";
+ }
+ exit 0;
+ } elsif ($1 eq "-licence" or $1 eq "-license") {
+ print $licence;
+ exit 0;
+ }
}
-die "usage: multi <cmd> <action> <files>\n" .
- " e.g. multi mv 'tr/A-Z/a-z/' *\n" if $#ARGV < 2;
- " also: multi - <multiple-word-cmd> - <action> <files>\n" .
- " or multi - svn mv - 'tr/A-Z/a-z/' *\n" if $#ARGV < 2;
+die $usage if $#ARGV < 2;
@__cmd = ();
if ($ARGV[0] eq "-") {