From: Nick Bowler Date: Sat, 23 May 2020 20:33:25 +0000 (-0400) Subject: Fix print_usage file handle in the perl scripts. X-Git-Url: https://git.draconx.ca/gitweb/mpdhacks.git/commitdiff_plain/8a39a0fd4ed8d545759e07937fa4c66f5d324987 Fix print_usage file handle in the perl scripts. Due to an off-by-one error all the perl scripts are printing the usage line to standard error in the --help output, instead of standard output as expected. Fix that up. --- diff --git a/mpdexec.pl b/mpdexec.pl index 496c558..4d25ead 100755 --- a/mpdexec.pl +++ b/mpdexec.pl @@ -40,10 +40,10 @@ EOF } sub print_usage { - my $fh = $_[1] // *STDERR; + my ($fh) = (@_, *STDERR); print $fh "Usage: $0 [options] [command ...]\n"; - print "Try $0 --help for more information.\n" unless (@_ > 0); + print $fh "Try $0 --help for more information.\n" unless (@_ > 0); } sub print_help { diff --git a/mpdmenu.pl b/mpdmenu.pl index 526772a..3cc0e35 100755 --- a/mpdmenu.pl +++ b/mpdmenu.pl @@ -453,10 +453,10 @@ EOF } sub print_usage { - my $fh = $_[1] // *STDERR; + my ($fh) = (@_, *STDERR); print $fh "Usage: $0 [options]\n"; - print "Try $0 --help for more information.\n" unless (@_ > 0); + print $fh "Try $0 --help for more information.\n" unless (@_ > 0); } sub print_help { diff --git a/mpdreload.pl b/mpdreload.pl index 6305783..c852a2b 100755 --- a/mpdreload.pl +++ b/mpdreload.pl @@ -90,10 +90,10 @@ EOF } sub print_usage { - my $fh = $_[1] // *STDERR; + my ($fh) = (@_, *STDERR); print $fh "Usage: $0 [options] playlist\n"; - print "Try $0 --help for more information.\n" unless (@_ > 0); + print $fh "Try $0 --help for more information.\n" unless (@_ > 0); } sub print_help {