From db5808fa1f6ead76b1eb858b7dc50d124d78e979 Mon Sep 17 00:00:00 2001 From: Keith Winstein Date: Wed, 26 Jan 2011 15:07:35 -0500 Subject: [PATCH] Improvements to debugging printout of unhandled actions --- terminal.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/terminal.cpp b/terminal.cpp index 0e3aeb1..2c79836 100644 --- a/terminal.cpp +++ b/terminal.cpp @@ -68,16 +68,20 @@ std::string Emulator::input( char c, int actfd ) act->act_on_terminal( this ); if ( (actfd > 0) && ( !act->handled ) ) { - char actsum[ 32 ]; - wchar_t ch = L'\0'; + char actsum[ 64 ]; + char thechar[ 10 ] = { 0 }; if ( act->char_present ) { - ch = act->ch; + if ( isprint( act->ch ) ) { + snprintf( thechar, 10, "(%lc)", act->ch ); + } else { + snprintf( thechar, 10, "(0x%x)", act->ch ); + } } - snprintf( actsum, 32, "%s[%s](%s){%lc} ", + snprintf( actsum, 64, "%s%s[disp=%s,param=%s] ", act->name().c_str(), + thechar, dispatch_chars.c_str(), - params.c_str(), - ch ); + params.c_str() ); swrite( actfd, actsum ); }