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 mclasserase 99echo mcopy 100echo mdel 101echo mdeltree 102echo mdir 103echo mdu 104echo mformat 105echo minfo 106echo mkmanifest 107echo mlabel 108echo mmd 109echo mmount 110echo mmove 111echo mrd 112echo mren 113echo mshortname 114echo mshowfat 115echo mtoolstest 116echo mtype 117 118rm -f mtools.tmpl.5 119exec >mtools.tmpl.5 120echo \'\\\" t 121# ' 122echo .TH mtools 5 \"$date\" "MTOOLS" "MTOOLS" 123echo .SH Name 124echo "mtools.conf - mtools configuration files" 125cat mtools.texi | 126 egrep -v '@end copying|@copying|@insertcopying' | 127 sed \ 128 -e '1d' \ 129 -e '/^@c\(omment\)\? MANskip 5/,/^@c\(omment\)\? MANend-skip 5/d' \ 130 -e '/^@c\(omment\)\? MANend-skip 1/d' \ 131 -e '/^@c\(omment\)\? MANskip 1/d' \ 132 -e "s/^@c\(omment\)\? MAN/@MAN/" \ 133 -e "/@include/ d" \ 134 -e "s/@value{VERSION}/$VERSION/g" \ 135 -e "s/@value{UPDATED}/$UPDATED/g" \ 136 -e "s%@value{SYSCONFDIR}%SYSCONFDIR%g" \ 137 -e "/@top/d" \ 138 -e "/@format/d" \ 139 -e "/@end format/d" \ 140 -e "/@ifnottex/d" \ 141 -e "/@end ifnottex/d" | 142 texi2roff -ma | 143 sed -f strip-pp.sed | 144 sed -e '/^\.iX/d' -e 's/\.SS Description/.SH Description/' 145 146echo .SH See also 147echo mtools 148