diff options
author | Tor Lillqvist <tml@collabora.com> | 2014-04-25 11:02:06 +0300 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2014-04-25 11:05:41 +0300 |
commit | bc4c2098a66bbcf4f3d265dd8e0a154062e4337d (patch) | |
tree | ccc278e03e9587d000cb8ef3c550acf51f025e8e /bin | |
parent | 848e1ca01aa5ba6a283950a08d7fad2f594ecf88 (diff) |
Improve command line handling, don't read stdin
Reading stdin is confusing as it means running the script without any
arguments and with no input redirection just seems to do
nothing. (OTOH, who would use this script except seasoned hackers who
know how command-line tools typically work... oh well.)
Change-Id: I00b4f70b07b6515b52a22b4ec4e048cc84c1dc83
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/ios-mapfile-statistics | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/bin/ios-mapfile-statistics b/bin/ios-mapfile-statistics index 98d33429b900..07f3f0aa68b4 100755 --- a/bin/ios-mapfile-statistics +++ b/bin/ios-mapfile-statistics @@ -17,7 +17,7 @@ sub HELP_MESSAGE { print <<EOS This program parses a linker map file, especially one produced when linking an iOS executable. -Input is read from a command-line argument or from standard input. +Input is read from a map file provided as command-line argument By default a list of libraries used and the size of code and data linked in from each library is printed, in reverse order of size. @@ -31,14 +31,20 @@ The following options are available: EOS } -die "The -f switch makes sense only if -s is also used" if (defined($args{'f'}) && !defined($args{'s'})); +die "The -f switch makes sense only if -s is also used\n" if defined($args{'f'}) && !defined($args{'s'}); + +die "Please provide one map file name\n" if !defined($ARGV[0]); + +die "Just one argument please\n" if defined($ARGV[1]); my $state = 0; my %libofnumber; my %sizeoflib; my %sizeofsym; -while (<>) { +open(INPUT, '<', $ARGV[0]) || die "Could not open $ARGV[0]: $!\n"; + +while (<INPUT>) { if ($state == 0 && m!^# Object files:!) { $state = 1; } elsif ($state == 1 && m!^\[ *([0-9]+)\] .*/([-_a-z0-9]+\.a)\(.*!i) { |