#! /bin/sh

# convert all keyboard mapping tables
# from old format (array of string pairs)
#	struct keymap keymap_ArabicKeyboard [] = {
#		{"q", "ض"},	/* dad (ض) */
# to new format (single string with NUL byte separators)
#	char * keymap_ArabicKeyboard = 
#		"q\0ض\0"	/* dad (ض) */

for file in $*
do	sed	-e 's/struct *keymap *\([^ ]*\) .*/char \1 [] =/' \
		-e 's/^	{"\(.*\)", "\(.*\)"},/	"\1\\000\2\\000"/' \
		-e t -e d $file
	echo "	;"
done
