diff --git a/vbindiff.cpp b/vbindiff.cpp index 5c29aad..6c24093 100644 --- a/vbindiff.cpp +++ b/vbindiff.cpp @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -1816,6 +1817,13 @@ void processOptions(int& argc, char**& argv) } } // end processOptions +static int ctrlc_pressed; + +static void sighandler(int signo) { + (void) signo; + ctrlc_pressed = 1; +} + //==================================================================== // Main Program: //==================================================================== @@ -1863,8 +1871,10 @@ VBinDiff comes with ABSOLUTELY NO WARRANTY; for details type `vbindiff -L'.\n"; file1.display(); file2.display(); + signal(SIGINT, sighandler); + Command cmd; - while ((cmd = getCommand()) != cmQuit) + while (!ctrlc_pressed && (cmd = getCommand()) != cmQuit) handleCmd(cmd); file1.shutDown();