Add a SIGINT handler as requested here:
http://www.airwebreathe.org.uk/projects/index.php?title=PulseView#Make_PulseView_respond_properly_to_SIGINT
Signed-off-by: Alexandru Gagniuc <redacted>
extern "C" {
#include <sigrokdecode.h> /* First, so we avoid a _POSIX_C_SOURCE warning. */
extern "C" {
#include <sigrokdecode.h> /* First, so we avoid a _POSIX_C_SOURCE warning. */
#include <stdint.h>
#include <libsigrok/libsigrok.h>
}
#include <stdint.h>
#include <libsigrok/libsigrok.h>
}
"\n", PV_BIN_NAME, PV_DESCRIPTION);
}
"\n", PV_BIN_NAME, PV_DESCRIPTION);
}
+/*
+ * SIGINT handler (likely recieved Ctrl-C from terminal)
+ */
+void sigint(int param)
+{
+ (void) param;
+
+ qDebug("pv: Recieved SIGINT");
+
+ /* TODO: Handle SIGINT */
+}
+
int main(int argc, char *argv[])
{
int ret = 0;
struct sr_context *sr_ctx = NULL;
int main(int argc, char *argv[])
{
int ret = 0;
struct sr_context *sr_ctx = NULL;
+ // Register a SIGINT handler
+ signal (SIGINT, sigint);
+
QApplication a(argc, argv);
// Set some application metadata
QApplication a(argc, argv);
// Set some application metadata