=================================================================== RCS file: /cvs/openbsd/fill_chroot/find_depends,v retrieving revision 1.2 retrieving revision 1.5 diff -u -r1.2 -r1.5 --- openbsd/fill_chroot/find_depends 2005/12/21 18:16:03 1.2 +++ openbsd/fill_chroot/find_depends 2005/12/21 19:14:12 1.5 @@ -1,15 +1,25 @@ #!/usr/bin/perl -# $RedRiver: find_depends,v 1.1 2005/12/21 18:04:06 andrew Exp $ +# $RedRiver: find_depends,v 1.4 2005/12/21 18:37:38 andrew Exp $ use strict; use warnings; -# find /home/andrew/www/ -name *.so* | xargs find_depends | sort -u | xargs -I {} cp {} /home/andrew/www{} +my %opts; +my @Files; -die unless @ARGV; +foreach (@ARGV) { + if (/^-+(\w+)$/) { + $opts{$1} = 1; + } else { + push @Files, $_; + } +} +Help() if $opts{h} || $opts{help}; +Usage() unless @Files; + my %libs; -foreach my $file (@ARGV) { +foreach my $file (@Files) { my $l = find_libs($file); foreach (keys %{ $l }) { @@ -23,13 +33,36 @@ exit; +sub Usage +{ + print "Usage: $0 [-v] file [file2 [file3 [...]]]\n"; + exit; +} + +sub Help +{ + print <) { if (m|^(/[^\w\/]+/)?lib(\S+)\.(\d+)\.(\d+)|) { @@ -78,7 +111,8 @@ my $ldconfig = '/sbin/ldconfig'; my (%paths, %libs); - open my $ld, '-|', $ldconfig, '-r' or die; + open my $ld, '-|', $ldconfig, '-r' + or die "Couldn't open pipe to ldconfig: $!"; while (<$ld>) { chomp; if (/search directories:\s+(.*)/) {