ast_comparator/test/student_data/handout/shlab-handout/cases/reference_22_tsh.c
/*
 * Requires:
 *   "jobs" points to an array of MAXJOBS job structures.
 *
 * Effects:
 *   Prints the jobs list.
 */
"jobs" points to an array of MAXJOBS job structures.

Prints the jobs list.
" jobs " points to an array of MAXJOBS job structures . Prints the jobs list .
static void
listjobs(JobP jobs) 
{
	int i;
	for (i = 0; i < MAXJOBS; i++) {
		if (jobs[i].pid != 0) {
			printf("[%d] (%d) ", jobs[i].jid, (int)jobs[i].pid);
			switch (jobs[i].state) {
			case BG: 
				printf("Running ");
				break;
			case FG: 
				printf("Foreground ");
				break;
			case ST: 
				printf("Stopped ");
				break;
			default:
				printf("listjobs: Internal error: "
				    "job[%d].state=%d ", i, jobs[i].state);
			}
			printf("%s", jobs[i].cmdline);
		}
	}
}
static void listjobs ( JobP jobs ) { int i ; for ( i = 0 ; i < MAXJOBS ; i ++ ) { if ( jobs [ i ] . pid != 0 ) { printf ( " " , jobs [ i ] . jid , ( int ) jobs [ i ] . pid ) ; switch ( jobs [ i ] . state ) { case BG : printf ( " " ) ; break ; case FG : printf ( " " ) ; break ; case ST : printf ( " " ) ; break ; default : printf ( " " " " , i , jobs [ i ] . state ) ; } printf ( " " , jobs [ i ] . cmdline ) ; } } }
Requires:
   "jobs" points to an array of MAXJOBS job structures.
Requires : " jobs " points to an array of MAXJOBS job structures .