chiark / gitweb /
Prep v239: Fix and add debug messages to method_can_shutdown_or_sleep()
[elogind.git] / tools / find-double-newline.sh
1 #!/bin/sh
2 # SPDX-License-Identifier: LGPL-2.1+
3
4 TOP=`git rev-parse --show-toplevel`
5
6 case "$1" in
7
8         recdiff)
9                 if [ "$2" = "" ] ; then
10                         DIR="$TOP"
11                 else
12                         DIR="$2"
13                 fi
14
15                 find $DIR -type f \( -name '*.[ch]' -o -name '*.xml' \) -exec $0 diff \{\} \;
16                 ;;
17
18         recpatch)
19                 if [ "$2" = "" ] ; then
20                         DIR="$TOP"
21                 else
22                         DIR="$2"
23                 fi
24
25                 find $DIR -type f \( -name '*.[ch]' -o -name '*.xml' \) -exec $0 patch \{\} \;
26                 ;;
27
28         diff)
29                 T=`mktemp`
30                 sed '/^$/N;/^\n$/D' < "$2" > "$T"
31                 diff -u "$2" "$T"
32                 rm -f "$T"
33                 ;;
34
35         patch)
36                 sed -i '/^$/N;/^\n$/D' "$2"
37                 ;;
38
39         *)
40                 echo "Expected recdiff|recpatch|diff|patch as verb." >&2
41                 ;;
42 esac