#!/usr/bin/env bash if pwd | grep -q tools; then cd .. fi files=$(find iota/ \( -name '*.c' -o -name '*.h' \)) files+=" $(find . -maxdepth 1 -type f)" ignore="README COPYING .clang-format" 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