2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-26 11:57:52 +00:00
criu/scripts/protobuf-gen.sh
Christopher Covington 2c90bb0ce5 Remove \u and \U GNU-isms from sed command
This allows building with busybox sed, for example.

Signed-off-by: Christopher Covington <cov@codeaurora.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
2014-02-11 09:18:32 +04:00

20 lines
433 B
Bash

TR="y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/"
for x in $(sed -n '/PB_AUTOGEN_START/,/PB_AUTOGEN_STOP/ {
/PB_AUTOGEN_ST/d;
s/,.*$//;
s/\tPB_//;
p;
}' include/protobuf-desc.h); do
x_la=$(echo $x | sed $TR)
x_uf=$(echo $x | sed -nr 's/^./&#\\\
/;
s/_(.)/\\\
\1#\\\
/g;
p;' | \
sed -r "/^[A-Z]#\\\\\$/!{ $TR; }" | \
sed -r ':loop; N; s/#?\\\n//; t loop')
echo "CR_PB_DESC($x, $x_uf, $x_la);"
done