int addjob(struct job_t *jobs, pid_t pid, int state, char *cmdline);
The shell will need to call this each function to add a job the process it creates for any command that is not built in.
Where does the job id get created? (by addjob)
Is the job id an index into the jobs array? (no)
How do you get the job entry if you know the process id? the job id?
struct job_t { /* The job struct */ pid_t pid; /* job PID */ int jid; /* job ID [1, 2, ...] */ int state; /* UNDEF, BG, FG, or ST */ char cmdline[MAXLINE]; /* command line */ }; struct job_t jobs[MAXJOBS]; /* The job list */