summaryrefslogtreecommitdiff
path: root/src/sign.cpp
blob: ad3e02a01b0248617d34de74b814f703826ba6ab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef SIGN_CPP
#define SIGN_CPP

#include "sign.h"

void
sign::clean_template_cache(int i_param)
{
  wrap::HTML->clear_cache();
}


#ifdef CTCSEGV
void
sign::sigsev_received(int i_param)
{
  wrap::system_message(SIGNSEG);
}
#endif

void
sign::terminate_received(int i_param)
{

#ifdef NCURSES

  mvprintw( 21,2, "Good bye !");
  wrap::NCUR->close_ncurses();

#endif

  exit(0);
}

void
sign::init_signal_handlers()
{
  // Ignore SIGPIPE. otherwise the server will shut down with "Broken pipe" if
  // a client unexpected disconnects himself from a SOCK_STREAM.
  signal(SIGPIPE, SIG_IGN);

  signal(SIGUSR1, clean_template_cache);
#ifdef CTCSEGV
  signal(SIGSEGV, sigsev_received); 
#endif
  signal(SIGHUP, terminate_received);
  signal(SIGINT, terminate_received);
  signal(SIGTERM, terminate_received);
  //signal(SIGWINCH, );
}

#endif