summaryrefslogtreecommitdiff
path: root/util/overlap.sh
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2017-06-22 16:59:16 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2017-06-22 16:59:39 +0900
commit8ff61daa672f051d8ecb537edc94036b6cdaaf3f (patch)
tree455cc4eb438541a1ff3e7bb50c7abc458f189269 /util/overlap.sh
parent79a9578a33ecd3093970bd18df677edc9214fafb (diff)
downloadlzo-8ff61daa672f051d8ecb537edc94036b6cdaaf3f.tar.gz
lzo-8ff61daa672f051d8ecb537edc94036b6cdaaf3f.tar.bz2
lzo-8ff61daa672f051d8ecb537edc94036b6cdaaf3f.zip
Imported Upstream version 2.09
Change-Id: Iff3c94491fe695b43f1d6998f93f56af871806a2 Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'util/overlap.sh')
-rw-r--r--util/overlap.sh28
1 files changed, 18 insertions, 10 deletions
diff --git a/util/overlap.sh b/util/overlap.sh
index 8f3b16b..2e1ffa4 100644
--- a/util/overlap.sh
+++ b/util/overlap.sh
@@ -4,24 +4,32 @@ set -e
#
# usage: util/overlap.sh [directory]
#
-# This script runs the overlap example program on a complete directory tree.
+# This script runs the overlap example program
+# on a complete directory tree.
#
-# Copyright (C) 1996-2014 Markus Franz Xaver Johannes Oberhumer
+# Copyright (C) 1996-2015 Markus Franz Xaver Johannes Oberhumer
#
-OVERLAP="overlap"
-test -x ./examples/overlap && OVERLAP="./examples/overlap"
-test -x ./overlap.exe && OVERLAP="./overlap.exe"
+OVERLAP="./examples/overlap"
+for d in ./examples .; do
+ for ext in "" .exe .out; do
+ if test -f "$d/overlap$ext" && test -x "$d/overlap$ext"; then
+ OVERLAP="$d/overlap$ext"
+ break 2
+ fi
+ done
+done
-dir="${*-.}"
+dir="${1-.}"
TMPFILE="/tmp/lzo_$$.tmp"
-rm -f $TMPFILE
-(find $dir/ -type f -print0 > $TMPFILE) || true
+rm -f "$TMPFILE"
+(find "$dir/." -type f -print0 | LC_ALL=C sort -z > "$TMPFILE") || true
-cat $TMPFILE | xargs -0 -r $OVERLAP
+cat "$TMPFILE" | xargs -0 -r "$OVERLAP"
-rm -f $TMPFILE
+rm -f "$TMPFILE"
echo "Done."
exit 0
+# vim:set ts=4 sw=4 et: