Come ha già detto fastcoder, puoi intercettare SIGINT:

codice:
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>

void exit_fn1 (void)
{
    printf("Exit function #1 called\n");
}

void exit_fn2 (void)
{
    printf("Exit function #2 called\n");
}

void sig_handler (int num)
{
    exit (1);
}


int main (void)
{
    signal (SIGINT, sig_handler);

    atexit (exit_fn1);
    atexit (exit_fn2);

    while (1) { }

    return 0;
}