that would be really humiliating..here's the code for it:
Code:
void delJob(pid_t pid){
jobs* temp = job;
bool found = false;
if (temp->pid == pid){
free(temp);
temp = NULL;
job = job->next;
job->last = job;
found = true;
}
else{
while (temp != NULL && temp->next != NULL){
if (temp->next->pid == pid){
jobs* toDel = temp->next;
temp->next = temp->next->next;
toDel = NULL;
if (job->last == NULL){
job->last = temp->next;
}
found = true;
printf("%d deleted from list.\n",pid);
return;
}
temp = temp->next;
}
if(!found) printf("%d has not been found in the job list.\n",pid);
}
}