projects
/
yaz-moved-to-github.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
d42f045
)
Capture Ctrl-C and save history
author
Adam Dickmeiss
<adam@indexdata.dk>
Wed, 24 Jan 2007 23:10:01 +0000
(23:10 +0000)
committer
Adam Dickmeiss
<adam@indexdata.dk>
Wed, 24 Jan 2007 23:10:01 +0000
(23:10 +0000)
client/client.c
patch
|
blob
|
history
diff --git
a/client/client.c
b/client/client.c
index
ac57c74
..
f0416fe
100644
(file)
--- 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.
*
* 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
*/
/** \file client.c
* \brief yaz-client program
@@
-13,6
+13,9
@@
#include <assert.h>
#include <time.h>
#include <ctype.h>
#include <assert.h>
#include <time.h>
#include <ctype.h>
+#ifndef WIN32
+#include <signal.h>
+#endif
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
#if HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
@@
-4679,12
+4682,23
@@
char **readline_completer(char *text, int start, int end)
}
#endif
}
#endif
+#ifndef WIN32
+void ctrl_c_handler(int x)
+{
+ exit_client(0);
+}
+#endif
+
static void client(void)
{
char line[10240];
line[10239] = '\0';
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
#if HAVE_GETTIMEOFDAY
gettimeofday (&tv_start, 0);
#endif