From 2ee0f797e325d099d1224501471a4b30db54654b Mon Sep 17 00:00:00 2001 From: Anqi Chen <a.chen49@student.unimelb.edu.au> Date: Mon, 29 Apr 2019 20:45:10 +1000 Subject: [PATCH] swapp users fixed --- img.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/img.c b/img.c index 3fec01b..79bbeb3 100644 --- a/img.c +++ b/img.c @@ -172,7 +172,8 @@ struct User* the_other_user(struct User* curr_user, struct User* user_arr[]){ // try to match the new guess to the other user keywords bool match(char* w1, char** w2, int n_word){ for (int i=0; i<n_word; i++){ - if (w2[i]==w1){ + printf("%s - %s \n", w1, w2[i]); + if (strcmp(w1, w2[i])==0){ printf("all good"); return true; } @@ -408,7 +409,7 @@ static bool handle_http_request(int sockfd, struct User* user_arr[]) record_keyword(curr_user, guess); char guess_buff[MAX_BUFF]; - strcpy(guess_buff,"<br>"); + strcpy(guess_buff,","); if(curr_user->n_word==1) { @@ -421,7 +422,7 @@ static bool handle_http_request(int sockfd, struct User* user_arr[]) for (int i = 0; i < curr_user->n_word; ++i) { strcat(guess_buff, curr_user->keywords[i]); - strcat(guess_buff,"<br>"); + strcat(guess_buff,","); } } edit_load_html("4_accepted.html", sockfd,buff,guess_buff,curr_user); -- GitLab