diff options
| author | Charles <sircharlesaze@gmail.com> | 2020-01-30 15:52:16 +0100 |
|---|---|---|
| committer | Charles <sircharlesaze@gmail.com> | 2020-01-30 15:52:16 +0100 |
| commit | 57867bbbdc24b734d85f8d3569c7ad27dcd9504d (patch) | |
| tree | 1727dd02444038341746894268ecea62b84aaea1 /src/error.c | |
| parent | 3a164bce55e173d5204c4aaa66dd4eb5bc1762f9 (diff) | |
| download | cub3d-57867bbbdc24b734d85f8d3569c7ad27dcd9504d.tar.gz cub3d-57867bbbdc24b734d85f8d3569c7ad27dcd9504d.tar.bz2 cub3d-57867bbbdc24b734d85f8d3569c7ad27dcd9504d.zip | |
files restructuration
Diffstat (limited to 'src/error.c')
| -rw-r--r-- | src/error.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/error.c b/src/error.c new file mode 100644 index 0000000..eb94c9f --- /dev/null +++ b/src/error.c @@ -0,0 +1,48 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* error.c :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/01/11 13:33:14 by cacharle #+# #+# */ +/* Updated: 2020/01/11 13:34:18 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "cub3d.h" + +void error_put_usage_exit(char *name) +{ + ft_putstr_fd(name, STDERR_FILENO); + ft_putendl_fd(": missing file operand", STDERR_FILENO); + ft_putstr_fd("Usage: ", STDERR_FILENO); + ft_putstr_fd(name, STDERR_FILENO); + 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)); +} |
