aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorCharles <sircharlesaze@gmail.com>2019-11-03 00:19:45 +0100
committerCharles <sircharlesaze@gmail.com>2019-11-03 00:19:45 +0100
commit0a966722ec0236521d99706632a7fe56b7245379 (patch)
tree461cbc387c4691363873bbf5a43c487be82019ea /main.c
parent9f8c7ca113f0c69d17d8044120fcbd0ba78e1f92 (diff)
downloadget_next_line-0a966722ec0236521d99706632a7fe56b7245379.tar.gz
get_next_line-0a966722ec0236521d99706632a7fe56b7245379.tar.bz2
get_next_line-0a966722ec0236521d99706632a7fe56b7245379.zip
Rewrite to handle massive BUFFER_SIZE
The rest is malloc'd (memory leaks if user doesnt read entier file) The tmp buf in also malloc'd because the stack hasnt enought memory
Diffstat (limited to 'main.c')
-rw-r--r--main.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/main.c b/main.c
index 5da3734..ff09b7b 100644
--- a/main.c
+++ b/main.c
@@ -6,7 +6,7 @@
/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2019/10/10 09:27:41 by cacharle #+# #+# */
-/* Updated: 2019/10/27 19:08:20 by cacharle ### ########.fr */
+/* Updated: 2019/11/02 22:42:58 by cacharle ### ########.fr */
/* */
/* ************************************************************************** */
@@ -24,7 +24,6 @@ int main(int argc, char **argv)
char *line;
int ret;
- printf("limit fdmax %d\n", OPEN_MAX);
if (argc != 2)
{
printf("You forgot the filename");
@@ -33,7 +32,7 @@ int main(int argc, char **argv)
printf("BUFFER_SIZE = %d\n", BUFFER_SIZE);
fd = open(argv[1], O_RDONLY);
i = 0;
- while ((ret = get_next_line(fd, &line)) == LINE_READ)
+ while ((ret = get_next_line(fd, &line)) == STATUS_LINE)
{
printf("%3d [%s]\n", ++i, line);
free(line);