#!/usr/bin/perl -w

# Hacked together real quick by Steve Neruda <neruda@neruda.com>.
# Placed in the public domain, 2002.

$file = $ENV{'HOME'} . "/.enlightenment/keybindings.cfg";
if (!open(FILE, $file)) {
	die "$0: Could not open enlightenment keybindings file \"$file\"\n";
}

while(<FILE>) {
	chomp();
	
	if (/__NEXT_ACTION/) {
		if (defined($key)) {
			print $modifiers . "-" . $key . ": " . $action . "\n";
		}
		undef($key);
		undef($modifiers);
		undef($action);
	}

	if (/__KEY\s+(\w+)/){
#		print "key is $1\n";
		$key = $1;
	}

	if (/__MODIFIER_KEY\s+__(\w+)/){
#		print "modifier is $1\n";
		$modifiers = $1;
	}

	if (/__ACTION\s+__(.*)/){
#		print "action is $1\n";
		$action = $1;
	}
}
