blob: dd9c42aaa7bd0edfff17c5e01f4904d5cced81fb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
#! /usr/bin/env bash
# file : etc/lowercase-headers
# copyright : Copyright (c) 2014-2017 Code Synthesis Ltd
# license : MIT; see accompanying LICENSE file
# 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
|