48 new_s1 = malloc(new_s1_len + 1);
54 ft_memcpy(new_s1, *s1 + len, new_s1_len + 1);
77 if (s[(*len)++] ==
'\n')
95static size_t fill_line_buf(
int fd,
char **line_buf,
size_t *first_line_len)
106 return (*first_line_len = 0);
107 read_buf[read_len] =
'\0';
117 return (*first_line_len = 0);
121 return (*first_line_len);
134 static char *line_buf[
MAX_FD + 1] = {0};
135 size_t first_line_len;
145 return (line_buf[fd] = 0);
#define BUFFER_SIZE
Set default BUFFER_SIZE if it is not defined at compile time.
#define MAX_FD
Max open file descriptors per process.
void * ft_memcpy(void *dst, const void *src, size_t n)
Copies n bytes from byte string src to byte string dst.
char * ft_strdup(const char *s1)
Allocates memory for, copies to, and returns a duplicate of s1.
char * ft_strjoin(char const *s1, char const *s2)
Allocates enough space for and appends string s2 to string s1 and returns the new string.
size_t ft_strlen(const char *str)
Get length of str.
static char * consume_and_resize(char **s1, size_t len)
Allocate and return a new string of size len + 1 containing len characters from string pointed to by ...
static size_t find_line_end(char *s, size_t *len)
Find the first newline in string s and write its index + 1 into len.
char * get_next_line(int fd)
Return the next segment of text ending in a newline or EOF from file descriptor fd.
static size_t fill_line_buf(int fd, char **line_buf, size_t *first_line_len)
Reading from fd, fill and / or allocate line buffer at line_buf, set first_line_len to the length of ...