15int print_until_ch(
int fd,
const char *str,
int c)
22 return (EXIT_FAILURE);
23 end = ft_strchr(str, c);
28 result = write(fd, str, len);
31 perror(
"write failed");
34 else if ((
size_t)result != len)
36 ft_eprintf(
"Partial write. Only %lu bytes out of %lu were written.\n",
40 return (EXIT_SUCCESS);
51int check_for_not_matching_bit(
int variable,
int flags_to_check)
53 if ((variable & flags_to_check) == flags_to_check)
55 return (flags_to_check & ~variable);
58char *find_next_line(
const char *contents)
62 line = ft_strchr(contents,
'\n');
71bool is_key_line(
const char *line,
const char *key)
76 return (ft_strncmp(line, key, len) == 0);
79char *strdup_trimmed_line(
const char *str)
87 while (*str && *str !=
'\n')
90 while (end >= start && (!ft_isprint(*end) || ft_isspace(*end)))
92 length = (end >= start) * (end - start + 1);
93 result = ft_strndup(start, length);