Project 9’s Code
request.c
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include “request.h”
#include “readline.h”
struct request *append_to_list(struct request *list){
int room_number;
printf(“Enter room number: “);
scanf(“%d”, &room_number);
while (getchar() != ‘n’);
struct request *ptr = list;
if(list != NULL) {
do {
if(ptr->room_number == room_number) {
printf(“A request for this room already exists.n”);
printf(“Please use update function to update therequest.n”);
return list;
}
if(ptr->next != NULL) {
ptr = ptr->next;
}
} while(ptr->next != NULL);
}
struct request *newReq = malloc(sizeof(struct request));
newReq->room_number = room_number;
printf(“Enter first name: “);
read_line(newReq->first, NAME_LEN);
printf(“Enter last name: “);
read_line(newReq->last, NAME_LEN);
printf(“Enter number of items: “);
scanf(“%d”, &newReq->num_items);
while (getchar() !=