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 20VERSION=`cat version.texi | awk '$2 == "VERSION" {print $3}'` 21UPDATED=`cat version.texi | awk '$2 == "UPDATED" {print $3 " " $4}'` 22 23# extracts the manpage for a given command out of a texinfo doc 24unset LANG 25 26date=`date +%d%b%y` 27package="mtools-"`grep mversion patchlevel.c | sed 's/^.*"\(.*\)";/\1/'` 28 29infile=/tmp/infile.$$ 30 31extract() 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 68for name in `fgrep -v '#' cmdname | cut -f1 -d\ ` ; do 69 extract $name 70done 71 72rm -f mtools.tmpl.1 73exec >mtools.tmpl.1 74echo \'\\\" t 75# ' 76echo .TH mtools 1 \"$date\" $package 77echo .SH Name 78echo "mtools - utilities to access DOS disks in Unix." 79cat 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 93echo .SH See also 94echo floppyd_installtest 95echo mattrib 96echo mbadblocks 97echo mcd 98echo mcopy 99echo mdel 100echo mdeltree 101echo mdir 102echo mdu 103echo mformat 104echo minfo 105echo mkmanifest 106echo mlabel 107echo mmd 108echo mmount 109echo mmove 110echo mrd 111echo mren 112echo mshortname 113echo mshowfat 114echo mtoolstest 115echo mtype 116 117rm -f mtools.tmpl.5 118exec >mtools.tmpl.5 119echo \'\\\" t 120# ' 121echo .TH mtools 5 \"$date\" "MTOOLS" "MTOOLS" 122echo .SH Name 123echo "mtools.conf - mtools configuration files" 124cat 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 145echo .SH See also 146echo mtools 147