c'est moche mais fix
This commit is contained in:
parent
3b80be7c0f
commit
0bee795dac
BIN
.nfs000000000a01060e0000009c
Executable file
BIN
.nfs000000000a01060e0000009c
Executable file
Binary file not shown.
@ -24,6 +24,7 @@ void ft_char2signal(int pid, char c)
|
||||
kill(pid, SIGUSR2);
|
||||
else
|
||||
kill(pid, SIGUSR1);
|
||||
usleep(5);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
@ -14,6 +14,7 @@
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
#include "../libftx/libftx.h"
|
||||
#define ALLLOC_SIZE 2000000
|
||||
|
||||
char *ft_tab_int_to_str(int *tab, size_t len)
|
||||
{
|
||||
@ -51,26 +52,20 @@ int ft_is_finished(int *tab, size_t len)
|
||||
|
||||
void handler(int num)
|
||||
{
|
||||
static int *tab = NULL;
|
||||
static int tab[ALLLOC_SIZE];
|
||||
static size_t len = 0;
|
||||
char *str;
|
||||
|
||||
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);
|
||||
ft_printf("%s", str);
|
||||
free(str);
|
||||
tab = NULL;
|
||||
len = 0;
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user