/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* read_heredoc.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: dkaiser "); if (!line || ft_strcmp(line, delimiter) == 0) { free(line); break ; } line_length = ft_strlen(line) + 1; temp = malloc(total_length + line_length + 1); if (!temp) { perror("malloc"); return (free(result), NULL); } if (result) { ft_strcpy(temp, result); free(result); } else temp[0] = '\0'; result = concat_str(temp, line); total_length += line_length; } return (result); } static char *concat_str(char *temp, char *line) { ft_strcat(temp, line); ft_strcat(temp, "\n"); free(line); return (temp); }