]> diplodocus.org Git - nmh/blob - man/mh-chart-gen.sh
Replace getcpy() with mh_xstrdup() where the string isn't NULL.
[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 nmhmandir=`dirname $0`
7
8 # The following ensures the generated date field in the manpage is divorced
9 # from the local build environment when building distribution packages.
10 LC_TIME=C; export LC_TIME
11 unset LANG
12 datestamp=`date '+%B %d, %Y'`
13
14 cat <<__HOOPY_FROOD
15 .TH MH-CHART %manext7% "${datestamp}" "%nmhversion%"
16 .\"
17 .\" %nmhwarning%
18 .\"
19 .SH NAME
20 mh-chart \- Chart of nmh Commands
21 .SH SYNOPSIS
22 .na
23 __HOOPY_FROOD
24
25 for i in $nmhmandir/*.man; do
26 case $i in
27 */mh-chart.man) ;;
28 *) if grep '^\.ad' "$i" >/dev/null; then
29 #### Extract lines from just after .SH SYNOPSIS to just before .ad.
30 #### Filter out the "typical usage:" section in pick.man.
31 awk '/.SH SYNOPSIS/,/^(\.ad|typical usage:)/ {
32 if ($0 !~ /^(\.SH SYNOPSIS|\.na|\.ad|typical usage:)/) print
33 }' "$i"
34 echo
35 fi ;;
36 esac
37 done
38
39 cat <<'EOF'
40 .ad
41
42 .SH "SEE ALSO"
43 .IR nmh (7),
44 .IR mh\-mime (7)
45 EOF