diff options
Diffstat (limited to 'tools/find-tabs.sh')
-rwxr-xr-x | tools/find-tabs.sh | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/tools/find-tabs.sh b/tools/find-tabs.sh index 54d922975c..6cea339ac6 100755 --- a/tools/find-tabs.sh +++ b/tools/find-tabs.sh @@ -1,38 +1,40 @@ #!/bin/sh # SPDX-License-Identifier: LGPL-2.1-or-later -TOP=`git rev-parse --show-toplevel` +set -eu -case "$1" in +TOP="$(git rev-parse --show-toplevel)" + +case "${1:-}" in recdiff) - if [ "$2" = "" ] ; then + if [ "${2:-}" = "" ] ; then DIR="$TOP" else DIR="$2" fi - find $DIR -type f \( -name '*.[ch]' -o -name '*.xml' \) -exec $0 diff \{\} \; + find "$DIR" -type f \( -name '*.[ch]' -o -name '*.xml' \) -exec "$0" diff \{\} \; ;; recpatch) - if [ "$2" = "" ] ; then + if [ "${2:-}" = "" ] ; then DIR="$TOP" else DIR="$2" fi - find $DIR -type f \( -name '*.[ch]' -o -name '*.xml' \) -exec $0 patch \{\} \; + find "$DIR" -type f \( -name '*.[ch]' -o -name '*.xml' \) -exec "$0" patch \{\} \; ;; diff) - T=`mktemp` - sed 's/\t/ /g' < "$2" > "$T" + T="$(mktemp)" + sed 's/\t/ /g' <"${2:?}" >"$T" diff -u "$2" "$T" rm -f "$T" ;; patch) - sed -i 's/\t/ /g' "$2" + sed -i 's/\t/ /g' "${2:?}" ;; *) |