From 5083c2ab6ddd1748b1bb0391e55775f00ca224c9 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sat, 14 May 2011 20:32:36 +0200 Subject: ipaccess: Terminate the application on CTRL+C or CTRL+D The terminal is switched into the raw mode and no SIGs are generated. --- util/telnet-client.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/util/telnet-client.c b/util/telnet-client.c index d2addf2..15f4aed 100644 --- a/util/telnet-client.c +++ b/util/telnet-client.c @@ -52,8 +52,16 @@ static void _input(char *buffer, int size) { for (i = 0; i != size; ++i) { /* if we got a CR or LF, replace with CRLF * NOTE that usually you'd get a CR in UNIX, but in raw - * mode we get LF instead (not sure why) + * mode we get LF instead (not sure why). + * For CTRL+C (SIGINT), CTRL+D (EOF) we will exit */ +#if NANO_BTS_CLI_CLIENT + if (buffer[i] == 3 || buffer[i] == 4) { + printf("%s terminating.\r\n", + buffer[i] == 3 ? "SIGINT" : "EOF"); + exit(0); + } +#endif if (buffer[i] == '\r' || buffer[i] == '\n') { if (do_echo) printf("\r\n"); -- cgit v1.2.3