run-uncrustify.sh 735 Bytes
Newer Older
1
#!/bin/bash
2
DATA=$(dirname "$BASH_SOURCE")
3
4
5
6
7
8
9
10
UNCRUSTIFY=$(command -v uncrustify)

if [ -z "$UNCRUSTIFY" ];
then
    echo "Uncrustify is not installed on your system."
    exit 1
fi

11
if [ ! -x "$DATA/lineup-parameters" ];
12
then
13
    echo "Script lineup-parameters does not exists."
14
    exit 1
15
fi
16
17
18

for DIR in "$DATA/../"{src,test,libnautilus-extension,eel,extensions}
do
19
    for FILE in $(find "$DIR" -name "*.c" -not -path "*/gtk/*" -not -path "*/animation/*" -not -path "*/audio-video-properties/*")
20
21
22
23
24
25
    do
        # Aligning prototypes is not working yet, so avoid headers
        "$UNCRUSTIFY" -c "$DATA/uncrustify.cfg" --no-backup "$FILE"
        "$DATA/lineup-parameters" "$FILE" > "$FILE.temp" && mv "$FILE.temp" "$FILE"
   done
done