/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* test001.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: lalgarra +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/10/22 20:50:52 by lalgarra #+# #+# */ /* Updated: 2025/10/25 13:58:21 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); printf("%s", line); stop = line == NULL; free(line); } if (fd > 0) close(fd); return (0); }