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

updated current guesses

parents 7c1f1292 22fba9ec
No related branches found
No related tags found
No related merge requests found
No preview for this file type
......@@ -56,6 +56,8 @@ static char *user2_name = "";
static int user2_start = 0;
char user2_guesses[100][100];
int user2_guess_number = 0;
char user1_current_guesses[10100];
char user2_current_guesses[10100];
int gameover = 0;
......@@ -210,8 +212,6 @@ static bool handle_http_request(int sockfd)
stat(webpage, &st);
username = strstr(buff, "user=") + 5;
//set_user(sockfd);
username_length = strlen(username);
added_length = username_length + 2;
size = st.st_size + added_length;
......@@ -247,7 +247,6 @@ static bool handle_http_request(int sockfd)
webpage = "html/5_discarded.html";
}
} else {
printf("user1: %d, user2: %d\n", user1, user2);
webpage = "html/6_endgame.html";
}
......@@ -276,11 +275,8 @@ static bool handle_http_request(int sockfd)
}
close(filefd);
if( strcmp(webpage, "html/4_accepted.html") == 0 ){
char user1_current_guesses[10100];
char user2_current_guesses[10100];
if( strcmp(webpage, "html/4_accepted.html") == 0 ){
if(sockfd == user1){
memset(user1_current_guesses, '\0', 10100);
for(int i=0; i<100; i++){
......@@ -300,10 +296,11 @@ static bool handle_http_request(int sockfd)
}
}
printf("\nUser1 guesses: %s\n User2 guesses: %s\n", user1_current_guesses, user2_current_guesses);
printf("User1 guesses: %s, User2 guesses: %s\n", user1_current_guesses, user2_current_guesses);
}
if((strlen(username) > 0) && (strstr(buff, "user=") != NULL) ){
// move the trailing part backward
int p1, p2;
......
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