]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - command_util.sh
simplify com_man() of command_util.sh
[paraslash.git] / command_util.sh
index ba5e99e2fcabb719ff0219f1ea65b2b4ded841a9..5119f58bc7f264aff2cd17f965bb1e2cfd1cbf47 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,29 @@ ${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 +160,7 @@ 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
        done
 }