-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.c
37 lines (34 loc) · 1.21 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* main.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: angavrel <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/30 11:57:02 by angavrel #+# #+# */
/* Updated: 2017/01/20 14:30:38 by angavrel ### ########.fr */
/* */
/* ************************************************************************** */
#include "get_next_line.h"
int main(int ac, char **av)
{
int fd;
int ret;
char *line;
while (--ac)
{
av++;
if ((fd = open(*av, O_RDONLY)) < 0)
fd = 0;
while ((ret = (get_next_line(fd, &line))) == 1)
{
ft_putendl(line);
free(line);
ft_putnbr(ret);
}
free(line);
ft_putnbr(ret);
}
while (1);
return (0);
}