lint-man.sh 1005 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/sh
  2. #
  3. # SPDX-License-Identifier: 0BSD
  4. # spit out ONLY error messages using groff.
  5. existence()
  6. {
  7. command -v "$1" >/dev/null 2>&1
  8. }
  9. if existence groff;
  10. then
  11. echo "groff check"
  12. for f in `find . -name \*\.[1-9]`;
  13. do
  14. LC_ALL=en_US.UTF-8 \
  15. MANROFFSEQ='' \
  16. MANWIDTH=80 \
  17. groff -m mandoc -b -z -w w $f;
  18. done
  19. # FIXME below, grande stupidity.
  20. rm groff_lint.log
  21. echo "Wrong use of B"
  22. for f in `find . -name \*\.[1-9]`;
  23. do
  24. awk '/^\.B$/ {print FILENAME":"NR":"$0}' $f >> groff_lint.log || true
  25. done
  26. fi
  27. echo "mandoc check"
  28. # spit out ONLY error messages with mandoc:
  29. if existence mandoc;
  30. then
  31. mandoc -T lint `find . -name \*\.[1-9]`
  32. fi
  33. #LC_ALL=en_US.UTF-8 MANROFFSEQ='' MANWIDTH=80 /run/current-system/profile/bin/man --warnings -E UTF-8 -l -Tutf8 -Z <*.5> >report5.log
  34. #LC_ALL=en_US.UTF-8 MANROFFSEQ='' MANWIDTH=80 /run/current-system/profile/bin/man --warnings -E UTF-8 -l -Tutf8 -Z <*.1> >report1.log