From 73ca799d08ee415ffb35ecce736b5e7d2abc3c73 Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Thu, 28 Jun 2012 03:08:00 +0200 Subject: [PATCH 1/1] 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. --- command_util.sh | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) 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() -- 2.39.2