1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#!/bin/bash
set -e
range="37 42,44 53 93,102 127,138 162,169 174,238 269,306 310,312 316,324 341,366 370,372 405,415 894,1007 1559,2078 2095,2359 2513,2797 4016,4040 4070,4104 4119,4187"
git archive --format tar master | \
tar -Ox src/sort.c | \
sed "$(
echo "4436,4483{"
echo "4436{"
echo "i\ \ \ \ \ \ \ \ \ \ add_key();"
echo "}"
echo "s|^ \{8\}||"
echo "4436s|^\(.*\)\$|static void add_key(void)\n{\n struct keyfield *key;\n struct keyfield key_buf; char const *s;\n\1|"
echo "4483s|^\(.*\)\$|\1\n}|"
echo "wsrc/sort-uniq-keyfuncs.c"
echo "d"
echo "}"
echo '57i'
echo '57i#include "sort-uniq-keyfuncs.c"'
for r in ${range}
do
echo "${r}{wsrc/sort-uniq-keyfuncs.c"
echo "d"
echo "}"
done
)" > \
src/sort.c
sed -i '
s|^\(\s*\)assert\s*(!\("[^"]*"\));$|\1sort_die (_(\2), file);|
' src/sort-uniq-keyfuncs.c
# cat src/sort-uniq-keyfuncs.foot.c >> src/sort-uniq-keyfuncs.c
|