X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; q=dns; s=default; b=eAFthlD29PrCUyjoxmaNi60Rj3JDoj9IzBZeTSKfrIY wu19XwW5tOOVvt0pOI7pXr6MiLvt5rmq2jH1hQsHMn/dvykW+mH7L4c4O01PsWxw 0TFvhcIgVPwSzAVBUtSYjblWJwmxoJmHzDxt/CgxPvFZOPBxjRCF/HGQu7K96xX0 = DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:message-id:date:from:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; s=default; bh=2696dhVOYqvaIE/Mz5nvV0QxyaY=; b=hoVsNF1Xl4jEcMz6N 2w+QM5uf21EUuMmMUNFqWEKLr3KRuwqPbC3q/rq+QpnouWgliMkzwHuA3zKP3SjG uIe/DKX8bRjCvhNd5VD1N0rucr3BWd61A2F8NdEXKrapOZAU5VV0QENzG1Jkc3U5 TKnWTukWyW9O2VJgPcjkrJVmOc= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: etr-usa.com Message-ID: <52F92D58.9030408@etr-usa.com> Date: Mon, 10 Feb 2014 12:49:44 -0700 From: Warren Young User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0 MIME-Version: 1.0 To: Cygwin-L Subject: Re: get rid of getpwent? (Was: cygwin-1.7.28 getpwent header declaration changes ?) 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> In-Reply-To: <52F8B50E.7040307@lysator.liu.se> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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