8 while read key value
; do
14 header_comment
="$value"
17 c_file_comment
="$value"
21 array_name
=${value%command_list}cmds
31 system_includes
="$system_includes
41 #include \"$output_file.h\""
47 template_members
="$value"
50 if test -z "$header_comment" -o -z "$c_file_comment" \
51 -o -z "$output_file"; then
52 echo "header error" 1&>2
70 while read key value
; do
79 template_name
="$value"
83 template_prototype
="$value"
98 if test "$line" = "---"; then
109 if test $template -eq 0; then
110 if test -n "$name_txt" -a -n "$desc_txt" -a -n "$usage_txt" \
111 -a -n "$help_txt"; then
116 if test -n "$template_name" -a -n "$template_prototype" \
117 -a -n "$name_txt " -a -n "$template_members" \
118 -a -n "$desc_txt" -a -n "$usage_txt" \
119 -a -n "$help_txt"; then
124 if test -z "$name_txt" -a -z "$desc_txt" -a -z "$usage_txt" \
125 -a -z "$help_txt"; then
137 echo "O: $template_prototype"
142 if test $template -eq 0; then
143 echo ".SS \"$name_txt\""
146 echo "\\fBUsage: \\fP$usage_txt"
148 for member
in $template_members; do
149 local sed_cmd
="sed -e s/@member@/$member/g"
150 local t_name_txt
=$
(echo $name_txt |
$sed_cmd)
151 echo ".SS \"$t_name_txt\""
153 echo "$desc_txt" |
sed -e "s/@member@/{$(echo $template_members | sed -e 's/ / | /g')}/g"
155 echo "\\fBUsage: \\fP"
158 for member
in $template_members; do
159 local sed_cmd
="sed -e s/@member@/$member/g"
160 local t_usage_txt
=$
(echo $usage_txt |
$sed_cmd)
161 printf "\t$t_usage_txt\n"
166 echo "$help_txt" |
sed -e 's/^ //'
168 if test -n "$perms_txt"; then
169 echo -n "\\fBpermissions:\\fP "
170 if test "$perms_txt" = "0"; then
182 echo "[$section_name]"
186 if test $ret -lt 0; then
189 if test $ret -eq 0; then
198 local source_file match
=""
203 if [[ "$system_includes" =~ openssl
/rc4.h
]]; then
204 echo ' * \param rc4c The rc4 crypt context.'
206 echo ' * \param fd The file descriptor to send output to.'
208 echo ' * \param argc The number of arguments.'
209 echo ' * \param argv The argument vector.'
211 echo " * Usage: $usage_txt"
213 echo "$help_txt" |
sed -e 's/^/ * /g'
215 if test -n "$prototype"; then
220 for source_file
in $source_files; do
221 match
=$
(grep "^\(__noreturn \)*int com_$name_txt(" $source_file |
head -n 1 |
sed -e 's/$/;/1')
222 if test -n "$match"; then
233 echo ".name = \"$name_txt\","
234 echo ".handler = com_$name_txt,"
235 if test -n "$perms_txt"; then
236 echo ".perms = $perms_txt,"
238 echo ".description = \"$desc_txt\","
239 echo ".usage = \"$usage_txt\","
241 printf "%s\n" "$help_txt" |
sed -e 's/^/\"/g' -e 's/$/\\n\"/g'
248 local t_name
="$name_txt"
249 local t_perms
="$perms_txt"
250 local t_desc
="$desc_txt"
251 local t_usage
="$usage_txt"
252 local t_help
="$help_txt"
253 local t_source_files
="$source_files"
255 for member
in $template_members; do
256 local sed_cmd
="sed -e s/@member@/$member/g"
257 #echo "sed_cmd: $sed_cmd"
258 name_txt
=$
(echo $t_name |
$sed_cmd)
260 perms_txt
=$
(echo $t_perms |
$sed_cmd)
261 desc_txt
=$
(echo $t_desc |
$sed_cmd)
262 usage_txt
=$
(echo $t_usage |
$sed_cmd)
263 help_txt
=$
(printf "%s\n" "$t_help" |
$sed_cmd)
264 prototype
=$
(echo "$template_prototype" |
$sed_cmd)
272 echo "/** \file $output_file.c $c_file_comment */"
273 echo "$system_includes"
275 echo "struct $array_type $array_name[] = {"
278 if test $ret -lt 0; then
281 if test $ret -eq 0; then
284 if test $template -eq 0; then
288 template_loop dump_array_member
290 echo '{.name = NULL}};'
295 echo "/** \file $output_file.h $header_comment */"
297 echo "extern struct $array_type $array_name[];"
300 if test $ret -lt 0; then
303 if test $ret -eq 0; then
306 if test $template -eq 0; then
310 template_loop dump_proto