-
Notifications
You must be signed in to change notification settings - Fork 0
/
get_next_line.h
48 lines (41 loc) · 1.66 KB
/
get_next_line.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_next_line.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ldulling <ldulling@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/10/31 12:28:58 by ldulling #+# #+# */
/* Updated: 2023/11/03 22:36:48 by ldulling ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef GET_NEXT_LINE_H
# define GET_NEXT_LINE_H
# include <limits.h>
# include <stdint.h>
# include <stdlib.h>
# include <unistd.h>
# ifndef BUFFER_SIZE
# define BUFFER_SIZE 128
# endif
# define NO_NL -1
typedef struct s_list
{
char buf[BUFFER_SIZE + 1];
ssize_t bytes_unsaved;
ssize_t line_end;
char endoffile;
struct s_list *next;
} t_list;
/* get_next_line.c */
char *get_next_line(int fd);
int check_for_full_leftover_line(t_list **head, char **result);
int read_until_endofline(t_list **head, int fd);
char *copy_into_result_and_move_head_to_tail(t_list **head);
/* get_next_line_utils.c */
int add_new_node(t_list *cur);
size_t count_result_size(t_list *cur);
ssize_t find_endofline(t_list *cur);
void free_list(t_list **head);
int initial_check(int fd, t_list **head);
#endif