]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/tools/whitespace.sh
Move scripts to qcsrc/tools
[xonotic/xonotic-data.pk3dir.git] / qcsrc / tools / whitespace.sh
diff --git a/qcsrc/tools/whitespace.sh b/qcsrc/tools/whitespace.sh
new file mode 100755 (executable)
index 0000000..5662337
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/bash
+set -eu
+cd "$(dirname "$0")"
+cd ..
+
+function check() {
+    declare -l base="${1}"
+    find "$base" -type f -print0 | sort -z | xargs -0 sed -i \
+        `# strip trailing spaces`                            \
+        -e 's/[[:space:]]*$//'                               \
+        `# line feed at EOF for #include to work properly`   \
+        -e '$a\'
+}
+
+check lib
+check common
+check client
+check server
+check menu