diff --git a/CMakeLists.txt b/CMakeLists.txt index 632001a..9a2c167 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,3 +17,8 @@ target_link_libraries(simple-dict-server dict spb pthread) target_link_libraries(simple-dict-client pthread) target_link_libraries(migrate spb) target_link_libraries(cfgwriter spb) + +INSTALL(TARGETS simple-dict-server RUNTIME DESTINATION bin) +#INSTALL(TARGETS simple-dict-client RUNTIME DESTINATION bin) +#INSTALL(TARGETS migrate RUNTIME DESTINATION bin) +#INSTALL(TARGETS cfgwriter RUNTIME DESTINATION bin) \ No newline at end of file diff --git a/server.c b/server.c index a6a6ec1..5bd752a 100644 --- a/server.c +++ b/server.c @@ -1,7 +1,5 @@ #include #include - -#include #include #include #include @@ -11,6 +9,7 @@ #include #include #include +#include #include #include #include "dict.h" @@ -136,7 +135,7 @@ int send_all(THREADTIMER *timer) { timer->fp = fp; timer->is_open = 1; off_t len = 0, file_size = get_dict_size(); - sprintf(timer->data, "%zd$", file_size); + sprintf(timer->data, "%u$", file_size); printf("Get file size: %s bytes.\n", timer->data); uint32_t head_len = strlen(timer->data); #if __APPLE__ @@ -379,7 +378,7 @@ void handle_accept(void *p) { while(*(timer_pointer_of(p)->thread) && (timer_pointer_of(p)->numbytes = recv(accept_fd, buff, BUFSIZ, 0)) > 0) { touch_timer(p); buff[timer_pointer_of(p)->numbytes] = 0; - printf("Get %zd bytes: %s\n", timer_pointer_of(p)->numbytes, buff); + printf("Get %u bytes: %s\n", timer_pointer_of(p)->numbytes, buff); puts("Check buffer"); take_word(p, cfg->pwd); take_word(p, "cat"); @@ -387,7 +386,7 @@ void handle_accept(void *p) { take_word(p, delpass); if(timer_pointer_of(p)->numbytes > 0) chkbuf(p); } - printf("Break: recv %zd bytes\n", timer_pointer_of(p)->numbytes); + printf("Break: recv %u bytes\n", timer_pointer_of(p)->numbytes); } else puts("Error allocating buffer"); *(timer_pointer_of(p)->thread) = 0; kill_thread(timer_pointer_of(p));