xref: /freebsd/contrib/unifdef/tests/xterm.sh (revision 4c9a0adad18263ec8725d9bfc5f560c6ad1da8bd)
1# hacks so we don't have to distribute huge chunks of XTerm
2
3if [ ! -f xterm-really ]
4then
5	cat xterm.expout
6	cat xterm.experr 1>&2
7	exit $(cat xterm.exprc)
8fi
9if [ -f xterm-clean ]
10then
11	rm xterm.tar.gz xterm-defs.h xterm-main.c
12fi
13
14if [ ! -f xterm.tar.gz ]
15then
16	wget -q http://invisible-island.net/datafiles/release/xterm.tar.gz
17fi
18if [ ! -f xterm-main.c ]
19then
20	tar xf xterm.tar.gz
21	cd xterm-[0-9][0-9][0-9]
22	gcc -I/usr/X11R6/include -I. -E -dM \
23		main.c > ../xterm-defs.h
24	cat     main.c > ../xterm-main.c
25	cd ..
26	rm -r xterm-[0-9][0-9][0-9]
27fi
28
29unifdef -s xterm-main.c | sed 's/^/#undef /' >xterm-undefs.h
30echo $? 1>&2
31unifdef -f xterm-undefs.h -f xterm-defs.h xterm-main.c >xterm-out.c
32echo $? 1>&2
33grep '#' xterm-out.c
34echo $? 1>&2
35rm -f xterm-undefs.h xterm-out.c
36