#include <stdio.h>
#include <stdlib.h>
#include <sys/signal.h>
#include <string.h>
void handler (int sig);
int count;
int main() {
struct sigaction act;
memset (&act, 0, sizeof (act));
act.sa_handler = handler;
if (sigaction (SIGHUP, &act, NULL) < 0) {
perror ("sigaction");
exit (-1);
}
int count = 0;
while(1) {
sleep(1);
count++;
}
}
void handler (int signal_number){
printf ("count is %d\n", count);
}
I assume i am doing this right, how would I go about call sighup within the command line? It needs to call sighup to print out my count.