/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* test001.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: lalgarra +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/10/22 20:50:52 by lalgarra #+# #+# */ /* Updated: 2025/10/26 23:21:13 by lalgarra ### ########.fr */ /* */ /* ************************************************************************** */ #include // printf() #include // free() #include // open() #include // close() #include "get_next_line.h" int main(int argc, char *argv[]) { char *line; int stop; int fd; (void) argc; (void) argv; fd = 0; if (argc > 1) fd = open(argv[1], O_RDONLY); /* if (fd < 0) return (1); */ stop = 0; while (!stop) { line = get_next_line(fd); stop = line == NULL; if (!stop) { printf("%s", line); free(line); } } if (fd > 0) close(fd); return (0); }