If you read the man page you find that you can pass a pointer to a function to execute when the signal occurs. As such:
Code:
#include <stdio.h>
#include <signal.h>
#include <string.h>
void test(void);
int main (void)
{
char buffer[1024];
int keepalive=1;
signal(SIGINT, (void *)test);
do
{
printf("Type something (QUIT to quit): ");
fgets(buffer, sizeof(buffer), stdin);
if ( !strcmp(buffer, "QUIT\n") )
keepalive = 0;
printf("You typed: %s", buffer);
}while(keepalive);
return 0;
}
void test (void)
{
puts("HAHA YOU CAN'T ESCAPE THAT EASILY");
}