add indentation to protocol.txt for readability
[beanstalkd.git] / ct / gen
blob7cb1251f7786903e91ddc0a052dbffe4091295fa
1 #!/bin/sh
3 set -e
5 fixsyms() {
6 if test "`uname -s|tr A-Z a-z`" = darwin
7 then egrep -v [.] | egrep ^_ | sed s/^_//
8 else cat
9 fi
12 syms() {
13 prefix=$1
14 shift
15 for f in "$@"
16 do nm $f
17 done | cut -d ' ' -f 3 | fixsyms | egrep ^$prefix
20 ts=`syms cttest "$@" || true`
21 bs=`syms ctbench "$@" || true`
23 printf '#include <stdint.h>\n'
24 printf '#include "internal.h"\n'
26 for t in $ts
27 do printf 'void %s(void);\n' $t
28 done
30 for b in $bs
31 do printf 'void %s(int);\n' $b
32 done
34 printf 'Test ctmaintest[] = {\n'
35 for t in $ts
36 do printf ' {%s, "%s"},\n' $t $t
37 done
38 printf ' {0},\n'
39 printf '};\n'
41 printf 'Benchmark ctmainbench[] = {\n'
42 for b in $bs
43 do printf ' {%s, "%s"},\n' $b $b
44 done
45 printf ' {0},\n'
46 printf '};\n'