struct job_t *getjobpid(struct job_t *jobs, pid_t pid); struct job_t *getjobjid(struct job_t *jobs, int jid);
Example: If you know the pid how do you change the state to BG:
struct job_t *p; p = getjobpid(jobs, pid); if ( p != NULL ) { p->state = BG; }
Always pointers are not NULL before trying to access what it points to!
The return value of this function could be NULL if the pid is invalid. E.g., the user entered an incorrect pid or the job was not correctly added to the job list, etc.