diff options
author | mongo <andmarti@gmail.com> | 2017-12-01 10:11:48 -0300 |
---|---|---|
committer | mongo <andmarti@gmail.com> | 2017-12-01 10:11:48 -0300 |
commit | 87242d8a8e4fdbd621f7dafcec5c17b4a95624b4 (patch) | |
tree | a162c9f306c75a80b3b936dd36dded0200429842 /src/main.c | |
parent | 6c3967ed314cf625f7edf2ae48bb7911edca4ae3 (diff) |
Work on issue 213
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 31 |
1 files changed, 30 insertions, 1 deletions
@@ -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 |