File: overlap.sh

package info (click to toggle)
lzo2 2.10-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,132 kB
  • sloc: ansic: 23,763; sh: 16,636; asm: 1,699; perl: 261; makefile: 195
file content (35 lines) | stat: -rw-r--r-- 681 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#! /bin/sh
set -e

#
# usage: util/overlap.sh [directory]
#
# This script runs the overlap example program
# on a complete directory tree.
#
# Copyright (C) 1996-2017 Markus Franz Xaver Johannes Oberhumer
#

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="${1-.}"

TMPFILE="/tmp/lzo_$$.tmp"
rm -f "$TMPFILE"
(find "$dir/." -type f -print0 | LC_ALL=C sort -z > "$TMPFILE") || true

cat "$TMPFILE" | xargs -0 -r "$OVERLAP"

rm -f "$TMPFILE"
echo "Done."
exit 0

# vim:set ts=4 sw=4 et: