The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/contrib/openzfs/scripts/mancheck.sh

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 #!/bin/sh
    2 #
    3 # Permission to use, copy, modify, and/or distribute this software for
    4 # any purpose with or without fee is hereby granted.
    5 #
    6 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
    7 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
    8 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
    9 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
   10 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
   11 # AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
   12 # OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
   13 #
   14 # shellcheck disable=SC2086
   15 
   16 trap 'rm -f "$stdout_file" "$stderr_file" "$result_file"' EXIT
   17 
   18 if [ "$#" -eq 0 ]; then
   19     echo "Usage: $0 manpage-directory..."
   20     exit 1
   21 fi
   22 
   23 if ! command -v mandoc > /dev/null; then
   24     echo "skipping mancheck because mandoc is not installed"
   25     exit 0
   26 fi
   27 
   28 IFS="
   29 "
   30 files="$(find "$@" -type f -name '*[1-9]*')" || exit 1
   31 
   32 add_excl="$(awk '
   33     /^.\\" lint-ok:/ {
   34         print "-e"
   35         $1 = "mandoc:"
   36         $2 = FILENAME ":[[:digit:]]+:[[:digit:]]+:"
   37         print
   38     }' $files)"
   39 
   40 # Redirect to file instead of 2>&1ing because mandoc flushes inconsistently(?) which tears lines
   41 # https://github.com/openzfs/zfs/pull/12129/checks?check_run_id=2701608671#step:5:3
   42 stdout_file="$(mktemp)"
   43 stderr_file="$(mktemp)"
   44 mandoc -Tlint $files 1>"$stdout_file" 2>"$stderr_file"
   45 result_file="$(mktemp)"
   46 grep -vhE -e 'mandoc: outdated mandoc.db' -e 'STYLE: referenced manual not found' $add_excl "$stdout_file" "$stderr_file" > "$result_file"
   47 
   48 if [ -s "$result_file" ]; then
   49     cat "$result_file"
   50     exit 1
   51 else
   52     echo "no errors found"
   53 fi

Cache object: e10d756331d3a11fb193624956835d04


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.