Radek Krejci | cc3a1b6 | 2020-07-20 07:43:08 +0200 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | RETVAL=0 |
| 4 | |
| 5 | # param SRCDIR - path to the source files to search |
| 6 | SRC=$1 |
| 7 | |
| 8 | # param FUNC - name of the function in compat to check |
| 9 | function check_compat_func { |
| 10 | FILES=`grep -rE "([^[:alnum:]]|^)$1\([^\)]+\)" --include=\*.{c,h} $SRC | cut -d: -f1 | uniq` |
| 11 | for f in $FILES; do |
| 12 | grep -q "#include \"compat.h\"" $f |
| 13 | if [ $? -ne 0 ]; then |
| 14 | echo "Missing #include \"compat.h\" in file $f for function $1()" |
| 15 | RETVAL=$((RETVAL+1)) |
| 16 | fi |
| 17 | done |
| 18 | } |
| 19 | |
| 20 | check_compat_func asprintf |
| 21 | check_compat_func get_current_dir_name |
| 22 | check_compat_func getline |
| 23 | check_compat_func strndup |
| 24 | check_compat_func strnstr |
| 25 | check_compat_func vasprintf |
| 26 | check_compat_func vdprintf |
| 27 | |
| 28 | exit $RETVAL |