35 lines
1.1 KiB
C
35 lines
1.1 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* fd.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2023/03/27 13:39:58 by cchauvet #+# #+# */
|
|
/* Updated: 2023/03/27 14:14:17 by cchauvet ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "./utils.h"
|
|
#include <stdio.h>
|
|
|
|
void ft_closer(int fds[2])
|
|
{
|
|
if (fds[0] > 2)
|
|
{
|
|
close(fds[0]);
|
|
}
|
|
if (fds[1] > 2)
|
|
{
|
|
close(fds[1]);
|
|
}
|
|
}
|
|
|
|
void ft_add_fd(int fds[2], int fd)
|
|
{
|
|
if (fds[0] == -1)
|
|
fds[0] = fd;
|
|
else
|
|
fds[1] = fd;
|
|
}
|