compose.sh (328B)
1 #!/bin/sh 2 3 rm -f tmp_test.c 4 rm -f tests.h 5 rm -f tmp_*.c 6 7 (echo '#include "tests.h"' 8 echo 'int main()' 9 echo '{' 10 11 for i in *-*.c 12 do 13 n=`echo $i | sed 's/\(.*\)-.*\.c/\1/'` 14 sed s/main/main_$n/ < $i > tmp_$n.c 15 echo "int main_$n();" >> tests.h 16 printf "\tif (main_$n()) return -1;\n" 17 done 18 19 printf '\treturn 0;\n}\n' 20 ) > tmp_test.c