ast_comparator/test/student_data/handout/shlab-handout/cases/reference_3_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)
{
    int pid = 0;
    struct job_t *job;
    if((pid = fgpid(jobs)) != 0) {
        kill(-pid,SIGTSTP);
        job = getjobpid(jobs,pid);
        job->state = ST;
        printf("Job [%d] (%d) stopped by signal %d\n",job->jid,pid,SIGTSTP);
    }
    return;
}
void sigtstp_handler ( int sig ) { int pid = 0 ; struct job_t * job ; if ( ( pid = fgpid ( jobs ) ) != 0 ) { kill ( - pid , SIGTSTP ) ; job = getjobpid ( jobs , pid ) ; job -> state = ST ; printf ( " \n " , job -> jid , pid , SIGTSTP ) ; } return ; }
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 .