aboutsummaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-07-12 11:18:07 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-07-12 11:18:07 +0200
commit265bbf04645fcdf4adce5db2e9fabfe5aacdc19a (patch)
treeec58a429a3c11f1b41685ba7bbfc68ed2ffe0073 /etc
parented7104094b14109ab5cbf8b696e01eebadb764dd (diff)
Add script for adding lower-case symlinks for upper-case headers
Diffstat (limited to 'etc')
-rwxr-xr-xetc/lowercase-headers24
1 files changed, 24 insertions, 0 deletions
diff --git a/etc/lowercase-headers b/etc/lowercase-headers
new file mode 100755
index 0000000..3a217db
--- /dev/null
+++ b/etc/lowercase-headers
@@ -0,0 +1,24 @@
+#! /usr/bin/env bash
+
+# Create all-lowercase symlinks for .h headers in <dir> (recursively) that
+# contain capital letters in their names.
+#
+usage="usage: $0 <dir>"
+
+trap "{ exit 1; }" ERR
+set -o errtrace # Trap in functions.
+
+function error () { echo "$*" 1>&2; exit 1; }
+
+if [ $# -eq 0 ]; then
+ error "$usage"
+fi
+
+for d in "$@"; do
+ find $d -type f -name '*[[:upper:]]*.h' |
+ while read f; do
+ b="$(basename "$f")"
+ d="$(dirname "$f")"
+ ln -s "$b" "$d/${b,,}"
+ done
+done