]>
git.ipfire.org Git - thirdparty/pdns.git/blob - build-scripts/format-code
9adac8b73d07313e1ce00476d8df07fc037c6efd
4 # Reformat code, but do not touch if no changes.
7 if [ "$0" != "./build-scripts/format-code" -a "$0" != "build-scripts/format-code" ]; then
8 echo "Please run me from the root checkout dir"
13 echo usage
: $0 file...
15 echo format C
++ files
, does not
touch non-regular files
18 if [ ! -e .clang-format
]; then
19 echo "No .clang-format file found in .";
28 FORMAT
=clang-format-19
29 if ! which $FORMAT 2> /dev
/null
; then
33 if [ $verbose = 1 ]; then
34 echo Using executable
$FORMAT
37 for file in "${@}"; do
38 if [ -h "$file" -o ! -f "$file" ]; then
39 if [ $verbose = 1 ]; then
40 echo "$file: skipped, not a regular file or unreadable"
44 tmp
=$
(mktemp
"$file.XXXXXXXX")
45 if ! $FORMAT -style=file "$file" > "$tmp"; then
48 if ! cmp -s "$file" "$tmp"; then
49 echo "$file: reformatted"
52 if [ $verbose = 1 ]; then
53 echo "$file: already formatted to perfection"