From b7e0b586c47f8cc0c99f0195e0b554dc5f1af072 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 24 Jan 2007 23:10:01 +0000 Subject: [PATCH 1/1] Capture Ctrl-C and save history --- client/client.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/client/client.c b/client/client.c index ac57c74..f0416fe 100644 --- a/client/client.c +++ b/client/client.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2007, Index Data ApS * See the file LICENSE for details. * - * $Id: client.c,v 1.326 2007-01-24 15:14:57 adam Exp $ + * $Id: client.c,v 1.327 2007-01-24 23:10:01 adam Exp $ */ /** \file client.c * \brief yaz-client program @@ -13,6 +13,9 @@ #include #include #include +#ifndef WIN32 +#include +#endif #if HAVE_SYS_TYPES_H #include #endif @@ -4679,12 +4682,23 @@ char **readline_completer(char *text, int start, int end) } #endif +#ifndef WIN32 +void ctrl_c_handler(int x) +{ + exit_client(0); +} +#endif + static void client(void) { char line[10240]; line[10239] = '\0'; +#ifndef WIN32 + signal(SIGINT, ctrl_c_handler); +#endif + #if HAVE_GETTIMEOFDAY gettimeofday (&tv_start, 0); #endif -- 1.7.10.4