8 while read key value
; do
14 header_comment
="$value"
17 c_file_comment
="$value"
21 array_name
=${value%command_list}cmds
35 #include \"$output_file.h\""
41 template_members
="$value"
44 if test -z "$header_comment" -o -z "$c_file_comment" \
45 -o -z "$output_file"; then
46 echo "header error" 1&>2
65 while read key value
; do
74 template_name
="$value"
78 template_prototype
="$value"
96 if test "$line" = "---"; then
107 if test $template -eq 0; then
108 if test -n "$name_txt" -a -n "$desc_txt" -a -n "$usage_txt" \
109 -a -n "$help_txt"; then
114 if test -n "$template_name" -a -n "$template_prototype" \
115 -a -n "$name_txt " -a -n "$template_members" \
116 -a -n "$desc_txt" -a -n "$usage_txt" \
117 -a -n "$help_txt"; then
122 if test -z "$name_txt" -a -z "$desc_txt" -a -z "$usage_txt" \
123 -a -z "$help_txt"; then
135 echo "O: $template_prototype"
140 if test $template -eq 0; then
141 echo ".SS \"$name_txt\""
144 echo "\\fBUsage: \\fP$usage_txt"
146 for member
in $template_members; do
147 local sed_cmd
="sed -e s/@member@/$member/g"
148 local t_name_txt
=$
(echo $name_txt |
$sed_cmd)
149 echo ".SS \"$t_name_txt\""
153 echo "\\fBUsage: \\fP"
156 for member
in $template_members; do
157 local sed_cmd
="sed -e s/@member@/$member/g"
158 local t_usage_txt
=$
(echo $usage_txt |
$sed_cmd)
159 printf "\t$t_usage_txt\n"
164 echo "$help_txt" |
sed -e 's/^ //'
166 if test -n "$perms_txt"; then
167 echo -n "\\fBpermissions:\\fP "
168 if test "$perms_txt" = "0"; then
180 echo "[$section_name]"
184 if test $ret -lt 0; then
187 if test $ret -eq 0; then
196 local source_file match
=""
201 echo ' * \param fd The file descriptor to send output to.'
202 if test $line_handler -eq 0; then
203 echo ' * \param argc The number of arguments.'
204 echo ' * \param argv The argument vector.'
206 echo ' * \param cmdline The full command line.'
209 echo " * Usage: $usage_txt"
211 echo "$help_txt" |
sed -e 's/^/ * /g'
213 if test -n "$prototype"; then
218 for source_file
in $source_files; do
219 match
=$
(grep "^\(__noreturn \)*int com_$name_txt(" $source_file |
head -n 1 |
sed -e 's/$/;/1')
220 if test -n "$match"; then
231 echo ".name = \"$name_txt\","
232 if test $line_handler -eq 0; then
233 echo ".handler = com_$name_txt,"
235 echo ".handler = NULL,"
236 echo ".line_handler = com_$name_txt,"
238 if test -n "$perms_txt"; then
239 echo ".perms = $perms_txt,"
241 echo ".description = \"$desc_txt\","
242 echo ".usage = \"$usage_txt\","
244 printf "%s\n" "$help_txt" |
sed -e 's/^/\"/g' -e 's/$/\\n\"/g'
251 local t_name
="$name_txt"
252 local t_perms
="$perms_txt"
253 local t_desc
="$desc_txt"
254 local t_usage
="$usage_txt"
255 local t_help
="$help_txt"
256 local t_source_files
="$source_files"
258 for member
in $template_members; do
259 local sed_cmd
="sed -e s/@member@/$member/g"
260 #echo "sed_cmd: $sed_cmd"
261 name_txt
=$
(echo $t_name |
$sed_cmd)
263 perms_txt
=$
(echo $t_perms |
$sed_cmd)
264 desc_txt
=$
(echo $t_desc |
$sed_cmd)
265 usage_txt
=$
(echo $t_usage |
$sed_cmd)
266 help_txt
=$
(printf "%s" "$t_help" |
$sed_cmd)
267 prototype
=$
(echo "$template_prototype" |
$sed_cmd)
275 echo "/** \file $output_file.c $c_file_comment */"
277 echo "struct $array_type $array_name[] = {"
280 if test $ret -lt 0; then
283 if test $ret -eq 0; then
286 if test $template -eq 0; then
290 template_loop dump_array_member
292 echo '{.name = NULL}};'
297 echo "/** \file $output_file.h $header_comment */"
299 echo "extern struct $array_type $array_name[];"
302 if test $ret -lt 0; then
305 if test $ret -eq 0; then
308 if test $template -eq 0; then
312 template_loop dump_proto