21#include "../../mandatory/utils/utils.h"
23#include <get_next_line_bonus.h>
26static int _cmp(
const char *s1,
const char *s2)
53 return ((
int)
err(
"pipe()", 0));
60 return ((
int)
err(
"get_next_line()", 0));
62 if (!_cmp(limiter, line))
64 if (write(fds[1], line, len) < 0)
65 return ((
int)
err(
"write()", 0));
70 return ((
int)
err(
"close()", 0));
int ft_printf(const char *format,...)
Prints and formats a variable set of arguments.
void * err(const char *str, void *retval)
Wrapper around perror() that always returns retval.
size_t ft_strlen(const char *str)
Get length of str.
int ft_strncmp(const char *s1, const char *s2, size_t n)
Compare up to n characters of string s1 with string s2.
char * get_next_line(int fd)
Return the next segment of text ending in a newline or EOF from file descriptor fd.
int here_doc(char *limiter, int *in_out)
Capture multiline input from stdin and write to a pipe readable from in_out[0] until a line containin...