#!/bin/sh

# note this works for both a.out and ELF executables

ulimit -c 0

filelist=`sed "s/['\"]/\\\&/g"`
[ -z $filelist ] && exit #emulate -r option for xargs

for f in `echo $filelist | xargs file | fgrep executable | cut -d: -f1`; do
    ldd $f 2>/dev/null | awk '/\=\>/ { print $1 }'
done | sort -u | sed "s/['\"]/\\\&/g" | xargs -n 1 basename | sort -u

