Skip to content
Snippets Groups Projects
Commit a10c6234 authored by ChouTatsumi's avatar ChouTatsumi
Browse files

test 21:57

parent c171c10b
Branches
No related tags found
No related merge requests found
...@@ -358,6 +358,8 @@ bool show_modified_page(int sockfd, const char* htmldir, char* added, ...@@ -358,6 +358,8 @@ bool show_modified_page(int sockfd, const char* htmldir, char* added,
} }
close(filefd); close(filefd);
print_buff(buff);
// move the trailing part backward // move the trailing part backward
int p1, p2; int p1, p2;
for (p1 = size - 1, p2 = p1 - added_length; p1 >= size - inset_index; for (p1 = size - 1, p2 = p1 - added_length; p1 >= size - inset_index;
...@@ -368,6 +370,8 @@ bool show_modified_page(int sockfd, const char* htmldir, char* added, ...@@ -368,6 +370,8 @@ bool show_modified_page(int sockfd, const char* htmldir, char* added,
// copy the username // copy the username
strncpy(buff + p2, added, added_length); strncpy(buff + p2, added, added_length);
print_buff(buff);
if (write(sockfd, buff, size) < 0) { if (write(sockfd, buff, size) < 0) {
perror("write"); perror("write");
return false; return false;
...@@ -419,7 +423,9 @@ bool show_accepted_page(int sockfd) { ...@@ -419,7 +423,9 @@ bool show_accepted_page(int sockfd) {
strcat(added, added_suffix); strcat(added, added_suffix);
return show_modified_page(sockfd, ACCEPTED_PAGE, added, 212); printf("added is now %s", added);
return show_modified_page(sockfd, ACCEPTED_PAGE, added, 230);
} }
void print_buff(char* request) { void print_buff(char* request) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment