ast_comparator/test/student_data/handout/shlab-handout/cases/reference_6_tsh.c
/* 
 * builtin_cmd - If the user has typed a built-in command then execute
 *    it immediately.  
 */
If the user has typed a built-in command then execute
it immediately.
If the user has typed a built - in command then execute it immediately .
int builtin_cmd(char **argv)
{
    if (!strcmp(argv[0], "quit")) {
    int i;
    int stopped = 0;
    for (i=0; i<16; i++) {
        if (jobs[i].state == ST)
        stopped = 1;
    }
    if (stopped == 1) {
        printf("There are stopped jobs\n");
        return 1;
    } else {
        exit(0);
    }
    }
    if (!strcmp(argv[0], "jobs")) {
    listjobs(jobs);
    return 1;
    }
    if (!strcmp(argv[0], "fg") || !strcmp(argv[0], "bg")) {
    do_bgfg(argv);
    return 1;
    }
    if (!strcmp(argv[0], "&"))  
    return 1;
    return 0;     
}
int builtin_cmd ( char * * argv ) { if ( ! strcmp ( argv [ 0 ] , " " ) ) { int i ; int stopped = 0 ; for ( i = 0 ; i < 16 ; i ++ ) { if ( jobs [ i ] . state == ST ) stopped = 1 ; } if ( stopped == 1 ) { printf ( " \n " ) ; return 1 ; } else { exit ( 0 ) ; } } if ( ! strcmp ( argv [ 0 ] , " " ) ) { listjobs ( jobs ) ; return 1 ; } if ( ! strcmp ( argv [ 0 ] , " " ) || ! strcmp ( argv [ 0 ] , " " ) ) { do_bgfg ( argv ) ; return 1 ; } if ( ! strcmp ( argv [ 0 ] , " " ) ) return 1 ; return 0 ; }
builtin_cmd - If the user has typed a built-in command then execute
    it immediately.
builtin_cmd - If the user has typed a built - in command then execute it immediately .
/* Check the state of jobs before exiting */ /* Ignore singleton & */ /* not a builtin command */