3 # We could have multiple occurances. Create all of them.
6 TMPF
=`mktemp /tmp/gen-help.XXXXXX`
7 trap "rm -f $TMPF*" EXIT
8 cmdsed
='s,.*<command>[ ]*\([^ ]*\)[ ]*</command>.*,\1,p'
11 for LINE
in `fgrep -n '/*** XML Help:' < $FILE | cut -d: -f1`; do
12 if [ -L tools
/link-dtd
]; then
13 echo '<?xml version="1.0"?>' > $TMPF
14 echo '<!DOCTYPE article PUBLIC "-//OASIS//DTD Docbook XML V4.1.2//EN"' \
16 echo '"'`pwd`'/tools/link-dtd/docbookx.dtd">' >> $TMPF
17 echo '<article><section>' >> $TMPF
18 tools
/extract-help
$FILE $LINE >> $TMPF
19 echo '</section></article>' >> $TMPF
21 tr '\n' ' ' < $TMPF |
sed -e 's/[[:space:]]\{2,\}/ /g' |
22 xsltproc tools
/text.xsl
- |
fold -w80 -s > $TMPF.txt
24 COMMAND
=`sed -n "$cmdsed" < $TMPF | head -n +1`
25 COMMAND_FILE
=generated-
`basename $FILE .c`-help:$COMMAND
26 #echo Creating $COMMAND_FILE
28 # Output description, in quotes.
29 echo 'log_line(LOG_ALWAYS,' > $COMMAND_FILE
31 TXTSTART
=`grep -n '^ 1\.1\.' $TMPF.txt | cut -d: -f1`
32 tail -n +`expr $TXTSTART + 2` $TMPF.txt |
while read -r TXTLINE
; do
33 echo "$TXTLINE" |
sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/^/"/' \
34 -e 's/$/\\n"/' >> $COMMAND_FILE
36 echo ');' >> $COMMAND_FILE
38 tools
/extract-help
$FILE $LINE > $TMPF
40 COMMAND
=`sed -n "$cmdsed" < $TMPF | head -n +1`
41 COMMAND_FILE
=generated-
`basename $FILE .c`-help:$COMMAND
42 echo Faking up
$COMMAND_FILE
44 echo 'log_line(LOG_ALWAYS,' > $COMMAND_FILE
45 sed 's/<arg [^>]*>/ /;s/<[^>]*>//g' < $TMPF |
46 sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/^/"/' -e 's/$/\\n"/' \
48 echo ');' >> $COMMAND_FILE