Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#!/bin/rc
2
 
3
fn unhex {
4
	tr '	' ' ' | sed 's/0x//g;s/[, ]//g;s/../0x&, /g;s/^/	/'
5
}
6
 
7
if(! ~ $#* 1) {
8
	echo 'usage: mkface who' >[1=2]
9
	exit usage
10
}
11
 
12
who=$1
13
x='^astro/'^$who^' '
14
z='^([^ ]+)/'^$who^' '
15
 
16
file=notfound
17
for(i in 1 2 4 8)
18
	if(y=`{grep $x /lib/face/48x48x$i/.dict} || y=`{grep $z /lib/face/48x48x$i/.dict})
19
		file=/lib/face/48x48x$i/$y(2)
20
 
21
if(~ $file notfound) {
22
	echo 'cannot find face for '$who >[1=2]
23
	exit noface
24
}
25
 
26
{
27
	echo 'uchar '$who'bits[] = {'
28
	switch($file) {
29
	case *48x48x8* *48x48x4*
30
		fb/enc2bit $file | dd -bs 60 -skip 1 >[2]/dev/null | xd |
31
		sed 's#^.......##' | unhex
32
	case *48x48x2* *48x48x1*
33
		cat $file | unhex
34
	}
35
	echo '};'
36
} >$who.bits
37