Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # Copyright 1997,1999,2001,2002,2004,2009,2010 Alain Knaff. |
| 4 | # This file is part of mtools. |
| 5 | # |
| 6 | # Mtools is free software: you can redistribute it and/or modify |
| 7 | # it under the terms of the GNU General Public License as published by |
| 8 | # the Free Software Foundation, either version 3 of the License, or |
| 9 | # (at your option) any later version. |
| 10 | # |
| 11 | # Mtools is distributed in the hope that it will be useful, |
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | # GNU General Public License for more details. |
| 15 | # |
| 16 | # You should have received a copy of the GNU General Public License |
| 17 | # along with Mtools. If not, see <http://www.gnu.org/licenses/>. |
| 18 | |
| 19 | # TODO |
| 20 | VERSION=`cat version.texi | awk '$2 == "VERSION" {print $3}'` |
| 21 | UPDATED=`cat version.texi | awk '$2 == "UPDATED" {print $3 " " $4}'` |
| 22 | |
| 23 | # extracts the manpage for a given command out of a texinfo doc |
| 24 | unset LANG |
| 25 | |
| 26 | date=`date +%d%b%y` |
| 27 | package="mtools-"`grep mversion patchlevel.c | sed 's/^.*"\(.*\)";/\1/'` |
| 28 | |
| 29 | infile=/tmp/infile.$$ |
| 30 | |
| 31 | extract() |
| 32 | { |
| 33 | command=$1 |
| 34 | echo extracting $command |
| 35 | outfile=`echo $command | tr '[A-Z]' '[a-z]'`.1 |
| 36 | exec 4>&1 |
| 37 | exec >$outfile |
| 38 | |
| 39 | echo \'\\\" t |
| 40 | # ' |
| 41 | echo .TH\ $command\ 1\ \"$date\" $package |
| 42 | echo .SH Name |
| 43 | egrep -i "^$command " cmdname | fgrep -v '#' |
| 44 | #echo ".SH Description" |
| 45 | |
| 46 | cat man-warning.texi mtools.texi man-warning-end.texi | |
| 47 | egrep -v '@end copying|@copying|@insertcopying' | |
| 48 | sed \ |
| 49 | -e "/^@c\(omment\)\? skipskipskip/,/^@node $command/d" \ |
| 50 | -e "/^@node [^,]*, [^,]*, $command, Commands$/,/^@bye/d" \ |
| 51 | -e "/^@node [^,]*, [^,]*, Commands/,/^@bye/d" \ |
| 52 | -e 's/^@section/@chapter/' \ |
| 53 | -e 's/^@subs/@s/' \ |
| 54 | -e 's/^@chapter.*$/@chapter Description/' \ |
| 55 | -e 's/^@section/@chapter/' \ |
| 56 | -e 's/^@subs/@s/' \ |
| 57 | -e 's/^@c\(omment\)\? xMANoptions/@chapter Options/' \ |
| 58 | -e "s/^@c\(omment\)\? MAN/@MAN/" | |
| 59 | texi2roff -ma | |
| 60 | sed -f strip-pp.sed | |
| 61 | sed -e '/^\.iX/d' |
| 62 | exec 1>&4 |
| 63 | # echo ".SH See Also" |
| 64 | # echo "Mtools' texinfo doc" |
| 65 | } |
| 66 | |
| 67 | |
| 68 | for name in `fgrep -v '#' cmdname | cut -f1 -d\ ` ; do |
| 69 | extract $name |
| 70 | done |
| 71 | |
| 72 | rm -f mtools.tmpl.1 |
| 73 | exec >mtools.tmpl.1 |
| 74 | echo \'\\\" t |
| 75 | # ' |
| 76 | echo .TH mtools 1 \"$date\" $package |
| 77 | echo .SH Name |
| 78 | echo "mtools - utilities to access DOS disks in Unix." |
| 79 | cat mtools.texi | |
| 80 | egrep -v '@end copying|@copying|@insertcopying' | |
| 81 | sed \ |
| 82 | -e "1,/^@c\(omment\)\? MANstart 1/d" \ |
| 83 | -e '/^@c\(omment\)\? MANskip 1/,/^@c\(omment\)\? MANend-skip 1/d' \ |
| 84 | -e '/^@c\(omment\)\? MANend-skip 5/d' \ |
| 85 | -e '/^@c\(omment\)\? MANend 5/d' \ |
| 86 | -e "s/^@c\(omment\)\? MAN/@MAN/" \ |
| 87 | -e "s/@value{VERSION}/$VERSION/g" \ |
| 88 | -e "s%@value{SYSCONFDIR}%SYSCONFDIR%g" | |
| 89 | texi2roff -ma | |
| 90 | sed -f strip-pp.sed | |
| 91 | sed -e '/^\.iX/d' |
| 92 | |
| 93 | echo .SH See also |
| 94 | echo floppyd_installtest |
| 95 | echo mattrib |
| 96 | echo mbadblocks |
| 97 | echo mcd |
Alistair Delva | beaee83 | 2021-02-24 11:27:23 -0800 | [diff] [blame] | 98 | echo mcopy |
| 99 | echo mdel |
| 100 | echo mdeltree |
| 101 | echo mdir |
| 102 | echo mdu |
| 103 | echo mformat |
| 104 | echo minfo |
| 105 | echo mkmanifest |
| 106 | echo mlabel |
| 107 | echo mmd |
| 108 | echo mmount |
| 109 | echo mmove |
| 110 | echo mrd |
| 111 | echo mren |
| 112 | echo mshortname |
| 113 | echo mshowfat |
| 114 | echo mtoolstest |
| 115 | echo mtype |
| 116 | |
| 117 | rm -f mtools.tmpl.5 |
| 118 | exec >mtools.tmpl.5 |
| 119 | echo \'\\\" t |
| 120 | # ' |
| 121 | echo .TH mtools 5 \"$date\" "MTOOLS" "MTOOLS" |
| 122 | echo .SH Name |
| 123 | echo "mtools.conf - mtools configuration files" |
| 124 | cat mtools.texi | |
| 125 | egrep -v '@end copying|@copying|@insertcopying' | |
| 126 | sed \ |
| 127 | -e '1d' \ |
| 128 | -e '/^@c\(omment\)\? MANskip 5/,/^@c\(omment\)\? MANend-skip 5/d' \ |
| 129 | -e '/^@c\(omment\)\? MANend-skip 1/d' \ |
| 130 | -e '/^@c\(omment\)\? MANskip 1/d' \ |
| 131 | -e "s/^@c\(omment\)\? MAN/@MAN/" \ |
| 132 | -e "/@include/ d" \ |
| 133 | -e "s/@value{VERSION}/$VERSION/g" \ |
| 134 | -e "s/@value{UPDATED}/$UPDATED/g" \ |
| 135 | -e "s%@value{SYSCONFDIR}%SYSCONFDIR%g" \ |
| 136 | -e "/@top/d" \ |
| 137 | -e "/@format/d" \ |
| 138 | -e "/@end format/d" \ |
| 139 | -e "/@ifnottex/d" \ |
| 140 | -e "/@end ifnottex/d" | |
| 141 | texi2roff -ma | |
| 142 | sed -f strip-pp.sed | |
| 143 | sed -e '/^\.iX/d' -e 's/\.SS Description/.SH Description/' |
| 144 | |
| 145 | echo .SH See also |
| 146 | echo mtools |