ast_comparator/test/student_data/handout/shlab-handout/cases/reference_10_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;
    int jid;
    pid = fgpid(jobs);
    if (kill(-pid, SIGTSTP) < 0) {
        fprintf(stdout, "kill error");
        return;
    }
    jid = pid2jid(pid); 
    jobs[jid-1].state = ST;
    printf("JID [%d] (%d) stopped by signal %d\n", jid, pid, SIGTSTP);
    pause_flag = 1;
    return;
}
void sigtstp_handler ( int sig ) { pid_t pid ; int jid ; pid = fgpid ( jobs ) ; if ( kill ( - pid , SIGTSTP ) < 0 ) { fprintf ( stdout , " " ) ; return ; } jid = pid2jid ( pid ) ; jobs [ jid - 1 ] . state = ST ; printf ( " \n " , jid , pid , SIGTSTP ) ; pause_flag = 1 ; 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 .