-filelist=`sed "s/['\"]/\\\&/g"`
-exelist=`echo $filelist | xargs -r file | egrep -v ":.* (commands|script) " | \
- grep ":.*executable" | cut -d: -f1`
-scriptlist=`echo $filelist | xargs -r file | \
- egrep ":.* (commands|script) " | cut -d: -f1`
-liblist=`echo $filelist | xargs -r file | \
- grep ":.*shared object" | cut -d : -f1`
+#
+# --- Set needed to 0 for traditional find-requires behavior.
+needed=1
+if [ X"$1" = Xldd ]; then
+ needed=0
+elif [ X"$1" = Xobjdump ]; then
+ needed=1
+fi
+
+#
+# --- Grab the file manifest and classify files.
+#filelist=`sed "s/[]['\"*?{}]/\\\\\&/g"`
+filelist=($(grep -Ev '/usr/doc/|/usr/share/doc/'))
+exelist=($(printf "%s\0" "${filelist[@]}" | xargs -0 -r file | \
+ grep -Ev ":.* (commands|script)[, ]" | \
+ grep ":.*executable" | cut -d: -f1))
+scriptlist=($(printf "%s\0" "${filelist[@]}" | xargs -0 -r file | \
+ grep -E ":.* (commands|script)[, ]" | cut -d: -f1))
+liblist=($(printf "%s\0" "${filelist[@]}" | xargs -0 -r file | \
+ grep ":.*shared object" | cut -d : -f1))