ast_comparator/test/student_data/anonymized/reference_17_tsh.c
/*
 * Exec for built-in functions.
 */
Exec for built-in functions.
Exec for built - in functions .
void exec_builtin(struct cmdline_tokens *tok)
{
    struct job_t* job;
    switch(tok->builtins) {
        case BUILTIN_QUIT:
            exit(0);
        break;
        case BUILTIN_JOBS:
            listjobs(job_list,
                tok->outfile ? creat(tok->outfile, 0644) : 1);
        break;
        case BUILTIN_BG:
            job = get_first_arg(tok);
            if (job == NULL) return;
            kill(-(job->pid), SIGCONT);
            printf("[%d] (%d) %s", job->jid, job->pid, job->cmdline);
            job->state = BG;
        break;
        case BUILTIN_FG:
            job = get_first_arg(tok);
            if (job == NULL) return;
            Suspend(job);
            job->state = FG;
            kill(-(job->pid), SIGCONT);
        default:
            return;
    }
    return;
}
void exec_builtin ( struct cmdline_tokens * tok ) { struct job_t * job ; switch ( tok -> builtins ) { case BUILTIN_QUIT : exit ( 0 ) ; break ; case BUILTIN_JOBS : listjobs ( job_list , tok -> outfile ? creat ( tok -> outfile , 0644 ) : 1 ) ; break ; case BUILTIN_BG : job = get_first_arg ( tok ) ; if ( job == NULL ) return ; kill ( - ( job -> pid ) , SIGCONT ) ; printf ( " " , job -> jid , job -> pid , job -> cmdline ) ; job -> state = BG ; break ; case BUILTIN_FG : job = get_first_arg ( tok ) ; if ( job == NULL ) return ; Suspend ( job ) ; job -> state = FG ; kill ( - ( job -> pid ) , SIGCONT ) ; default : return ; } return ; }
Exec for built-in functions.
Exec for built - in functions .