compiles on linux platform. GET fixed

This commit is contained in:
Jack Halford 2017-06-14 11:53:47 +02:00
parent ebb2a5cefc
commit cd41b16053
4 changed files with 11 additions and 7 deletions

View file

@ -10,6 +10,8 @@
# # # #
# **************************************************************************** # # **************************************************************************** #
SHELL := bash
NAME = server client NAME = server client
CC = gcc CC = gcc
@ -54,17 +56,18 @@ all :
@make -j $(NAME) @make -j $(NAME)
server: $(LIBFT_LIB) $(OBJ_DIR) $(OBJS) $(SERVER_OBJ) server: $(LIBFT_LIB) $(OBJ_DIR) $(OBJS) $(SERVER_OBJ)
@$(CC) $(OBJS) -o $@ \ @$(CC) $(FLAGS) $(OBJS) -o $@ \
-I $(INC_DIR) \ -I $(INC_DIR) \
-I $(LIBFT_INC) \ -I $(LIBFT_INC) \
$(LIBFT_LIB) $(SERVER_OBJ) $(FLAGS) $(SERVER_OBJ) $(LIBFT_LIB)
@printf "\r\033[38;5;117m✓ MAKE $@ \033[0m\033[K\n" @printf "\r\033[38;5;117m✓ MAKE $@ \033[0m\033[K\n"
client: $(LIBFT_LIB) $(OBJ_DIR) $(OBJS) $(CLIENT_OBJ) client: $(LIBFT_LIB) $(OBJ_DIR) $(OBJS) $(CLIENT_OBJ)
@$(CC) $(OBJS) -o $@ \ @$(CC) $(FLAAGS) $(OBJS) -o $@ \
-I $(INC_DIR) \ -I $(INC_DIR) \
-I $(LIBFT_INC) \ -I $(LIBFT_INC) \
-lreadline $(LIBFT_LIB) $(CLIENT_OBJ) $(FLAGS) $(CLIENT_OBJ) $(LIBFT_LIB) \
-lreadline
@printf "\r\033[38;5;117m✓ MAKE $@ \033[0m\033[K\n" @printf "\r\033[38;5;117m✓ MAKE $@ \033[0m\033[K\n"
$(LIBFT_LIB): $(LIBFT_LIB):

View file

@ -24,6 +24,7 @@
# include <readline/readline.h> # include <readline/readline.h>
# include <sys/mman.h> # include <sys/mman.h>
# include <sys/wait.h>
typedef struct s_cmd_map t_cmd_map; typedef struct s_cmd_map t_cmd_map;

View file

@ -36,9 +36,9 @@ int cli_do_get(int sock, char **av)
console_msg(3, "received num_last_blk=[%i]", num_last_blk); console_msg(3, "received num_last_blk=[%i]", num_last_blk);
} }
i = -1; i = -1;
while (++i < num_blks) while (++i < num_blks - 1)
net_get_fd(sock, fd, MAXSIZE); net_get_fd(sock, fd, MAXSIZE);
if (num_last_blk) if (num_last_blk)
net_get_fd(sock, fd, MAXSIZE); net_get_fd(sock, fd, num_last_blk);
return (0); return (0);
} }

View file

@ -45,7 +45,7 @@ int serv_do_get(int sock)
num_blks = ntohs(num_blks); num_blks = ntohs(num_blks);
num_last_blk = ntohs(num_last_blk); num_last_blk = ntohs(num_last_blk);
i = -1; i = -1;
while (++i < num_blks) while (++i < num_blks - 1)
net_send(sock, file + i * MAXSIZE, MAXSIZE); net_send(sock, file + i * MAXSIZE, MAXSIZE);
if (num_last_blk) if (num_last_blk)
net_send(sock, file + i * MAXSIZE, MAXSIZE); net_send(sock, file + i * MAXSIZE, MAXSIZE);