On Fri, May 29, 1998 at 05:55:43PM +0300, Fabrizio Polacco wrote:
> On Fri, May 29, 1998 at 12:08:25PM +0200, Michael Bramer wrote:
> >
> > Get the help-output from gwet and make the new man-page.
> >
> > Gruss
> > Grisu
Hello
Yesterday night I write a very big hack. The texi2man.sh-program :-)
This program ist VERY alpha und work (only?) with wget.texi.
It is very slow. (Who can translate it from bash to perl?)
The program:
#!/bin/bash
TABLE=0
MENU=0
IFTEX=0
echo ".de FN\n"
echo "\fI\|\\$1\|\fP\n"
echo "..\n"
echo ".TH wget 1 \"1996 Nov 11\" Wget \"Debian Info2man\"\n"
echo ".SH NAME\n"
echo "wget \- a utility to retrieve files from the World Wide Web\n"
function sub () {
a=$*
stelle=1
VAR=0
FILE=0
CODE=0
XREF=0
SAMP=0
SC=0
EMPH=0
DFM=0
#echo ${#a}
while [ $stelle -le ${#a} ]
do
#[ "${a:$stelle:4}" = "@var" ] && echo "++++ Var bei $stelle"
[ $VAR -eq 0 ] && [ "${a:$stelle:4}" = "@var" ] && VAR=1 && a="${a:0:$stelle}\\fI${a:$stelle+5}"
[ $VAR -eq 1 ] && [ "${a:$stelle:1}" = "}" ] && VAR=0 && a="${a:0:$stelle}\\fP${a:$stelle+1}"
[ $FILE -eq 0 ] && [ "${a:$stelle:5}" = "@file" ] && FILE=1 && a="${a:0:$stelle}\\fI${a:$stelle+6}"
[ $FILE -eq 1 ] && [ "${a:$stelle:1}" = "}" ] && FILE=0 && a="${a:0:$stelle}\\fP${a:$stelle+1}"
[ $CODE -eq 0 ] && [ "${a:$stelle:5}" = "@code" ] && CODE=1 && a="${a:0:$stelle}{a:$stelle+6}"
[ $CODE -eq 1 ] && [ "${a:$stelle:1}" = "}" ] && CODE=0 && a="${a:0:$stelle}${a:$stelle+1}"
[ $XREF -eq 0 ] && [ "${a:$stelle:5}" = "@xref" ] && XREF=1 && a="${a:0:$stelle}{a:$stelle+6}"
[ $XREF -eq 1 ] && [ "${a:$stelle:1}" = "}" ] && XREF=0 && a="${a:0:$stelle}${a:$stelle+1}"
[ $SAMP -eq 0 ] && [ "${a:$stelle:5}" = "@samp" ] && SAMP=1 && a="${a:0:$stelle}${a:$stelle+6}"
[ $SAMP -eq 1 ] && [ "${a:$stelle:1}" = "}" ] && SAMP=0 && a="${a:0:$stelle}${a:$stelle+1}"
[ $SC -eq 0 ] && [ "${a:$stelle:3}" = "@sc" ] && SC=1 && a="${a:0:$stelle}{a:$stelle+4}"
[ $SC -eq 1 ] && [ "${a:$stelle:1}" = "}" ] && SC=0 && a="${a:0:$stelle}${a:$stelle+1}"
[ $EMPH -eq 0 ] && [ "${a:$stelle:5}" = "@emph" ] && EMPH=1 && a="${a:0:$stelle}{a:$stelle+6}"
[ $EMPH -eq 1 ] && [ "${a:$stelle:1}" = "}" ] && EMPH=0 && a="${a:0:$stelle}${a:$stelle+1}"
[ $DFM -eq 0 ] && [ "${a:$stelle:4}" = "@dfm" ] && DFM=1 && a="${a:0:$stelle}{a:$stelle+5}"
[ $DFM -eq 1 ] && [ "${a:$stelle:1}" = "}" ] && DFM=0 && a="${a:0:$stelle}${a:$stelle+1}"
stelle=$[$stelle+1]
done
#echo ${a}
}
while read a
do
sub $a
[ "${a:0:1}" = "@" ] || ( [ $MENU -eq 0 ] && ( [ $IFTEX -eq 0 ] && echo
"$a" ; ) )
[ "${a:0:5}" = "@menu" ] && MENU=1
[ "${a:0:9}" = "@end menu" ] && MENU=0
[ "${a:0:6}" = "@iftex" ] && IFTEX=1
[ "${a:0:10}" = "@end iftex" ] && IFTEX=0
[ "${a:0:6}" = "@table" ] && TABLE=1
[ "${a:0:10}" = "@end table" ] && ( TABLE=0 ; echo ".PP" )
[ $TABLE -eq 1 ] && ( [ "${a:0:6}" = "@item " ] && echo ".IP \"${a:6}\""; )
[ $TABLE -eq 1 ] && ( [ "${a:0:7}" = "@itemx " ] && echo ".IP \"${a:7}\""; )
[ "${a:0:9}" = "@section " ] && echo ".SH \"${a:9}\"";
done
------
test it und use it.
With a little handwork, you have a nice man-page.
Grisu
Attachment:
pgpQxSI0xQ8rU.pgp
Description: PGP signature