summaryrefslogtreecommitdiffstats
path: root/src/util/padimg.pl
diff options
context:
space:
mode:
authorMichael Brown2009-04-16 07:13:09 +0200
committerMichael Brown2009-04-16 07:13:09 +0200
commitb4a87daeb92453e5ae35e001bd0c477f41aea8a3 (patch)
tree5dab89a8690db9941e3aefc87a879176680fef60 /src/util/padimg.pl
parent[build] Reinstate the .pdsk padded-floppy image format (diff)
downloadipxe-b4a87daeb92453e5ae35e001bd0c477f41aea8a3.tar.gz
ipxe-b4a87daeb92453e5ae35e001bd0c477f41aea8a3.tar.xz
ipxe-b4a87daeb92453e5ae35e001bd0c477f41aea8a3.zip
[build] Simplify use of Getopt::Long in padimg.pl
Sometimes it's just so much fun doing things the complicated way that you forget to check the man page for the existence of a simpler syntax.
Diffstat (limited to 'src/util/padimg.pl')
-rwxr-xr-xsrc/util/padimg.pl7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/util/padimg.pl b/src/util/padimg.pl
index 71d0eee8..4421aaf4 100755
--- a/src/util/padimg.pl
+++ b/src/util/padimg.pl
@@ -9,16 +9,15 @@ my $verbosity = 0;
my $blksize = 512;
my $byte = 0;
-my $opts = {
+my %opts = (
'verbose|v+' => sub { $verbosity++; },
'quiet|q+' => sub { $verbosity--; },
'blksize|s=o' => sub { $blksize = $_[1]; },
'byte|b=o' => sub { $byte = $_[1]; },
-};
+);
Getopt::Long::Configure ( 'bundling', 'auto_abbrev' );
-GetOptions ( { map { /^(\w+)/; $1 => $opts->{$_} } keys %$opts }, keys %$opts )
- or die "Could not parse command-line options\n";
+GetOptions ( %opts ) or die "Could not parse command-line options\n";
while ( my $filename = shift ) {
die "$filename is not a file\n" unless -f $filename;