- 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
+}
+
+make_proto()
+{
+ local source_file match="" CR='
+'
+ if test -n "$prototype"; then
+ result="$prototype$CR"
+ return
+ fi
+ result=
+ for source_file in $source_files; do
+ match=$(grep "^\(__noreturn \)*int com_$name_txt(" $source_file | head -n 1 | sed -e 's/$/;/1')
+ if test -n "$match"; then
+ result="$result$match$CR"
+ break
+ fi
+ done
+}
+
+make_array_member()
+{
+ local TAB=' ' CR='
+'
+ local tmp
+
+ result="{.name = \"$name_txt\", .handler = com_$name_txt, "
+ if test -n "$perms_txt"; then
+ result="$result .perms = $perms_txt,"
+ fi
+ result="$result.description = \"$desc_txt\", .usage = \"$usage_txt\", \\$CR .help = "
+ tmp="$(printf "%s\n" "$help_txt" | sed -e 's/^/\"/g' -e 's/$/\\n\"/g' \
+ -e "s/$TAB/\\\t/g" -e's/$/\\/g')"
+ result="$result$tmp$CR}, \\$CR"
+}
+
+make_completion()
+{
+ local CR='
+'
+ result=" {.name = \"$name_txt\", .completer = ${name_txt}_completer}, \\$CR"
+}
+
+template_loop()
+{
+ local loop_result=
+
+ local t_name="$name_txt"
+ local t_perms="$perms_txt"
+ local t_desc="$desc_txt"
+ local t_usage="$usage_txt"
+ local t_help="$help_txt"
+ local t_source_files="$source_files"
+ local member
+ for member in $template_members; do
+ local sed_cmd="sed -e s/@member@/$member/g"
+ #echo "sed_cmd: $sed_cmd"
+ name_txt=$(echo "$t_name" | $sed_cmd)
+ #name_txt="$tname"
+ perms_txt=$(echo "$t_perms" | $sed_cmd)
+ desc_txt=$(echo "$t_desc" | $sed_cmd)
+ usage_txt=$(echo "$t_usage" | $sed_cmd)
+ help_txt=$(printf "%s\n" "$t_help" | $sed_cmd)
+ prototype=$(echo "$template_prototype" | $sed_cmd)
+ result=
+ $1
+ loop_result="$loop_result$result"