Skip to content
Snippets Groups Projects
Commit e9f1923c authored by Terence Denning's avatar Terence Denning
Browse files

latest

parent 500d04c2
No related branches found
No related tags found
No related merge requests found
...@@ -225,8 +225,8 @@ static bool handle_http_request(int sockfd) ...@@ -225,8 +225,8 @@ static bool handle_http_request(int sockfd)
user1_start = 0; user1_start = 0;
user2_start = 0; user2_start = 0;
for(int i=0; i<100; i++){ for(int i=0; i<100; i++){
strcpy(user1_guesses[i], ""); memset(user1_guesses[i], '\0', 100);
strcpy(user2_guesses[i],""); memset(user2_guesses[i], '\0', 100);
} }
webpage = "html/6_endgame.html"; webpage = "html/6_endgame.html";
} }
...@@ -235,8 +235,7 @@ static bool handle_http_request(int sockfd) ...@@ -235,8 +235,7 @@ static bool handle_http_request(int sockfd)
} else if( gameover == 1){ } else if( gameover == 1){
webpage = "html/6_endgame.html"; webpage = "html/6_endgame.html";
gameover = 0; gameover = 0;
} } else {
else {
webpage = "html/5_discarded.html"; webpage = "html/5_discarded.html";
} }
} else if(sockfd == user2){ } else if(sockfd == user2){
...@@ -257,18 +256,16 @@ static bool handle_http_request(int sockfd) ...@@ -257,18 +256,16 @@ static bool handle_http_request(int sockfd)
user1_start = 0; user1_start = 0;
user2_start = 0; user2_start = 0;
for(int i=0; i<100; i++){ for(int i=0; i<100; i++){
strcpy(user1_guesses[i], ""); memset(user1_guesses[i], '\0', 100);
strcpy(user2_guesses[i],""); memset(user2_guesses[i], '\0', 100);
} }
webpage = "html/6_endgame.html"; webpage = "html/6_endgame.html";
} }
} }
} } else if( gameover == 1){
else if( gameover == 1){
webpage = "html/6_endgame.html"; webpage = "html/6_endgame.html";
gameover = 0; gameover = 0;
} } else {
else {
webpage = "html/5_discarded.html"; webpage = "html/5_discarded.html";
} }
} else { } else {
...@@ -306,7 +303,7 @@ static bool handle_http_request(int sockfd) ...@@ -306,7 +303,7 @@ static bool handle_http_request(int sockfd)
buff[p1] = buff[p2]; buff[p1] = buff[p2];
++p2; ++p2;
// put the separator // put the separator
buff[p2++] = ','; buff[p2++] = ' ';
buff[p2++] = ' '; buff[p2++] = ' ';
// copy the username // copy the username
strncpy(buff + p2, username, username_length); strncpy(buff + p2, username, username_length);
......
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment