Merge branch 'maint'
[paraslash.git] / command_util.sh
index 3c2d789f3e0b54983634155f2422baf0030f4a9f..847f87e4ccdd379330c36ed27dc65db4ecc96edb 100755 (executable)
@@ -26,6 +26,12 @@ read_header()
                AT:)
                        array_type="$value"
                        ;;
+               SI:)
+                       for i in $value; do
+                               system_includes="$system_includes
+#include <$i.h>"
+                       done
+                       ;;
                IN:)
                        for i in $value; do
                                includes="$includes
@@ -57,7 +63,6 @@ read_one_command()
        usage_txt=""
        help_txt=""
        perms_txt=""
-       line_handler=0
        template=0
        template_name=""
        template_prototype=""
@@ -84,9 +89,6 @@ read_one_command()
                D:)
                        desc_txt="$value"
                        ;;
-               L:)
-                       line_handler=1
-                       ;;
                U:)
                        usage_txt="$value"
                        ;;
@@ -148,7 +150,7 @@ dump_man()
                        local t_name_txt=$(echo $name_txt | $sed_cmd)
                        echo ".SS \"$t_name_txt\""
                done
-               echo "$desc_txt"
+               echo "$desc_txt" | sed -e "s/@member@/{$(echo $template_members | sed -e 's/ / | /g')}/g"
                echo
                echo "\\fBUsage: \\fP"
                echo
@@ -198,13 +200,13 @@ dump_proto()
        echo '/**'
        echo " * $desc_txt"
        echo ' *'
-       echo ' * \param fd The file descriptor to send output to.'
-       if test $line_handler -eq 0; then
-               echo ' * \param argc The number of arguments.'
-               echo ' * \param argv The argument vector.'
+       if [[ "$system_includes" =~ openssl/rc4.h ]]; then
+               echo ' * \param rc4c The rc4 crypt context.'
        else
-               echo ' * \param cmdline The full command line.'
+               echo ' * \param fd The file descriptor to send output to.'
        fi
+       echo ' * \param argc The number of arguments.'
+       echo ' * \param argv The argument vector.'
        echo ' * '
        echo " * Usage: $usage_txt"
        echo ' * '
@@ -227,21 +229,18 @@ dump_proto()
 
 dump_array_member()
 {
+       local TAB='     '
        echo '{'
        echo ".name = \"$name_txt\","
-       if test $line_handler -eq 0; then
-               echo ".handler = com_$name_txt,"
-       else
-               echo ".handler = NULL,"
-               echo ".line_handler = com_$name_txt,"
-       fi
+       echo ".handler = com_$name_txt,"
        if test -n "$perms_txt"; then
                echo ".perms = $perms_txt,"
        fi
        echo ".description = \"$desc_txt\","
        echo ".usage = \"$usage_txt\","
        echo ".help = "
-       printf "%s\n" "$help_txt" | sed -e 's/^/\"/g' -e 's/$/\\n\"/g'
+       printf "%s\n" "$help_txt" | sed -e 's/^/\"/g' -e 's/$/\\n\"/g' \
+               -e "s/$TAB/\\\t/g"
        echo '},'
 }
 
@@ -273,6 +272,7 @@ template_loop()
 com_c_file()
 {
        echo "/** \file $output_file.c $c_file_comment */"
+       echo "$system_includes"
        echo "$includes"
        echo "struct $array_type $array_name[] = {"
        while : ; do