aboutsummaryrefslogtreecommitdiff
path: root/get_next_line.c
diff options
context:
space:
mode:
Diffstat (limited to 'get_next_line.c')
-rw-r--r--get_next_line.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/get_next_line.c b/get_next_line.c
index d5c4293..879dd0a 100644
--- a/get_next_line.c
+++ b/get_next_line.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/19 09:08:36 by cacharle #+# #+# */
-/* Updated: 2019/10/20 09:04:18 by cacharle ### ########.fr */
+/* Updated: 2019/10/24 10:55:30 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -33,15 +33,13 @@
** return END_OF_FILE
*/
-int get_next_line(int fd, char **line)
+int real_get_next_line(int fd, char **line, int ret, int split_at)
{
t_bool had_rest;
- int ret;
- int split_at;
char buf[BUFFER_SIZE + 1];
static char rest[OPEN_MAX][BUFFER_SIZE + 1] = {{0}};
- if (fd < 0 || fd > OPEN_MAX || line == NULL)
+ if (fd < 0 || fd > OPEN_MAX || line == NULL || BUFFER_SIZE < 0)
return (ERROR);
if ((had_rest = put_rest(line, rest[fd])) == -1)
return (LINE_READ);
@@ -63,6 +61,16 @@ int get_next_line(int fd, char **line)
return (ret == -1 ? ERROR : END_OF_FILE);
}
+int get_next_line(int fd, char **line)
+{
+ int ret;
+ int split_at;
+
+ split_at = -1;
+ ret = 0;
+ return (real_get_next_line(fd, line, ret, split_at));
+}
+
int put_rest(char **line, char *rest)
{
int split_at;