]> git.ipfire.org Git - thirdparty/systemd.git/blob - tools/find-double-newline.sh
tree-wide: drop spurious newlines (#8764)
[thirdparty/systemd.git] / tools / find-double-newline.sh
1 #!/bin/sh
2 # SPDX-License-Identifier: LGPL-2.1+
3
4 case "$1" in
5
6 recdiff)
7 if [ "$2" = "" ] ; then
8 DIR="$PWD/.."
9 else
10 DIR="$2"
11 fi
12
13 find $DIR -type f \( -name '*.c' -o -name '*.xml' \) -exec $0 diff \{\} \;
14 ;;
15
16 recpatch)
17 if [ "$2" = "" ] ; then
18 DIR="$PWD/.."
19 else
20 DIR="$2"
21 fi
22
23 find $DIR -type f \( -name '*.c' -o -name '*.xml' \) -exec $0 patch \{\} \;
24 ;;
25
26 diff)
27 T=`mktemp`
28 sed '/^$/N;/^\n$/D' < "$2" > "$T"
29 diff -u "$2" "$T"
30 rm -f "$T"
31 ;;
32
33 patch)
34 sed -i '/^$/N;/^\n$/D' "$2"
35 ;;
36
37 *)
38 echo "Expected recdiff|recpatch|diff|patch as verb." >&2
39 ;;
40 esac