diff options
Diffstat (limited to 'src/ft_get_tex.c')
-rw-r--r-- | src/ft_get_tex.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/ft_get_tex.c b/src/ft_get_tex.c index 7841e1d..4c80c89 100644 --- a/src/ft_get_tex.c +++ b/src/ft_get_tex.c @@ -8,11 +8,10 @@ ft_get_tex_no(int fd, t_win *wlist) char *line; char **words; - get_next_line(fd, &line); - if (!(words = ft_split(line, ' '))) + if (get_next_line(fd, &line) <= 0 || !(words = ft_split(line, ' '))) { ft_memdel(line); - return (ft_exit(5, wlist)); + return (ft_map_error(2, wlist)); } if (!(*words) || ft_strcmp(*words, "NO") || !(*(words + 1)) || (*(words + 2))) @@ -36,11 +35,10 @@ ft_get_tex_so(int fd, t_win *wlist) char *line; char **words; - get_next_line(fd, &line); - if (!(words = ft_split(line, ' '))) + if (get_next_line(fd, &line) <= 0 || !(words = ft_split(line, ' '))) { ft_memdel(line); - return (ft_exit(5, wlist)); + return (ft_map_error(3, wlist)); } if (!(*words) || ft_strcmp(*words, "SO") || !(*(words + 1)) || (*(words + 2))) @@ -64,11 +62,10 @@ ft_get_tex_we(int fd, t_win *wlist) char *line; char **words; - get_next_line(fd, &line); - if (!(words = ft_split(line, ' '))) + if (get_next_line(fd, &line) <= 0 || !(words = ft_split(line, ' '))) { ft_memdel(line); - return (ft_exit(5, wlist)); + return (ft_map_error(4, wlist)); } if (!(*words) || ft_strcmp(*words, "WE") || !(*(words + 1)) || (*(words + 2))) @@ -92,11 +89,10 @@ ft_get_tex_ea(int fd, t_win *wlist) char *line; char **words; - get_next_line(fd, &line); - if (!(words = ft_split(line, ' '))) + if (get_next_line(fd, &line) <= 0 || !(words = ft_split(line, ' '))) { ft_memdel(line); - return (ft_exit(5, wlist)); + return (ft_map_error(5, wlist)); } if (!(*words) || ft_strcmp(*words, "EA") || !(*(words + 1)) || (*(words + 2))) |