| 1 | #!/bin/sh |
| 2 | |
| 3 | export LC_ALL=C.UTF-8 |
| 4 | export LANG=C.UTF-8 |
| 5 | |
| 6 | if [ -n "$1" ] |
| 7 | then |
| 8 | DIR=$1/ |
| 9 | fi |
| 10 | |
| 11 | for a in $(find ${DIR}html -type f | grep -v \~ | sort) |
| 12 | do |
| 13 | c=$(echo $a | sed s:${DIR}html/:: | tr "/.-" "___") |
| 14 | echo "static const unsigned char g${c}Data[] = {" |
| 15 | od -v -t x1 "$a" | sed 's/^[0-7]*//' | sed 's/\([0-9a-f][0-9a-f]\)/0x\1,/g' |
| 16 | echo "};" |
| 17 | done |
| 18 | |
| 19 | echo "static const map<string,string,std::less<>> s_urlmap={" |
| 20 | for a in $(find ${DIR}html -type f | grep -v \~ | sort) |
| 21 | do |
| 22 | b=$(echo $a | sed s:${DIR}html/::g) |
| 23 | c=$(echo $b | tr "/.-" "___") |
| 24 | echo "{\"$b\", string((const char*)g${c}Data, sizeof(g${c}Data))}," |
| 25 | done |
| 26 | echo "};" |