From: Adam Dickmeiss Date: Wed, 24 Jan 2007 23:10:01 +0000 (+0000) Subject: Capture Ctrl-C and save history X-Git-Tag: YAZ.2.1.49.1~20 X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=commitdiff_plain;h=b7e0b586c47f8cc0c99f0195e0b554dc5f1af072 Capture Ctrl-C and save history --- 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