Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

37 rader
800 B

  1. #!/bin/sh
  2. #
  3. # Check that we have no tabs or trailing spaces in the source code
  4. #
  5. nfails=0
  6. nfiles=0
  7. nlines=0
  8. for dir in caca kernel src cxx examples ruby tools; do
  9. for x in $(make -s echo-sources -C ../$dir); do
  10. case "$x" in
  11. *.c|*.cpp|*.h|*.m)
  12. nfiles=$(($nfiles + 1));
  13. nlines=$(($nlines + `grep -c . "../$dir/$x"`)) ;;
  14. *)
  15. continue ;;
  16. esac
  17. if grep '[[:space:]]$' "../$dir/$x" >/dev/null 2>&1; then
  18. echo "error: $dir/$x contains trailing spaces"
  19. nfails=$(($nfails + 1))
  20. fi
  21. if grep ' ' "../$dir/$x" >/dev/null 2>&1; then
  22. echo "error: $dir/$x contains tabs"
  23. nfails=$(($nfails + 1))
  24. fi
  25. done
  26. done
  27. echo "$nfiles files, $nlines lines, $nfails errors in source code"
  28. if test "$nfails" != "0"; then
  29. exit 1
  30. fi
  31. exit 0