tkill.2: tfix
[man-pages.git] / scripts / markup_check.sh
blob4dddd3a2a3a4660a3f67c684437eecf7543269e1
1 #!/bin/sh
3 LOG=/tmp/markup_check.$$
4 rm -f $LOG $LOG.full
6 if test $# -eq 0; then
7 echo 1>&2 "Usage: $0 filename-or-dirname ... $#"
8 exit 1
9 fi
11 file_list=$(find $* -type f | grep '\.[1-9][a-zA-Z]*$')
13 pagename_pattern='[a-z_A-Z][^ ]*'
16 echo ""
17 echo "Checking for page xref without space before left parenthesis:"
18 pattern='^\.BR *'"$pagename_pattern"'([1-8][^1-9]'
19 echo " Pattern: '$pattern'"
20 grep "$pattern" $file_list | sed 's/^/ /' | tee -a $LOG
22 echo ""
23 echo "Checking for .IR xrefs that should be .BR"
24 pattern='^\.IR *'"$pagename_pattern"' *([1-8][^1-9]'
25 echo " Pattern: '$pattern'"
26 grep "$pattern" $file_list | sed 's/^/ /' | tee -a $LOG
28 echo ""
29 echo "Checking for misformatted punctuation in .BR xrefs"
30 pattern='^\.BR *'"$pagename_pattern"' *([1-8a-zA-Z]*) [^ ]'
31 echo " Pattern: '$pattern'"
32 grep "$pattern" $file_list | sed 's/^/ /' | tee -a $LOG
34 echo ""
35 echo "Checking for .B xrefs that should be .BR"
36 pattern='^\.B '"$pagename_pattern"' *([1-8a-zA-Z]*)'
37 echo " Pattern: '$pattern'"
38 grep "$pattern" $file_list | sed 's/^/ /' | tee -a $LOG
39 ) > $LOG.full
41 if test $(cat $LOG | wc -l) -gt 0; then
42 echo ""
43 echo "MARKUP ERRORS!!!!!"
44 cat $LOG.full
45 exit 1
48 exit 0