ca parait bon

This commit is contained in:
Camille Chauvet 2023-01-23 14:13:48 +01:00
parent cdc4eb5d5f
commit 3b80be7c0f
78 changed files with 9 additions and 6 deletions

View File

@ -55,6 +55,6 @@ server_re: server_fclean
client_re: client_fclean client 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 .PHONY: all clean fclean re client_re client_clean client_fclean server_re server_clean server_fclean

BIN
client

Binary file not shown.

View File

@ -25,7 +25,6 @@ void ft_char2signal(int pid, char c)
else else
kill(pid, SIGUSR1); kill(pid, SIGUSR1);
i--; i--;
usleep(0);
} }
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -26,6 +26,7 @@ void *ft_realloc(void *tab, size_t size, size_t new_size, int bytes)
new[i] = ((char *) tab)[i]; new[i] = ((char *) tab)[i];
i++; i++;
} }
if (tab != NULL)
free(tab); free(tab);
return (new); return (new);
} }

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
server

Binary file not shown.

View File

@ -35,7 +35,7 @@ int ft_is_finished(int *tab, size_t len)
size_t i; size_t i;
unsigned long sum; 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; sum = 0;
i = len - sizeof(char) * 8; i = len - sizeof(char) * 8;
@ -55,19 +55,22 @@ void handler(int num)
static size_t len = 0; static size_t len = 0;
char *str; char *str;
tab = ft_realloc(tab, len, len + 1, sizeof(int)); tab = ft_realloc(tab, len, len + 2, sizeof(int));
if (tab == NULL) if (tab == NULL)
return ; return ;
if (len == 0) if (len == 0)
tab[0] = num; tab[0] = num;
else else
tab[len] = num == tab[0]; tab[len] = num == tab[0];
ft_printf("tab[%d] = %d\n", len, tab[len]);
len++; len++;
if (ft_is_finished(tab + 1, len - 1)) if (ft_is_finished(tab + 1, len - 1))
{ {
str = ft_tab_int_to_str(tab + 1, len - 1); str = ft_tab_int_to_str(tab + 1, len - 1);
free(tab);
ft_printf("%s\n", str); ft_printf("%s\n", str);
str = NULL; free(str);
tab = NULL;
len = 0; len = 0;
} }
} }

Binary file not shown.