3 # read a list of C files with inline XML usage given on the command line, and
4 # write a usage function on stdout
6 tmpf=`mktemp /tmp/gen-help.XXXXXX`
7 trap "rm -f $tmpf*" EXIT
9 sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/^/"/' -e 's/$/\\n"/'
16 void print_usage(void)
19 "Usage: ctdb-test [options]\n"
20 "Options available:\n"
26 for line in `fgrep -n '/*** XML Argument:' < $file | cut -d: -f1`;
28 if [ -L tools/link-dtd ]; then
32 <!DOCTYPE article PUBLIC "-//OASIS//DTD Docbook XML V4.1.2//EN"
33 "`pwd`/tools/link-dtd/docbookx.dtd">
36 tools/extract-help $file $line >> $tmpf
37 echo '</article>' >> $tmpf
39 tr '\n' ' ' < $tmpf | sed -e 's/[[:space:]]\{2,\}/ /g' |
40 xsltproc tools/usage.xsl - | fold -w80 -s > $tmpf.txt
44 # if we don't have docbook, just strip out the tags and grab
46 tools/extract-help $file $line > $tmpf
47 sed 's/<arg [^>]*>/ /;s/<[^>]*>//g;' < $tmpf | head -3 | quote