check_register.sh 612 B

12345678910111213141516171819202122
  1. #!/bin/bash
  2. stcolor=$(tput sgr0)
  3. datacolor=$(tput setaf 2)
  4. filecolor=$(tput setaf 1)
  5. process_file()
  6. {
  7. datas=$(grep "data_register(" $f| awk -F',' '{print $1}' | awk -F'(' '{print $2}' | tr -d '&' | sed 's/\[/\\\[/g' | sed 's/\]/\\\]/g' | sed 's/\*/\\\*/g')
  8. for data in $datas ; do
  9. x=$(grep "data_unregister($data" $1)
  10. if test "$x" == "" ; then
  11. x=$(grep "data_unregister_no_coherency($data" $1)
  12. if test "$x" == "" ; then
  13. echo "Error. File <${filecolor}$1${stcolor}>. Handle <${datacolor}$data${stcolor}> is not unregistered"
  14. fi
  15. fi
  16. done
  17. }
  18. for f in $* ; do process_file $f ; done