aac: fix some signedness warnings
[paraslash.git] / command_util.sh
index d6626c253057675cceedb689d82957d607911a20..4a9a03cc77f9637e20fc797d99f655ca3ce90a30 100755 (executable)
@@ -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 '},'
@@ -36,10 +36,13 @@ read_header()
                CC:)
                        c_file_comment="$value"
                        ;;
-               FN:)
-                       file_name="$value"
+               OF:)
+                       output_file="$value"
                        array_name=${value%command_list}cmds
                        ;;
+               SF:)
+                       source_file="$value"
+                       ;;
                AT:)
                        array_type="$value"
                        ;;
@@ -49,14 +52,14 @@ read_header()
 #include \"$i.h\""
                        done
                        includes="$includes
-#include \"$file_name.h\""
+#include \"$output_file.h\""
                        ;;
                SN:)
                        section_name="$value"
                esac
        done
        if test -z "$header_comment" -o -z "$c_file_comment" \
-                       -o -z "$file_name"; then
+                       -o -z "$output_file"; then
                echo "header error" 1&>2
                exit 1
        fi
@@ -68,7 +71,7 @@ read_one_command()
 
        name_txt=""
        desc_txt=""
-       syn_txt=""
+       usage_txt=""
        help_txt=""
        perms_txt=""
        line_handler=0
@@ -90,8 +93,8 @@ read_one_command()
                L:)
                        line_handler=1
                        ;;
-               S:)
-                       syn_txt="$value"
+               U:)
+                       usage_txt="$value"
                        ;;
                H:)
                        help_txt="${value}"
@@ -107,12 +110,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
@@ -122,7 +125,7 @@ ${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"
 }
@@ -132,7 +135,7 @@ dump_man()
        echo ".SS \"$name_txt\""
        echo "$desc_txt"
        echo
-       echo "\\fBusage: \\fP$syn_txt"
+       echo "\\fBusage: \\fP$usage_txt"
        echo
        echo "$help_txt"
        echo
@@ -150,7 +153,6 @@ dump_man()
 
 com_man()
 {
-       local n
        echo "[$section_name]"
        echo
        while : ; do
@@ -161,16 +163,13 @@ com_man()
                if test $ret -eq 0; then
                        break
                fi
-               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
 }
 
 com_c_file()
 {
-       echo "/** \file $file_name.c $c_file_comment */"
+       echo "/** \file $output_file.c $c_file_comment */"
        echo "$includes"
        echo "struct $array_type $array_name[] = {"
        while : ; do
@@ -199,21 +198,17 @@ 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 ' */'
-       if test $line_handler -eq 0; then
-               echo "int com_$name_txt(int fd, int argc, char **argv);"
-       else
-               echo "int com_$name_txt(int fd, char *cmdline);"
-       fi
+       grep "^\(__noreturn \)*int com_$name_txt(" $source_file | sed -e 's/$/;/1'
        echo
 }
 
 com_header()
 {
-       echo "/** \file $file_name.h $header_comment */"
+       echo "/** \file $output_file.h $header_comment */"
        echo
        echo "extern struct $array_type $array_name[];"
        while : ; do