From: Andre Noll Date: Thu, 28 Jun 2012 01:08:00 +0000 (+0200) Subject: command_util: Output array members with backslashes. X-Git-Tag: v0.4.11~10^2~5 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=73ca799d08ee415ffb35ecce736b5e7d2abc3c73;p=paraslash.git command_util: Output array members with backslashes. This makes sure that the generated code for the definition of the command array has backslashes at the end of each line. Currently this does not matter because make_array_member() is only called when generating C code where new lines don't matter. However, ending each line with a backslash allows to use the same output for a cpp #define which can go into the header file. --- diff --git a/command_util.sh b/command_util.sh index b3b8804c..875b5e69 100755 --- a/command_util.sh +++ b/command_util.sh @@ -206,24 +206,18 @@ make_proto() make_array_member() { - local TAB=' ' + local TAB=' ' CR=' +' local tmp - result=" - { - .name = \"$name_txt\", - .handler = com_$name_txt, - " + 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\", - .help = " + 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")" - result="$result $tmp }," + -e "s/$TAB/\\\t/g" -e's/$/\\/g')" + result="$result$tmp$CR}, \\$CR" } make_completion()