diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2016-07-12 11:18:07 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2016-07-12 11:18:07 +0200 |
commit | 265bbf04645fcdf4adce5db2e9fabfe5aacdc19a (patch) | |
tree | ec58a429a3c11f1b41685ba7bbfc68ed2ffe0073 /etc/lowercase-headers | |
parent | ed7104094b14109ab5cbf8b696e01eebadb764dd (diff) |
Add script for adding lower-case symlinks for upper-case headers
Diffstat (limited to 'etc/lowercase-headers')
-rwxr-xr-x | etc/lowercase-headers | 24 |
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 |