Add missing debug.h include
_XOPEN_SOURCE_EXTENDED define is needed for key_name
Merge pull request #134 from jturner/master

Fixes found while compiling on OpenBSD