1 // Client-side IPC functions
3 // Copyright (c) 1987-2018 by the citadel.org team
5 // This program is open source software. Use, duplication, and/or
6 // disclosure are subject to the GNU General Purpose License version 3.
8 // This program is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 // GNU General Public License for more details.
14 #include "textclient.h"
17 /* Note that some of these functions may not work with multiple instances. */
19 static void (*deathHook)(void) = NULL;
20 int (*error_printf)(char *s, ...) =(int(*)(char *, ...)) printf;
22 void setIPCDeathHook(void (*hook)(void)) {
26 void setIPCErrorPrintf(int (*func)(char *s, ...)) {
30 void connection_died(CtdlIPC * ipc, int using_ssl) {
31 if (deathHook != NULL) {
35 stty_ctdl(SB_RESTORE);
36 fprintf(stderr, "\r\n\n\n");
37 fprintf(stderr, "Your connection to %s is broken.\n", ipc->ServInfo.humannode);
41 fprintf(stderr, "Last error: %s\n", ERR_reason_error_string(ERR_get_error()));
47 fprintf(stderr, "Last error: %s\n", strerror(errno));
49 fprintf(stderr, "Please re-connect and log in again.\n");
52 shutdown(ipc->sock, 2);