]> diplodocus.org Git - nmh/blob - man/mh-chart-gen.sh
getpass.c: Move interface to own file.
[nmh] / 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 # This code is Copyright (c) 2012, by the authors of nmh.
7 # See the COPYRIGHT file in the root directory of the nmh
8 # distribution for complete copyright information.
9
10 nmhmandir=`dirname $0`
11
12 # The following ensures the generated date field in the manpage is divorced
13 # from the local build environment when building distribution packages.
14 LC_TIME=C; export LC_TIME
15 unset LANG
16 datestamp=`date +%Y-%m-%d`
17
18 cat <<__HOOPY_FROOD
19 .TH MH-CHART %manext7% "${datestamp}" "%nmhversion%"
20 .
21 .\" %nmhwarning%
22 .
23 .SH NAME
24 mh-chart \- chart of nmh commands and their options
25 .SH SYNOPSIS
26 .na
27 __HOOPY_FROOD
28
29 for i in $nmhmandir/*.man; do
30 case $i in
31 */mh-chart.man) ;;
32 *) if grep '^\.ad' "$i" >/dev/null; then
33 #### Extract lines from just after .SH SYNOPSIS to just before .ad.
34 #### Filter out the "typical usage:" section in pick.man.
35 awk '/.SH SYNOPSIS/,/^(\.ad|typical usage:)/ {
36 if ($0 !~ /^(\.SH SYNOPSIS|\.na|\.ad|typical usage:)/) print
37 }' "$i"
38 echo
39 fi ;;
40 esac
41 done
42
43 cat <<'EOF'
44 .ad
45
46 .SH "SEE ALSO"
47 .IR nmh (7),
48 .IR mh\-mime (7)
49 EOF