summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authormongo <andmarti@gmail.com>2017-12-01 10:11:48 -0300
committermongo <andmarti@gmail.com>2017-12-01 10:11:48 -0300
commit87242d8a8e4fdbd621f7dafcec5c17b4a95624b4 (patch)
treea162c9f306c75a80b3b936dd36dded0200429842 /src/main.c
parent6c3967ed314cf625f7edf2ae48bb7911edca4ae3 (diff)
Work on issue 213
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/main.c b/src/main.c
index 19e5fec..cd6bbf6 100644
--- a/src/main.c
+++ b/src/main.c
@@ -40,7 +40,7 @@
* \author Andrés Martinelli <andmarti@gmail.com>
* \date 2017-07-18
* \brief The main file of sc-im
- *
+ *
* \details This is the main file for sc-im.
*
* \see Homepage: https://github.com/andmarti1424/sc-im
@@ -589,6 +589,8 @@ void signals() {
void sig_term();
void nopipe();
void winchg();
+ void sig_tstp();
+ void sig_cont();
signal(SIGINT, sig_int);
signal(SIGABRT, sig_abrt);
@@ -598,6 +600,8 @@ void signals() {
signal(SIGWINCH, winchg);
//(void) signal(SIGBUS, doquit);
//(void) signal(SIGFPE, doquit);
+ signal(SIGTSTP, sig_tstp);
+ signal(SIGCONT, sig_cont);
return;
}
@@ -617,6 +621,31 @@ void nopipe() {
}
/**
+ * \brief Handles the SIGTSTP signal
+ *
+ * \return none
+ */
+
+void sig_tstp() {
+ sc_debug("Got SIGTSTP.");
+ signal(SIGTSTP, SIG_DFL); /* set handler to default */
+ kill(getpid(), SIGTSTP); /* call the default handler */
+}
+
+
+/**
+ * \brief Handles the SIGCONT signal
+ *
+ * \return none
+ */
+
+void sig_cont() {
+ signal(SIGTSTP, sig_tstp); /* set handler back to this */
+ winchg();
+ sc_debug("Got SIGCONT.");
+}
+
+/**
* \brief Handles the SIGINT signal
*
* \return none