ast_comparator/test/student_data/handout/shlab-handout/cases/58_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;
  struct job_t *job;
  if((pid=fgpid(jobs))>0) {
    if(kill(-pid, SIGINT)<0)
      unix_error("kill");
    if((job=getjobpid(jobs, pid))!=NULL) {
      job->state=UNDEF;
      printf("Job [%i] (%i) terminated by signal %i\n", job->jid, job->pid, sig);
    }
  }
  return;
}
void sigint_handler ( int sig ) { pid_t pid ; struct job_t * job ; if ( ( pid = fgpid ( jobs ) ) > 0 ) { if ( kill ( - pid , SIGINT ) < 0 ) unix_error ( " " ) ; if ( ( job = getjobpid ( jobs , pid ) ) != NULL ) { job -> state = UNDEF ; printf ( " \n " , job -> jid , job -> 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 .
/* checks for fg process */ /* sending SIGINT signal to fg process group */ /* updating jobs list */