ast_comparator/test/student_data/handout/shlab-handout/cases/reference_12_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 = fgpid(jobs);
    int jid = pid2jid(pid);
    if (pid != 0) 
    {   
        printf("Job [%d] (%d) Stopped by signal %d\n", jid, pid, sig);
        getjobpid(jobs, pid)->state = ST;   
        kill(-pid, SIGTSTP);    
    }
    return;
}
void sigtstp_handler ( int sig ) { int pid = fgpid ( jobs ) ; int jid = pid2jid ( pid ) ; if ( pid != 0 ) { printf ( " \n " , jid , pid , sig ) ; getjobpid ( jobs , pid ) -> state = ST ; kill ( - 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 .
// send fg job related process group signal // get their process id for when they called for jobs so it display stopped process // stop jobs