audiod: Fix a memory leak.
[paraslash.git] / command_util.sh
index 326bb03..4a9a03c 100755 (executable)
@@ -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
@@ -166,7 +169,7 @@ com_man()
 
 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,17 +202,13 @@ dump_proto()
        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