2 # SPDX-License-Identifier: BSD-3-Clause
3 # Copyright 2017 Mellanox Technologies, Ltd
5 # Check C files in git repository for duplicated includes.
6 # Usage: devtools/check-dup-includes.sh [directory]
8 dir=${1:-$(dirname $(readlink -f $0))/..}
11 # speed up by ignoring Unicode details
14 for file in $(git ls-files '*.[ch]') ; do
15 sed -rn 's,^[[:space:]]*#include[[:space:]]*[<"](.*)[>"].*,\1,p' $file |
17 sed "s,^,$file: duplicated include: ,"