Clean exit of serialdump when hitting Ctrl-C

Ctrl-C is the best way to close serialdump after using make login.
With a clean exit it will signal to make that the make run was successful.
This commit is contained in:
Yannic Schröder 2016-09-20 14:18:21 +02:00
parent 9e080e8aa5
commit d524211c2a

View File

@ -8,6 +8,7 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <signal.h>
#define BAUDRATE B115200
#define BAUDRATE_S "115200"
@ -82,9 +83,17 @@ print_hex_line(char *prefix, unsigned char *outbuf, int index)
}
}
static void
intHandler(int sig)
{
exit(0);
}
int
main(int argc, char **argv)
{
signal(SIGINT, intHandler);
struct termios options;
fd_set mask, smask;
int fd;