From 265bbf04645fcdf4adce5db2e9fabfe5aacdc19a Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 12 Jul 2016 11:18:07 +0200 Subject: Add script for adding lower-case symlinks for upper-case headers --- etc/lowercase-headers | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 etc/lowercase-headers (limited to 'etc') 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 (recursively) that +# contain capital letters in their names. +# +usage="usage: $0 " + +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 -- cgit v1.1