summaryrefslogtreecommitdiff
path: root/build-aux/lint-h
diff options
context:
space:
mode:
authorLuke T. Shumaker <lukeshu@lukeshu.com>2025-01-27 22:59:31 -0700
committerLuke T. Shumaker <lukeshu@lukeshu.com>2025-01-27 23:05:01 -0700
commitfdd80b98e9419dc0eaaa367f919252420d4f7676 (patch)
tree4d428f1a8111f43455a5ee272df73dd13dc25202 /build-aux/lint-h
parent5b725e3888442777bdb5c0d656238a13414990b3 (diff)
make lint: Have the output be a little prettier
Diffstat (limited to 'build-aux/lint-h')
-rwxr-xr-xbuild-aux/lint-h10
1 files changed, 9 insertions, 1 deletions
diff --git a/build-aux/lint-h b/build-aux/lint-h
index 965d7d8..26ac13d 100755
--- a/build-aux/lint-h
+++ b/build-aux/lint-h
@@ -4,6 +4,14 @@
# Copyright (C) 2024-2025 Luke T. Shumaker <lukeshu@lukeshu.com>
# SPDX-License-Identifier: AGPL-3.0-or-later
+RED=$(tput setaf 1)
+RESET=$(tput sgr0)
+
+err() {
+ printf "${RED}%s${RESET}: %s\n" "$1" "$2" >&2
+ r=1
+}
+
r=0
for filename in "$@"; do
dscname=$(./build-aux/get-dscname "$filename")
@@ -13,7 +21,7 @@ for filename in "$@"; do
if ! { grep -Fxq "#ifndef ${guard}" "$filename" &&
grep -Fxq "#define ${guard}" "$filename" &&
grep -Fxq "#endif /* ${guard} */" "$filename"; }; then
- echo "$filename does not have ${guard} guard"; r=1
+ err "$filename" "does not have ${guard} guard"
fi
done
exit $r