void disp_files(int i, int fd, int ac, char **av) { char buffer; int offset; int readed; int size_file; size_file = size_files(i, av); readed = 0; offset = ft_atoi(av[2]); print_names(i, ac, av); if (av[2][0] == '+') { while (readed != offset - 1) readed += read(fd, &buffer, 1); while (read(fd, &buffer, 1)) write(1, &buffer, 1); } else { while (readed < (size_file - offset)) readed += read(fd, &buffer, 1); while (read(fd, &buffer, 1)) write(1, &buffer, 1); } }
int main(int argc, char **argv) { int i; int sign; int tail; int size; sign = 0; i = 3; if (argc < 4) return (1); tail = number(argv); if (tail == -1) return (1); if (argv[2][0] == '+') sign = 1; while (i < argc) { if (argc > 4) print_names(i, argv[i]); size = size_files(argv[i]); ft_puterr(argv[0], argv[i], ft_tail(sign, tail, size, argv[i])); i++; } return (0); }