File: incfiles

package info (click to toggle)
pdns-recursor 4.8.8-1%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 9,620 kB
  • sloc: cpp: 95,714; javascript: 20,651; sh: 4,679; makefile: 652; xml: 37
file content (29 lines) | stat: -rwxr-xr-x 692 bytes parent folder | download | duplicates (3)
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
#!/bin/sh

export LC_ALL=C.UTF-8
export LANG=C.UTF-8

if [ -n "$1" ]
then
	DIR=$1/
fi

files=$(find ${DIR}html -type f \( -name '*.css' -or -name '*.html' -or -name '*.png' -or -name 'local-2022.js' -or -name '*min.js' \) | sort)

echo // $files
for a in $files
do
	c=$(echo $a | sed s:${DIR}html/:: | tr "/.-" "___")
        echo "static const unsigned char g${c}Data[] = {"
	od -v -t x1 "$a" | sed  's/^[0-7]*//' | sed 's/\([0-9a-f][0-9a-f]\)/0x\1,/g'
	echo "};"
done

echo "static const map<string,string> g_urlmap={"
for a in $files
do
	b=$(echo $a | sed s:${DIR}html/::g)
	c=$(echo $b | tr "/.-" "___")
	echo "{\"$b\", string((const char*)g${c}Data, sizeof(g${c}Data))},"
done
echo "};"