command_util.sh: improve man page generation
authorAndre <maan@meins.(none)>
Thu, 25 Jan 2007 19:56:34 +0000 (20:56 +0100)
committerAndre <maan@meins.(none)>
Thu, 25 Jan 2007 19:56:34 +0000 (20:56 +0100)
Read the global tag SN (section name) and output simple *roff text.

command_util.sh

index ba5e99e..d6626c2 100755 (executable)
@@ -51,6 +51,8 @@ read_header()
                        includes="$includes
 #include \"$file_name.h\""
                        ;;
+               SN:)
+                       section_name="$value"
                esac
        done
        if test -z "$header_comment" -o -z "$c_file_comment" \
@@ -127,39 +129,30 @@ ${line# }"
 
 dump_man()
 {
-       echo "NAME"
-       printf "\t$name_txt - $desc_txt\n"
-       echo "SYNOPSIS"
-       printf "\t$syn_txt\n"
-       echo "DESCRIPTION"
+       echo ".SS \"$name_txt\""
+       echo "$desc_txt"
+       echo
+       echo "\\fBusage: \\fP$syn_txt"
+       echo
        echo "$help_txt"
+       echo
        if test -n "$perms_txt"; then
-               echo "PERMISSIONS"
+               echo -n "\\fBpermissions:\\fP "
                if test "$perms_txt" = "0"; then
-                       printf "\t(none)\n"
+                       echo "(none)"
                else
-                       printf "\t$perms_txt\n"
+                       echo "$perms_txt"
                fi
        fi
-
+       echo
 }
 
 
 com_man()
 {
-       local cn="$(grep ^codename Makefile.in)"
-       local ver="$(grep ^AC_INIT configure.ac \
-               | cut -f 2 -d ',')"
-       cn=${cn#*=}
-       ver=${ver# *[}
-       ver=${ver%]}
-       echo "r=paraslash-$ver (cn: $cn)"
        local n
-       local txtdir=txt
-       local mandir=man/man1
-       local htmldir=html
-       local pfx="$1"
-       mkdir -p $txtdir $mandir $htmldir || exit 1
+       echo "[$section_name]"
+       echo
        while : ; do
                read_one_command
                if test $ret -lt 0; then
@@ -168,12 +161,10 @@ com_man()
                if test $ret -eq 0; then
                        break
                fi
-               n=$pfx-$name_txt
-               echo "pfx: $pfx, name: $n"
-               dump_man > $txtdir/$n.txt
-               txt2man -t "$n" -r "$r"  < $txtdir/$n.txt \
-                       | sed -e 1d > $mandir/$n.1
-               man2html $mandir/$n.1 > $htmldir/$n.html
+               dump_man #> $txtdir/$n.txt
+#              txt2man -t "$n" -r "$r"  < $txtdir/$n.txt \
+#                      | sed -e 1d > $mandir/$n.1
+#              man2html $mandir/$n.1 > $htmldir/$n.html
        done
 }