diff --git a/CHANGELOG.md b/CHANGELOG.md index 2219d20ae..06b754349 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ All notable changes to this project will be documented in this file. This project uses the changelog in accordance with [keepchangelog](http://keepachangelog.com/). Please use this to write notable changes, which is not the same as git commit log... ## [unreleased][unreleased] +- Changed client now handles CTRL-C and saves history if using READLINE (@iceman1001) - Changed `hf mf *` - printing of keys if MFC EV1 added extra explaination (@iceman1001) - Changed `hf mf ginfo - now supports decoding of user supplied configuration block (@iceman1001) - Changed `data load` - now shows loaded number as comma printed. (@iceman1001) diff --git a/client/src/pm3line.c b/client/src/pm3line.c index 5c09c6135..30f3e7349 100644 --- a/client/src/pm3line.c +++ b/client/src/pm3line.c @@ -123,10 +123,20 @@ static bool WINAPI terminate_handler(DWORD t) { # else static struct sigaction gs_old_sigint_action; static void sigint_handler(int signum) { - sigaction(SIGINT, &gs_old_sigint_action, NULL); - pm3line_flush_history(); - kill(0, SIGINT); + + switch(signum) { + case SIGINT: { + sigaction(SIGINT, &gs_old_sigint_action, NULL); + pm3line_flush_history(); + kill(0, SIGINT); + break; + } + default: { + break; + } + } } + #endif void pm3line_install_signals(void) { @@ -138,6 +148,7 @@ void pm3line_install_signals(void) { action.sa_handler = &sigint_handler; sigaction(SIGINT, &action, &gs_old_sigint_action); # endif + #if defined(HAVE_READLINE) rl_catch_signals = 1; rl_set_signals(); @@ -150,6 +161,8 @@ void pm3line_init(void) { using_history(); rl_readline_name = "PM3"; rl_attempted_completion_function = rl_command_completion; + rl_getc_function = getc; + pm3line_install_signals(); #ifdef RL_STATE_READCMD rl_extend_line_buffer(1024);