Filter out all Nmh-* headers in post(1). Do that silently for empty
[mmh] / man / mh-chart-gen.sh
1 #! /bin/sh
2 #
3 # Generates mh-chart.man from other .man files that have a SYNOPSIS
4 # section.
5
6 nmhmandir=`dirname $0`
7
8 cat <<'EOF'
9 .\"
10 .\" %nmhwarning%
11 .\"
12 .TH MH-CHART %manext7% "%nmhdate%" MH.6.8 [%nmhversion%]
13 .SH NAME
14 mh-chart \- Chart of nmh Commands
15 .SH SYNOPSIS
16 .na
17 EOF
18
19 for i in $nmhmandir/*.man; do
20   case $i in
21     */mh-chart.man) ;;
22     *) if grep '^\.ad' "$i" >/dev/null; then
23          #### Extract lines from just after .SH SYNOPSIS to just before .ad.
24          #### Filter out the "typical usage:" section in pick.man.
25          awk '/.SH SYNOPSIS/,/^(\.ad|typical usage:)/ {
26                 if ($0 !~ /^(\.SH SYNOPSIS|\.na|\.ad|typical usage:)/) print
27               }' "$i"
28          echo
29        fi ;;
30   esac
31 done
32
33 cat <<'EOF'
34 .ad
35
36 .SH "SEE ALSO"
37 nmh(7)
38 EOF