From 2fdb9ad1d66e28e056f31bc6321d2c198db33290 Mon Sep 17 00:00:00 2001 From: Charles Date: Sat, 11 Jan 2020 13:11:27 +0100 Subject: Error messages with error helper --- error.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'error.c') diff --git a/error.c b/error.c index 577597a..e16930f 100644 --- a/error.c +++ b/error.c @@ -9,3 +9,27 @@ void error_put_usage_exit(char *name) ft_putendl_fd(" [.cub file] [--save]", STDERR_FILENO); exit(EXIT_FAILURE); } + +void error_put(char *message) +{ + ft_putstr("Error\nCouldnt "); + ft_putendl(message); +} + +void *error_put_return(char *message) +{ + error_put(message); + return (NULL); +} + +void *error_put_return_state_destroy(char *message, t_state *state) +{ + state_destroy(state); + return error_put_return(message); +} + +void *error_put_return_lines_state_destroy(char *message, t_state *state, char **lines) +{ + helper_free_splited(lines); + return (error_put_return_state_destroy(message, state)); +} -- cgit