This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: get rid of getpwent? (Was: cygwin-1.7.28 getpwent header declaration changes ?)
- From: Warren Young <warren at etr-usa dot com>
- To: Cygwin-L <cygwin at cygwin dot com>
- Date: Mon, 10 Feb 2014 12:49:44 -0700
- Subject: Re: get rid of getpwent? (Was: cygwin-1.7.28 getpwent header declaration changes ?)
- Authentication-results: sourceware.org; auth=none
- References: <52F339CA dot 5070305 at gmail dot com> <20140206090117 dot GD2821 at calimero dot vinschen dot de> <52F361C5 dot 3000807 at gmail dot com> <20140206141321 dot GI2821 at calimero dot vinschen dot de> <52F40208 dot 5030901 at etr-usa dot com> <20140207094917 dot GN2821 at calimero dot vinschen dot de> <52F4E540 dot 2010606 at tiscali dot co dot uk> <52F51D19 dot 6080807 at etr-usa dot com> <31347914-BB4F-4039-984B-731B6C72F903 at etr-usa dot com> <52F7AEC5 dot 5090205 at tiscali dot co dot uk> <8B7B5FE0-7413-4358-BA8A-E0B6E0B17653 at etr-usa dot com> <52F8B50E dot 7040307 at lysator dot liu dot se>
On 2/10/2014 04:16, Peter Rosin wrote:
On 2014-02-10 10:02, Warren Young wrote:
there *has* to be a better way than strings(1) to extract an EXE's list of DLL imports.
objdump -x /bin/foo.exe
Thank you!
-x turns on 6 other flags, the only one of which that really matters
here is -p. The output is complex enough that I decided to write a
better parser than a grep call. Here's my new checkfile script:
#!/usr/bin/perl -w
my ($exe, $symbol) = @ARGV;
my $in_cygdll = 0;
die "usage: $0 exename symbol\n" unless length($symbol);
open my $dump, '-|', "objdump -p '$exe'" or die "Can't dump $exe: $!\n";
while (<$dump>) {
if (m/DLL Name: cygwin1.dll/) {
$in_cygdll = 1;
}
elsif (m/DLL Name: /) {
last; # Last cygwin1.dll symbol found; on to another DLL
}
elsif ($in_cygdll) {
my @parts = split;
if (@parts == 3 and $parts[2] eq $symbol) {
print "$exe\n";
last;
}
}
}
Run it like before, except that it takes the import name to search for
as a second parameter now:
$ find /bin -name \*.exe -exec ./checkfile {} getpwent \;
I don't have my "almost everything" Cygwin install here to run it
against, so unless someone beats me to it, I won't be posting results
for many hours at least.
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple