summaryrefslogtreecommitdiff
path: root/tools/notsd-fixup
diff options
context:
space:
mode:
Diffstat (limited to 'tools/notsd-fixup')
-rwxr-xr-xtools/notsd-fixup25
1 files changed, 25 insertions, 0 deletions
diff --git a/tools/notsd-fixup b/tools/notsd-fixup
new file mode 100755
index 0000000000..71b3bf4dfa
--- /dev/null
+++ b/tools/notsd-fixup
@@ -0,0 +1,25 @@
+#!/usr/bin/env bash
+# Copyright (C) 2015-2016 Luke Shumaker
+
+main() {
+ set -e
+ set -o pipefail
+ export LC_COLLATE=C
+
+ # We wrap the programs called by xargs with `sh` because xargs only exits early
+ # if the status is 255, but we want to exit early for all non-zero statuses.
+ # We use xargs instead of `find -exec` because `-exec` won't do much of
+ # anything useful with the exit status.
+
+ # Makefiles
+ find "$@" -type f -name Makefile -print0 |
+ xargs -r0 sh -c "$0--makefiles \"\$@\" || exit 255" --
+
+ # C includes
+ rm -rf -- "$0"--includes.cache
+ find "$@" \( -name '*.h' -o -name '*.c' -o -name '*.gperf' -o -name '*.gperf.m4' \) -type f -print0 |
+ xargs -r0 sh -c "$0--includes \"\$@\" || exit 255" --
+ rm -rf -- "$0"--includes.cache
+}
+
+main "$@"