int main(int argc, char **argv) { if (argc < 0) { ft_putchar('\n'); } if (argc != 1) { ft_checkchar(argv[1]); return (0); } }
static int check_tab(char **tab, char **line, char **buf) { int i; char *temp; temp = *line; i = 0; if (tab[0] && ft_checkchar(tab[0], '\n') == 1) { *line = ft_strjoin(*line, tab[0]); ft_memdel((void **)&temp); ft_memdel((void **)&tab[0]); return (2); } else if (tab[0] && ft_strlen(tab[0]) != 0) return (parse_tab(tab, line, NULL)); else { buf[0] = (char *)ft_memalloc(BUFF_SIZE + 1); return (3); } }
static int parse_read(char **tab, char **buf, char **line, char *temp2) { int i; char *temp; i = 0; temp = *line; if (ft_checkchar(buf[0], '\n') == 1) { line[0] = ft_strjoin(line[0], buf[0]); ft_memdel((void **)&temp); return (2); } while (buf[0][i] != '\n' && buf[0][i]) i++; temp2 = ft_strndup(buf[0], i); *line = ft_strjoin(*line, temp2); ft_memdel((void **)&temp2); ft_memdel((void **)&temp); temp = tab[0]; tab[0] = ft_strsub(buf[0], i + 1, ft_strlen(buf[0]) - i); ft_memdel((void **)&temp); return (1); }