ast_comparator/test/student_data/handout/shlab-handout/cases/reference_9_tsh.c
/////////////////////////////////////////////////////////////////////////////
//
// sigint_handler - The kernel sends a SIGINT to the shell whenver the
//    user types ctrl-c at the keyboard.  Catch it and send it along
//    to the foreground job.  
//
The kernel sends a SIGINT to the shell whenver the
user types ctrl-c at the keyboard.  Catch it and send it along
to the foreground job.
The kernel sends a SIGINT to the shell whenver the user types ctrl - c at the keyboard . Catch it and send it along to the foreground job .
void sigint_handler(int sig) 
{
    pid_t pid = fgpid(jobs);
    if (pid > 0){ 
        kill(-pid, sig); 
    }
    return;
}
void sigint_handler ( int sig ) { pid_t pid = fgpid ( jobs ) ; if ( pid > 0 ) { kill ( - pid , sig ) ; } return ; }
sigint_handler - The kernel sends a SIGINT to the shell whenver the
user types ctrl-c at the keyboard.
sigint_handler - The kernel sends a SIGINT to the shell whenver the user types ctrl - c at the keyboard .
//must be greater than zero to be a fg job, 0 means no fg process found //kill the process - this is the default action for sigint