1 1.1 joerg #!/bin/sh 2 1.1.1.5 christos # Copyright (c) 2013,2014,2015,2017,2018 Ingo Schwarze <schwarze (at] openbsd.org> 3 1.1 joerg # 4 1.1 joerg # Permission to use, copy, modify, and distribute this software for any 5 1.1 joerg # purpose with or without fee is hereby granted, provided that the above 6 1.1 joerg # copyright notice and this permission notice appear in all copies. 7 1.1 joerg # 8 1.1 joerg # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 1.1 joerg # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 1.1 joerg # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 1.1 joerg # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 1.1 joerg # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 1.1 joerg # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 1.1 joerg # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 1.1 joerg 16 1.1 joerg if [ `id -u` -eq 0 ]; then 17 1.1 joerg echo "$0: do not run me as root" 18 1.1 joerg exit 1 19 1.1 joerg fi 20 1.1 joerg 21 1.1 joerg if [ $# -eq 0 ]; then 22 1.1.1.5 christos echo "usage: $0 [-h|-u] manual_source_file ..." 23 1.1 joerg exit 1 24 1.1 joerg fi 25 1.1 joerg 26 1.1.1.2 christos if [ "X$1" = "X-h" ]; then 27 1.1.1.2 christos shift 28 1.1.1.2 christos export PATH="/usr/local/heirloom-doctools/bin:$PATH" 29 1.1.1.2 christos EQN="neqn" 30 1.1.1.2 christos ROFF="nroff" 31 1.1.1.5 christos MOPT="-Ios=BSD -Tascii $MOPT" 32 1.1.1.5 christos COLPIPE="col -b" 33 1.1.1.5 christos elif [ "X$1" = "X-u" ]; then 34 1.1.1.5 christos shift 35 1.1.1.5 christos ROFF="groff -ket -ww -Tutf8 -P -c" 36 1.1.1.5 christos MOPT="-Ios=OpenBSD -Wall -Tutf8 $MOPT" 37 1.1.1.5 christos COLPIPE="cat" 38 1.1.1.2 christos else 39 1.1.1.6 christos ROFF="groff -ket -ww -mtty-char -Tascii -P -c" 40 1.1.1.5 christos MOPT="-Ios=OpenBSD -Wall -Tascii $MOPT" 41 1.1.1.5 christos COLPIPE="cat" 42 1.1.1.2 christos fi 43 1.1.1.2 christos 44 1.1 joerg while [ -n "$1" ]; do 45 1.1 joerg file=$1 46 1.1 joerg shift 47 1.1 joerg echo " ========== $file ========== " 48 1.1.1.5 christos $ROFF -mandoc $file | $COLPIPE 2> /tmp/roff.err > /tmp/roff.out 49 1.1.1.5 christos ${MANDOC:=mandoc} $MOPT $file | $COLPIPE \ 50 1.1.1.3 christos 2> /tmp/mandoc.err > /tmp/mandoc.out 51 1.1.1.2 christos for i in roff mandoc; do 52 1.1.1.5 christos [ -s /tmp/$i.err ] && echo "$i errors:" && cat /tmp/$i.err 53 1.1.1.2 christos done 54 1.1.1.6 christos diff -au $DIFFOPT /tmp/roff.out /tmp/mandoc.out 2>&1 55 1.1 joerg done 56 1.1 joerg 57 1.1 joerg exit 0 58