File: mh-chart-gen.sh

package info (click to toggle)
nmh 1.7.1-4
  • links: PTS
  • area: main
  • in suites: buster
  • size: 7,216 kB
  • sloc: ansic: 48,455; sh: 20,755; makefile: 1,005; lex: 732; perl: 509; yacc: 256
file content (49 lines) | stat: -rwxr-xr-x 1,285 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/sh
#
# Generates mh-chart.man from other .man files that have a SYNOPSIS
# section.
#
# This code is Copyright (c) 2012, by the authors of nmh.
# See the COPYRIGHT file in the root directory of the nmh
# distribution for complete copyright information.

nmhmandir=`dirname $0`

# The following ensures the generated date field in the manpage is divorced
# from the local build environment when building distribution packages.
LC_TIME=C; export LC_TIME
unset LANG
datestamp="$(date --utc --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" '+%B %d, %Y')"

cat <<__HOOPY_FROOD
.TH MH-CHART %manext7% "${datestamp}" "%nmhversion%"
.
.\" %nmhwarning%
.
.SH NAME
mh-chart \- chart of nmh commands and their options
.SH SYNOPSIS
.na
__HOOPY_FROOD

find man -name '*.man' | LC_ALL=C sort | while read i; do
  case $i in
    */mh-chart.man) ;;
    *) if grep '^\.ad' "$i" >/dev/null; then
         #### Extract lines from just after .SH SYNOPSIS to just before .ad.
         #### Filter out the "typical usage:" section in pick.man.
         awk '/.SH SYNOPSIS/,/^(\.ad|typical usage:)/ {
                if ($0 !~ /^(\.SH SYNOPSIS|\.na|\.ad|typical usage:)/) print
              }' "$i"
         echo
       fi ;;
  esac
done

cat <<'EOF'
.ad

.SH "SEE ALSO"
.IR nmh (7),
.IR mh\-mime (7)
EOF