cvsuser 04/11/07 07:28:56
Modified: tools/dev nm.pl
Log:
Add more single-letter aliases for options.
Revision Changes Path
1.6 +57 -34 parrot/tools/dev/nm.pl
Index: nm.pl
===================================================================
RCS file: /cvs/public/parrot/tools/dev/nm.pl,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- nm.pl 7 Nov 2004 15:18:46 -0000 1.5
+++ nm.pl 7 Nov 2004 15:28:56 -0000 1.6
@@ -1,6 +1,6 @@
#!/usr/bin/perl -w
# Copyright: 2004 The Perl Foundation. All Rights Reserved.
-# $Id: nm.pl,v 1.5 2004/11/07 15:18:46 jhi Exp $
+# $Id: nm.pl,v 1.6 2004/11/07 15:28:56 jhi Exp $
=head1 NAME
@@ -27,22 +27,32 @@
=item C<--code>
+=item C<-c>
+
List the code/text symbols.
=item C<--data>
+=item C<-d>
+
List the data symbols.
=item C<--init>
+=item C<-i>
+
List the initialised data symbols.
=item C<--uninit>
+=item C<-u>
+
List the uninitialised data symbols.
=item C<--const>
+=item C<-C>
+
List the constant (read-only) data symbols.
Not all platforms support this, a warning will be given if not. You can
@@ -50,14 +60,20 @@
=item C<--undef>
+=item C<-U>
+
List the undefined symbols.
=item C<--def>
+=item C<-D>
+
List the defined symbols.
=item C<--file>
+=item C<-f>
+
List the file(name) symbols.
=back
@@ -69,6 +85,8 @@
=item C<--objectname>
+=item C<-o>
+
Prepend the object name before the symbol name.
=item C<--t>
@@ -87,10 +105,14 @@
=item C<--type=bsd>
+=item C<-B>
+
The same as C<--t>.
=item C<--type=long>
+=item C<-L>
+
Append a long type (e.g. "global_const_init_data" versus "R") to the
symbol name.
@@ -117,10 +139,10 @@
require 5.005;
-$VERSION = sprintf "%d.%d", q$Revision: 1.5 $ =~ /(\d+)/g; # [EMAIL
PROTECTED];
+$VERSION = sprintf "%d.%d", q$Revision: 1.6 $ =~ /(\d+)/g; # [EMAIL
PROTECTED];
my $ME = basename($0);
-my $RCS_DATE = q$Date: 2004/11/07 15:18:46 $;
+my $RCS_DATE = q$Date: 2004/11/07 15:28:56 $;
my $nm_cmd = 'nm';
my $nm_opt = '';
@@ -141,25 +163,24 @@
$ME: Usage: $ME [options] [ foo.o ... | bar.a | other_library_format ]
Portable frontend for nm(1); by default lists all the code and data symbols
in the object or archive files. The options can be used to limit the
symbols:
---code code/text symbols (Tt)
---data data symbols (Dd, Bb)
---init initialised data symbols (Dd)
---uninit uninitialised data symbols (Bb)
---const const (read-only) data symbols (Rr) [1]
---undef undefined symbols (Uu)
---def defined symbols (not Uu)
---file file(name) symbols (Ff)
+--code|-c code/text symbols (Tt)
+--data|-d data symbols (Dd, Bb)
+--init|-i initialised data symbols (Dd)
+--uninit|-u uninitialised data symbols (Bb)
+--const|-C const (read-only) data symbols (Rr) [1]
+--undef|-U undefined symbols (Uu)
+--def|-D defined symbols (not Uu)
+--file|-f file(name) symbols (Ff)
If more than one of all the above options are given, they are ANDed.
They can also be negated with a "no", for example --noconst.
[1] Not all platforms support this, a warning will be given if not.
You can try GNU nm if you want this feature.
---objectname prepend the object name before the symbol name
+--objectname|-o prepend the object name before the symbol name
--t append the short BSD-style type (in parentheses above)
---type=bsd same as --t (also -B works)
---type=long append a long type (e.g. "global_const_init_data" versus "R")
- (also -L works)
---help show this help
---version show version
+--type=bsd|-B same as --t
+--type=long|-L append a long type (e.g. "global_const_init_data"
versus "R")
+--help|-h show this help
+--version|-v show version
All the options can be shortened to their unique prefixes,
and one leading dash ("-") can be used instead of two ("--").
__EOF__
@@ -187,23 +208,25 @@
# Hope for BSD-style nm output.
}
-unless (GetOptions('code!' => \$Code,
- 'data!' => \$Data,
- 'init!' => \$Init,
- 'uninit!' => \$Uninit,
- 'const!' => \$Const,
- 'global!' => \$Global,
- 'local!' => \$Local,
- 'undef!' => \$Undef,
- 'def!' => \$Def,
- 'file!' => \$File,
- 'objectname' => \$ObjectName,
- 't' => \$Type,
- 'bsd|B' => \$BSD,
- 'long|L' => \$Long,
- 'type:s' => \$Type,
- 'help' => \$Help,
- 'version' => \$Version,
+Getopt::Long::Configure ("bundling");
+
+unless (GetOptions('code|c!' => \$Code,
+ 'data|d!' => \$Data,
+ 'init|i!' => \$Init,
+ 'uninit|u!' => \$Uninit,
+ 'const|C!' => \$Const,
+ 'global|g!' => \$Global,
+ 'local|l!' => \$Local,
+ 'undef|U!' => \$Undef,
+ 'def|D!' => \$Def,
+ 'file|f!' => \$File,
+ 'objectname|o' => \$ObjectName,
+ 't' => \$Type,
+ 'bsd|B' => \$BSD,
+ 'long|L' => \$Long,
+ 'type:s' => \$Type,
+ 'help|h' => \$Help,
+ 'version|v' => \$Version,
)) {
show_help();
exit(1);