ast_comparator/test/student_data/handout/shlab-handout/cases/2_tsh.c
/*
 * sigtstp_handler - The kernel sends a SIGTSTP to the shell whenever
 *     the user types ctrl-z at the keyboard. Catch it and suspend the
 *     foreground job by sending it a SIGTSTP.
 */
The kernel sends a SIGTSTP to the shell whenever
the user types ctrl-z at the keyboard. Catch it and suspend the
foreground job by sending it a SIGTSTP.
The kernel sends a SIGTSTP to the shell whenever the user types ctrl - z at the keyboard . Catch it and suspend the foreground job by sending it a SIGTSTP .
void sigtstp_handler(int sig)
{
  pid_t pid;
  if ((pid = fgpid(jobs))) {
    pid_t jid = pid2jid(pid);
    getjobpid(jobs, pid)->state = ST;
    kill(-pid, SIGTSTP);
    printf("Job [%d] (%d) stopped by signal %d\n", jid, pid, sig);
  }
}
void sigtstp_handler ( int sig ) { pid_t pid ; if ( ( pid = fgpid ( jobs ) ) ) { pid_t jid = pid2jid ( pid ) ; getjobpid ( jobs , pid ) -> state = ST ; kill ( - pid , SIGTSTP ) ; printf ( " \n " , jid , pid , sig ) ; } }
sigtstp_handler - The kernel sends a SIGTSTP to the shell whenever
     the user types ctrl-z at the keyboard.
sigtstp_handler - The kernel sends a SIGTSTP to the shell whenever the user types ctrl - z at the keyboard .
/* send signal to entire foreground process group */