45 lines
855 B
Bash
45 lines
855 B
Bash
#!/bin/env bash
|
|
|
|
# Usage: ./check_header
|
|
|
|
if pwd | grep -q tools; then
|
|
cd ..
|
|
fi
|
|
|
|
files=$(find yait \( -name '*.c' -o -name '*.h' \))
|
|
files+=" "
|
|
files+=$(find core \( -name '*.c' -o -name '*.h' \))
|
|
files+=" $(find . -maxdepth 1 -type f)"
|
|
|
|
ignore="README COPYING .clang-format config.mak"
|
|
|
|
if [ -z "$files" ]; then
|
|
echo "No files found"
|
|
exit 0
|
|
fi
|
|
|
|
missing=""
|
|
|
|
for file in $files; do
|
|
if echo "$ignore" | grep -qw "$(basename "$file")"; then
|
|
continue
|
|
fi
|
|
echo -ne "$file... "
|
|
if grep -q "Copyright (C)" "$file"; then
|
|
echo -e "\033[1;32mOK\033[0m"
|
|
else
|
|
echo -e "\033[0;31mFAIL\033[0m"
|
|
missing+="$file "
|
|
fi
|
|
done
|
|
|
|
if [ "$missing" = "" ]; then
|
|
echo -e "\033[1;32mAll checks pass.\033[0m"
|
|
else
|
|
echo -e "\033[0;31mThe follwing files are missing copyright information.\033[0m"
|
|
fi
|
|
|
|
for file in $missing; do
|
|
echo " - $file"
|
|
done
|