doctest 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #!/bin/bash
  2. # Midnight Commander - check the documentation for compatibility with groff and nroff.
  3. #
  4. # Copyright (C) 2002, 2003, 2011, 2013
  5. # The Free Software Foundation, Inc.
  6. #
  7. # Written by:
  8. # Pavel Roskin <proski@gnu.org> 2002, 2003
  9. # Ilia Maslakov <il.smind@gmail.com>, 2011
  10. # Slava Zanko <slavazanko@gmail.com>, 2013
  11. #
  12. # This file is part of the Midnight Commander.
  13. #
  14. # The Midnight Commander is free software: you can redistribute it
  15. # and/or modify it under the terms of the GNU General Public License as
  16. # published by the Free Software Foundation, either version 3 of the License,
  17. # or (at your option) any later version.
  18. #
  19. # The Midnight Commander is distributed in the hope that it will be useful,
  20. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. # GNU General Public License for more details.
  23. #
  24. # You should have received a copy of the GNU General Public License
  25. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  26. set +e
  27. MC_SOURCE_ROOT_DIR=${MC_SOURCE_ROOT_DIR:-$(dirname "$(pwd)")}
  28. #*** main code *********************************************************
  29. [ -r "${MC_SOURCE_ROOT_DIR}/doc/man/mc.1.in" ] || {
  30. echo "ERROR: cannot read doc/man/mc.1.in" 2>&1
  31. exit 1
  32. }
  33. for cmd in groff nroff ; do
  34. IFS='' ROFF_WARNINGS="$ROFF_WARNINGS
  35. $(
  36. find "${MC_SOURCE_ROOT_DIR}/doc" -name '*.[1-9].in' \
  37. -exec sh -c "$cmd -K UTF-8 -Tutf8 -mandoc -ww '{}' | grep 'warning:'" \; 2>&1
  38. )"
  39. done
  40. # Check that English manuals are in ASCII
  41. ASCII_WARNINGS=$(find "${MC_SOURCE_ROOT_DIR}/doc" -maxdepth 1 -name '*.[1-9].in' -exec groff -Tascii -ww {} \; 2>&1)
  42. if [ "x`printf '%s' "${ROFF_WARNINGS}${ASCII_WARNINGS}" | tr -d "$IFS"`" != x ] ; then
  43. echo "$ROFF_WARNINGS" | sort -u | grep .
  44. echo "$ASCII_WARNINGS" | sort -u | grep .
  45. exit 1
  46. fi