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D_WRONG
};

/* Key context is the place where the user presses a key. A key can have
 * different meanings in different places. */
enum key_context
{
	CON_MENU,
	CON_ENTRY_SEARCH,
	CON_ENTRY
};

#ifndef KEY_ESCAPE
# define KEY_ESCAPE	27
#endif

#define META_KEY_FLAG	0x80
#define CTRL_KEY_CODE	0x1F

struct iface_key;
enum key_cmd get_key_cmd (const enum key_context context, const struct iface_key *key);
void keys_init ();
void keys_cleanup ();
char **get_keys_help (int *num);
bool is_help_still_h ();

#ifdef __cplusplus
}
#endif

#endif
