#!/bin/sh
# $XTermId: make-xpms,v 1.6 2012/10/07 22:50:56 tom Exp $
# some files are generated from other icons...
for name in mini.xterm filled-xterm xterm xterm-color
do
	target=${name}.xpms
	NAME=`echo "$target" | sed -e 's/[\.-]/_/g'`
	LIST=
	echo "** creating $target"
	rm -f $target
	echo "/* @XTermId@ */" | sed -e 's/@/$/g' >$target
	echo "/* generated by $0 $* */" >>$target
	echo "/* vile:xpmmode */" >>$target
	for source in ${name}_*[0-9]x[1-9]*.xpm
	do
		echo ".. from $source"
		BASE=`basename "$source" .xpm`
		PART=`echo "$source" | sed -e 's/[\.-]/_/g'`
		test -n "$LIST" && LIST="$LIST, "
		LIST="$LIST
	{ \"$BASE\", $PART }"
		sed -e 's/char \*/const char * const/' $source >>$target
	done
	echo "static const XPM_DATA $NAME[] = {$LIST
};" >>$target
done