X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=command_util.sh;h=326bb032abfa827b21ea4d09f524cc7266938680;hp=ba5e99e2fcabb719ff0219f1ea65b2b4ded841a9;hb=f1e76ac28cf56f16c7b8222d5c23b4b9f1c95832;hpb=4346bb908d494a60f4fa52875ae10228125d82f2 diff --git a/command_util.sh b/command_util.sh index ba5e99e2..326bb032 100755 --- a/command_util.sh +++ b/command_util.sh @@ -15,7 +15,7 @@ dump_array_member() echo ".perms = $perms_txt," fi echo ".description = \"$desc_txt\"," - echo ".synopsis = \"$syn_txt\"," + echo ".usage = \"$usage_txt\"," echo ".help = " echo "$help_txt" | sed -e 's/^/\"/g' -e 's/$/\\n\"/g' echo '},' @@ -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" \ @@ -66,7 +68,7 @@ read_one_command() name_txt="" desc_txt="" - syn_txt="" + usage_txt="" help_txt="" perms_txt="" line_handler=0 @@ -88,8 +90,8 @@ read_one_command() L:) line_handler=1 ;; - S:) - syn_txt="$value" + U:) + usage_txt="$value" ;; H:) help_txt="${value}" @@ -105,12 +107,12 @@ ${line# }" ;; esac done - if test -n "$name_txt" -a -n "$desc_txt" -a -n "$syn_txt" \ + if test -n "$name_txt" -a -n "$desc_txt" -a -n "$usage_txt" \ -a -n "$help_txt"; then ret=1 return fi - if test -z "$name_txt" -a -z "$desc_txt" -a -z "$syn_txt" \ + if test -z "$name_txt" -a -z "$desc_txt" -a -z "$usage_txt" \ -a -z "$help_txt"; then ret=0 return @@ -120,46 +122,36 @@ ${line# }" echo "!ERROR!" echo "N: $name_txt" echo "D: $desc_txt" - echo "S: $syn_txt" + echo "S: $usage_txt" echo "P: $perms_txt" echo "H: $help_txt" } 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$usage_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 } @@ -208,7 +195,7 @@ dump_proto() echo ' * \param cmdline the full command line' fi echo ' * ' - echo " * synopsis: $syn_txt" + echo " * usage: $usage_txt" echo ' * ' echo "$help_txt" | sed -e 's/^/ * /g' echo ' */'