#!/bin/sh
# $XTermId: make-xpms,v 1.7 2025/03/08 13:12:31 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
