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