Skip to content
Snippets Groups Projects
Commit 2ee0f797 authored by Anqi Chen's avatar Anqi Chen
Browse files

swapp users fixed

parent 0fe4bac2
No related branches found
No related tags found
No related merge requests found
Pipeline #1845 canceled
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment