leaks tests verifies et trouves

This commit is contained in:
hugodu69
2019-12-15 03:01:22 +01:00
parent f2e48e7746
commit 3ce1c65b03
8 changed files with 495 additions and 46 deletions

View File

@@ -12,48 +12,49 @@
#include "get_next_line.h"
/*
** #include <stdio.h> //for printf
** #include <fcntl.h> //for open
**
** int main(int ac, char **av)
** {
** int *fd;
** int i;
** int j;
** char *line;
**
** if (ac < 2)
** return (0);
** line = NULL;
** i = 0;
** if (!(fd = (int *)malloc(sizeof(int) * ac)))
** return (0);
** while (++i <= ac - 1)
** fd[i - 1] = open(av[i], O_RDONLY);
** i = 0;
** j = 0;
** while (j < ac - 1)
** {
** if (get_next_line(fd[i], &line) > 0)
** {
** printf("fd%i| %s\n", fd[i], line);
** free(line);
** j = 0;
** }
** else
** {
** printf("fd%i|*FINI*\n", fd[i]);
** j++;
** }
** i++;
** if (i >= ac - 1)
** i = 0;
** }
** while (1);
** return (0);
** }
*/
#include <stdio.h> //for printf
#include <fcntl.h> //for open
int main(int ac, char **av)
{
int *fd;
int i;
int j;
char *line;
if (ac < 2)
return (0);
line = NULL;
i = 0;
if (!(fd = (int *)malloc(sizeof(int) * ac)))
return (0);
while (++i <= ac - 1)
fd[i - 1] = open(av[i], O_RDONLY);
i = 0;
j = 0;
while (j < ac - 1)
{
if (get_next_line(fd[i], &line) > 0)
{
printf("fd%i| %s\n", fd[i], line);
free(line);
j = 0;
}
else
{
printf("fd%i|*FINI*\n", fd[i]);
j++;
}
i++;
if (i >= ac - 1)
i = 0;
}
free (fd);
// while (1);
return (0);
}
int multi_fd(int fd, t_gnlist **lst)
{