Code

the updated sources
[ncmpc.git] / src / main.c
index 3dd7b6b94b338948b149fb0afe37ae43d39112fd..c00b7ad68b6d358bd4fba2e5cd1f5442e8446c99 100644 (file)
@@ -134,6 +134,13 @@ catch_sigint( int sig )
   exit(EXIT_SUCCESS);
 }
 
+void
+catch_sighup( int sig)
+{
+  printf("\n%s\n", _("Exiting..."));
+  exit(EXIT_SUCCESS);
+}
+
 void
 catch_sigcont( int sig )
 {
@@ -239,7 +246,17 @@ main(int argc, const char *argv[])
       perror("sigaction(SIGCONT)");
       exit(EXIT_FAILURE);
     }
-
+  /* setup signal behaviour - SIGHUP*/ 
+  sigemptyset( &act.sa_mask );
+  act.sa_flags    = 0;
+  act.sa_handler = catch_sigint;
+  if( sigaction(SIGHUP, &act, NULL)<0 )
+       {
+       perror("sigaction(SIGHUP)");
+       exit(EXIT_FAILURE);
+       }
+       
   /* install exit function */
   atexit(exit_and_cleanup);