Hello everyone,

I am trying to write a program that includes signals handling.
My program should not stop when he receives a SIGINT signal, he should printf a message instead.
This message should change at every single time my program receives a SIGQUIT signal.
So my program prints "message number 1" at the first reception of a SIGINT signal. then, if he receives a SIGQUIT signal, then the next time he receives a SIGINT signal, that's "message number 2" who should be displayed...

I am trying to do this using *sig_before, it seems quite logical.
However I am not sure that I should use three handlers like shown in the code.

Can someone get me some help here ?

thanks in advance
Code:
#include <signal.h>
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <string.h>
#include <unistd.h>

#define True 1

void (*sig_before)(int); /* to use for permutation */

void work() {
  while(True){
    sleep(100000);
  }
}

void work() __attribute__((noreturn));

/* signal handlers */
void sighdl1(int n) {
  printf("message number 1 \n");
}
void sighdl2(int n) {
  printf("message number 2 \n");
}
void quithdlr(int n) {
  printf("signal %i received, messages permutation", n);
} 

/* the main of my program*/
int main() {
/* here I would like to use the call system signal and sig_before so that my program can swap from one signal handler to another when he receives a QUIT signal */
  signal(SIGINT, sighdl1);
  work();

}