diff --git a/Makefile b/Makefile index 306f555..66f6ec0 100644 --- a/Makefile +++ b/Makefile @@ -55,6 +55,6 @@ server_re: server_fclean client_re: client_fclean client -re: client_re server +re: fclean all .PHONY: all clean fclean re client_re client_clean client_fclean server_re server_clean server_fclean diff --git a/client b/client deleted file mode 100755 index a086530..0000000 Binary files a/client and /dev/null differ diff --git a/client_src/main.c b/client_src/main.c index a8843d9..426c494 100644 --- a/client_src/main.c +++ b/client_src/main.c @@ -25,7 +25,6 @@ void ft_char2signal(int pid, char c) else kill(pid, SIGUSR1); i--; - usleep(0); } } diff --git a/client_src/main.o b/client_src/main.o index 1cca935..f6c3d6b 100644 Binary files a/client_src/main.o and b/client_src/main.o differ diff --git a/libftx/extra/extra.a b/libftx/extra/extra.a deleted file mode 100644 index af15efb..0000000 Binary files a/libftx/extra/extra.a and /dev/null differ diff --git a/libftx/extra/ft_contain_only.o b/libftx/extra/ft_contain_only.o deleted file mode 100644 index 86d4ebd..0000000 Binary files a/libftx/extra/ft_contain_only.o and /dev/null differ diff --git a/libftx/extra/ft_freer.o b/libftx/extra/ft_freer.o deleted file mode 100644 index 5933583..0000000 Binary files a/libftx/extra/ft_freer.o and /dev/null differ diff --git a/libftx/extra/ft_is_in.o b/libftx/extra/ft_is_in.o deleted file mode 100644 index c24c925..0000000 Binary files a/libftx/extra/ft_is_in.o and /dev/null differ diff --git a/libftx/extra/ft_isnum.o b/libftx/extra/ft_isnum.o deleted file mode 100644 index 1eb7255..0000000 Binary files a/libftx/extra/ft_isnum.o and /dev/null differ diff --git a/libftx/extra/ft_random_generator.o b/libftx/extra/ft_random_generator.o deleted file mode 100644 index 5bed897..0000000 Binary files a/libftx/extra/ft_random_generator.o and /dev/null differ diff --git a/libftx/extra/ft_realloc.c b/libftx/extra/ft_realloc.c index 2f14ec6..d97c266 100644 --- a/libftx/extra/ft_realloc.c +++ b/libftx/extra/ft_realloc.c @@ -26,6 +26,7 @@ void *ft_realloc(void *tab, size_t size, size_t new_size, int bytes) new[i] = ((char *) tab)[i]; i++; } - free(tab); + if (tab != NULL) + free(tab); return (new); } diff --git a/libftx/extra/ft_realloc.o b/libftx/extra/ft_realloc.o deleted file mode 100644 index d5028c3..0000000 Binary files a/libftx/extra/ft_realloc.o and /dev/null differ diff --git a/libftx/extra/ft_strchri.o b/libftx/extra/ft_strchri.o deleted file mode 100644 index fef030e..0000000 Binary files a/libftx/extra/ft_strchri.o and /dev/null differ diff --git a/libftx/extra/ft_strcmp.o b/libftx/extra/ft_strcmp.o deleted file mode 100644 index 677a191..0000000 Binary files a/libftx/extra/ft_strcmp.o and /dev/null differ diff --git a/libftx/extra/ft_strfjoin.o b/libftx/extra/ft_strfjoin.o deleted file mode 100644 index 6b5be38..0000000 Binary files a/libftx/extra/ft_strfjoin.o and /dev/null differ diff --git a/libftx/extra/ft_strgen.o b/libftx/extra/ft_strgen.o deleted file mode 100644 index c32d983..0000000 Binary files a/libftx/extra/ft_strgen.o and /dev/null differ diff --git a/libftx/extra/ft_strmerger.o b/libftx/extra/ft_strmerger.o deleted file mode 100644 index c577c4c..0000000 Binary files a/libftx/extra/ft_strmerger.o and /dev/null differ diff --git a/libftx/extra/ft_strndup.o b/libftx/extra/ft_strndup.o deleted file mode 100644 index e2a6f64..0000000 Binary files a/libftx/extra/ft_strndup.o and /dev/null differ diff --git a/libftx/extra/ft_ultoa_base.o b/libftx/extra/ft_ultoa_base.o deleted file mode 100644 index e515f86..0000000 Binary files a/libftx/extra/ft_ultoa_base.o and /dev/null differ diff --git a/libftx/gnl/get_next_line.a b/libftx/gnl/get_next_line.a deleted file mode 100644 index 122208f..0000000 Binary files a/libftx/gnl/get_next_line.a and /dev/null differ diff --git a/libftx/gnl/get_next_line.o b/libftx/gnl/get_next_line.o deleted file mode 100644 index 67e5c28..0000000 Binary files a/libftx/gnl/get_next_line.o and /dev/null differ diff --git a/libftx/libft/ft_atoi.o b/libftx/libft/ft_atoi.o deleted file mode 100644 index 5a0ae63..0000000 Binary files a/libftx/libft/ft_atoi.o and /dev/null differ diff --git a/libftx/libft/ft_bzero.o b/libftx/libft/ft_bzero.o deleted file mode 100644 index 4275446..0000000 Binary files a/libftx/libft/ft_bzero.o and /dev/null differ diff --git a/libftx/libft/ft_calloc.o b/libftx/libft/ft_calloc.o deleted file mode 100644 index 1555de4..0000000 Binary files a/libftx/libft/ft_calloc.o and /dev/null differ diff --git a/libftx/libft/ft_isalnum.o b/libftx/libft/ft_isalnum.o deleted file mode 100644 index c7e9bae..0000000 Binary files a/libftx/libft/ft_isalnum.o and /dev/null differ diff --git a/libftx/libft/ft_isalpha.o b/libftx/libft/ft_isalpha.o deleted file mode 100644 index decfc4c..0000000 Binary files a/libftx/libft/ft_isalpha.o and /dev/null differ diff --git a/libftx/libft/ft_isascii.o b/libftx/libft/ft_isascii.o deleted file mode 100644 index 43aef60..0000000 Binary files a/libftx/libft/ft_isascii.o and /dev/null differ diff --git a/libftx/libft/ft_isdigit.o b/libftx/libft/ft_isdigit.o deleted file mode 100644 index 3cd638b..0000000 Binary files a/libftx/libft/ft_isdigit.o and /dev/null differ diff --git a/libftx/libft/ft_isprint.o b/libftx/libft/ft_isprint.o deleted file mode 100644 index 509f41d..0000000 Binary files a/libftx/libft/ft_isprint.o and /dev/null differ diff --git a/libftx/libft/ft_itoa.o b/libftx/libft/ft_itoa.o deleted file mode 100644 index 82787dd..0000000 Binary files a/libftx/libft/ft_itoa.o and /dev/null differ diff --git a/libftx/libft/ft_memchr.o b/libftx/libft/ft_memchr.o deleted file mode 100644 index 20f7766..0000000 Binary files a/libftx/libft/ft_memchr.o and /dev/null differ diff --git a/libftx/libft/ft_memcmp.o b/libftx/libft/ft_memcmp.o deleted file mode 100644 index 63e783d..0000000 Binary files a/libftx/libft/ft_memcmp.o and /dev/null differ diff --git a/libftx/libft/ft_memcpy.o b/libftx/libft/ft_memcpy.o deleted file mode 100644 index 82875f4..0000000 Binary files a/libftx/libft/ft_memcpy.o and /dev/null differ diff --git a/libftx/libft/ft_memmove.o b/libftx/libft/ft_memmove.o deleted file mode 100644 index 7c7802c..0000000 Binary files a/libftx/libft/ft_memmove.o and /dev/null differ diff --git a/libftx/libft/ft_memset.o b/libftx/libft/ft_memset.o deleted file mode 100644 index bf8f54f..0000000 Binary files a/libftx/libft/ft_memset.o and /dev/null differ diff --git a/libftx/libft/ft_putchar_fd.o b/libftx/libft/ft_putchar_fd.o deleted file mode 100644 index 4c7cb55..0000000 Binary files a/libftx/libft/ft_putchar_fd.o and /dev/null differ diff --git a/libftx/libft/ft_putendl_fd.o b/libftx/libft/ft_putendl_fd.o deleted file mode 100644 index 3bb62c4..0000000 Binary files a/libftx/libft/ft_putendl_fd.o and /dev/null differ diff --git a/libftx/libft/ft_putnbr_fd.o b/libftx/libft/ft_putnbr_fd.o deleted file mode 100644 index e95c051..0000000 Binary files a/libftx/libft/ft_putnbr_fd.o and /dev/null differ diff --git a/libftx/libft/ft_putstr_fd.o b/libftx/libft/ft_putstr_fd.o deleted file mode 100644 index b2dbc7f..0000000 Binary files a/libftx/libft/ft_putstr_fd.o and /dev/null differ diff --git a/libftx/libft/ft_split.o b/libftx/libft/ft_split.o deleted file mode 100644 index da1bc18..0000000 Binary files a/libftx/libft/ft_split.o and /dev/null differ diff --git a/libftx/libft/ft_strchr.o b/libftx/libft/ft_strchr.o deleted file mode 100644 index 8191a49..0000000 Binary files a/libftx/libft/ft_strchr.o and /dev/null differ diff --git a/libftx/libft/ft_strdup.o b/libftx/libft/ft_strdup.o deleted file mode 100644 index 67b792f..0000000 Binary files a/libftx/libft/ft_strdup.o and /dev/null differ diff --git a/libftx/libft/ft_striteri.o b/libftx/libft/ft_striteri.o deleted file mode 100644 index 14b04d5..0000000 Binary files a/libftx/libft/ft_striteri.o and /dev/null differ diff --git a/libftx/libft/ft_strjoin.o b/libftx/libft/ft_strjoin.o deleted file mode 100644 index c5026b1..0000000 Binary files a/libftx/libft/ft_strjoin.o and /dev/null differ diff --git a/libftx/libft/ft_strlcat.o b/libftx/libft/ft_strlcat.o deleted file mode 100644 index 4153744..0000000 Binary files a/libftx/libft/ft_strlcat.o and /dev/null differ diff --git a/libftx/libft/ft_strlcpy.o b/libftx/libft/ft_strlcpy.o deleted file mode 100644 index b34e6b4..0000000 Binary files a/libftx/libft/ft_strlcpy.o and /dev/null differ diff --git a/libftx/libft/ft_strlen.o b/libftx/libft/ft_strlen.o deleted file mode 100644 index 78cab57..0000000 Binary files a/libftx/libft/ft_strlen.o and /dev/null differ diff --git a/libftx/libft/ft_strmapi.o b/libftx/libft/ft_strmapi.o deleted file mode 100644 index c3325bb..0000000 Binary files a/libftx/libft/ft_strmapi.o and /dev/null differ diff --git a/libftx/libft/ft_strncmp.o b/libftx/libft/ft_strncmp.o deleted file mode 100644 index 106edc3..0000000 Binary files a/libftx/libft/ft_strncmp.o and /dev/null differ diff --git a/libftx/libft/ft_strnstr.o b/libftx/libft/ft_strnstr.o deleted file mode 100644 index 6ffa56e..0000000 Binary files a/libftx/libft/ft_strnstr.o and /dev/null differ diff --git a/libftx/libft/ft_strrchr.o b/libftx/libft/ft_strrchr.o deleted file mode 100644 index 02868cb..0000000 Binary files a/libftx/libft/ft_strrchr.o and /dev/null differ diff --git a/libftx/libft/ft_strtrim.o b/libftx/libft/ft_strtrim.o deleted file mode 100644 index 6777cdb..0000000 Binary files a/libftx/libft/ft_strtrim.o and /dev/null differ diff --git a/libftx/libft/ft_substr.o b/libftx/libft/ft_substr.o deleted file mode 100644 index e0b7098..0000000 Binary files a/libftx/libft/ft_substr.o and /dev/null differ diff --git a/libftx/libft/ft_tolower.o b/libftx/libft/ft_tolower.o deleted file mode 100644 index d72c6e9..0000000 Binary files a/libftx/libft/ft_tolower.o and /dev/null differ diff --git a/libftx/libft/ft_toupper.o b/libftx/libft/ft_toupper.o deleted file mode 100644 index 485783d..0000000 Binary files a/libftx/libft/ft_toupper.o and /dev/null differ diff --git a/libftx/libft/libft.a b/libftx/libft/libft.a deleted file mode 100644 index e7ea2a6..0000000 Binary files a/libftx/libft/libft.a and /dev/null differ diff --git a/libftx/libftx.a b/libftx/libftx.a deleted file mode 100644 index f5a799d..0000000 Binary files a/libftx/libftx.a and /dev/null differ diff --git a/libftx/printf/ft_dprintX.o b/libftx/printf/ft_dprintX.o deleted file mode 100644 index e5bb7b6..0000000 Binary files a/libftx/printf/ft_dprintX.o and /dev/null differ diff --git a/libftx/printf/ft_dprintarg.o b/libftx/printf/ft_dprintarg.o deleted file mode 100644 index 4fabe41..0000000 Binary files a/libftx/printf/ft_dprintarg.o and /dev/null differ diff --git a/libftx/printf/ft_dprintflag.o b/libftx/printf/ft_dprintflag.o deleted file mode 100644 index 992c9a6..0000000 Binary files a/libftx/printf/ft_dprintflag.o and /dev/null differ diff --git a/libftx/printf/ft_dprintl_base.o b/libftx/printf/ft_dprintl_base.o deleted file mode 100644 index 5fe0ff8..0000000 Binary files a/libftx/printf/ft_dprintl_base.o and /dev/null differ diff --git a/libftx/printf/ft_dprintptr.o b/libftx/printf/ft_dprintptr.o deleted file mode 100644 index 0f0411f..0000000 Binary files a/libftx/printf/ft_dprintptr.o and /dev/null differ diff --git a/libftx/printf/ft_dprintstrtab.o b/libftx/printf/ft_dprintstrtab.o deleted file mode 100644 index 4db0b89..0000000 Binary files a/libftx/printf/ft_dprintstrtab.o and /dev/null differ diff --git a/libftx/printf/ft_dprintul.o b/libftx/printf/ft_dprintul.o deleted file mode 100644 index d94b571..0000000 Binary files a/libftx/printf/ft_dprintul.o and /dev/null differ diff --git a/libftx/printf/ft_dprintul_base.o b/libftx/printf/ft_dprintul_base.o deleted file mode 100644 index 7b5bd62..0000000 Binary files a/libftx/printf/ft_dprintul_base.o and /dev/null differ diff --git a/libftx/printf/ft_dprintx.o b/libftx/printf/ft_dprintx.o deleted file mode 100644 index d86c2a8..0000000 Binary files a/libftx/printf/ft_dprintx.o and /dev/null differ diff --git a/libftx/printf/ft_isarg.o b/libftx/printf/ft_isarg.o deleted file mode 100644 index 79db536..0000000 Binary files a/libftx/printf/ft_isarg.o and /dev/null differ diff --git a/libftx/printf/ft_isdigit.o b/libftx/printf/ft_isdigit.o deleted file mode 100644 index f2a638e..0000000 Binary files a/libftx/printf/ft_isdigit.o and /dev/null differ diff --git a/libftx/printf/ft_printf.a b/libftx/printf/ft_printf.a deleted file mode 100644 index 3c10808..0000000 Binary files a/libftx/printf/ft_printf.a and /dev/null differ diff --git a/libftx/printf/ft_printf.o b/libftx/printf/ft_printf.o deleted file mode 100644 index efe5c4f..0000000 Binary files a/libftx/printf/ft_printf.o and /dev/null differ diff --git a/libftx/printf/ft_putchar_fd.o b/libftx/printf/ft_putchar_fd.o deleted file mode 100644 index 73c41a1..0000000 Binary files a/libftx/printf/ft_putchar_fd.o and /dev/null differ diff --git a/libftx/printf/ft_putstr_fd.o b/libftx/printf/ft_putstr_fd.o deleted file mode 100644 index 44d66aa..0000000 Binary files a/libftx/printf/ft_putstr_fd.o and /dev/null differ diff --git a/libftx/printf/ft_skipflag.o b/libftx/printf/ft_skipflag.o deleted file mode 100644 index 78f1dc8..0000000 Binary files a/libftx/printf/ft_skipflag.o and /dev/null differ diff --git a/libftx/printf/ft_strlen.o b/libftx/printf/ft_strlen.o deleted file mode 100644 index 5ce6982..0000000 Binary files a/libftx/printf/ft_strlen.o and /dev/null differ diff --git a/libftx/printf/ft_vdprintf.o b/libftx/printf/ft_vdprintf.o deleted file mode 100644 index 528711e..0000000 Binary files a/libftx/printf/ft_vdprintf.o and /dev/null differ diff --git a/server b/server deleted file mode 100755 index ae6b60a..0000000 Binary files a/server and /dev/null differ diff --git a/server_src/main.c b/server_src/main.c index 3c49647..72e57b3 100644 --- a/server_src/main.c +++ b/server_src/main.c @@ -35,7 +35,7 @@ int ft_is_finished(int *tab, size_t len) size_t i; unsigned long sum; - if (len >= sizeof(char) * 8 && len % sizeof(char) * 8 == 0) + if (len >= sizeof(char) * 8 && (len % (sizeof(char) * 8)) == 0) { sum = 0; i = len - sizeof(char) * 8; @@ -55,19 +55,22 @@ void handler(int num) static size_t len = 0; char *str; - tab = ft_realloc(tab, len, len + 1, sizeof(int)); + tab = ft_realloc(tab, len, len + 2, sizeof(int)); if (tab == NULL) return ; if (len == 0) tab[0] = num; else tab[len] = num == tab[0]; + ft_printf("tab[%d] = %d\n", len, tab[len]); len++; if (ft_is_finished(tab + 1, len - 1)) { str = ft_tab_int_to_str(tab + 1, len - 1); + free(tab); ft_printf("%s\n", str); - str = NULL; + free(str); + tab = NULL; len = 0; } } diff --git a/server_src/main.o b/server_src/main.o index adc7aee..160e770 100644 Binary files a/server_src/main.o and b/server_src/main.o differ