ast_comparator/test/student_data/handout/shlab-handout/cases/24_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;
  int jid;
  pid = fgpid(jobs);	
  jid = pid2jid(pid);	
  if(pid == 0) return;	
  if(sig != -1)
  	kill(-pid, SIGINT);	
  if(sig == -1){		
    deletejob(jobs, pid);
    printf("Job [%d] (%d) terminated by signal %d\n", jid, pid, SIGINT);
  }
  return;
}
void sigint_handler ( int sig ) { pid_t pid ; int jid ; pid = fgpid ( jobs ) ; jid = pid2jid ( pid ) ; if ( pid == 0 ) return ; if ( sig != -1 ) kill ( - pid , SIGINT ) ; if ( sig == -1 ) { deletejob ( jobs , pid ) ; printf ( " \n " , jid , pid , SIGINT ) ; } 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 .
/* get fg process's pid */ /* get fg process's jid */ /* If there is no fg process, then return */ /* Send SIGINT to fg process group */ /* Reap(Delete) job, -1 is sign for reap */