/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* error_wrappers.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: lperrey +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/12/01 17:16:30 by lperrey #+# #+# */ /* Updated: 2021/12/05 16:26:48 by lperrey ### ########.fr */ /* */ /* ************************************************************************** */ #include "minishell.h" int shell_error(char *s1, char *s2, char *s3, int ret_val) { char *prefix; prefix = "minishell: "; write(STDERR_FILENO, prefix, ft_strlen(prefix)); if (s1) write(STDERR_FILENO, s1, ft_strlen(s1)); if (s2) write(STDERR_FILENO, s2, ft_strlen(s2)); if (s3) write(STDERR_FILENO, s3, ft_strlen(s3)); write(STDERR_FILENO, "\n", 1); return (ret_val); } int shell_perror(char *s1, char *s2, char *s3, int ret_val) { char *prefix; prefix = "minishell: "; write(STDERR_FILENO, prefix, ft_strlen(prefix)); if (s1) write(STDERR_FILENO, s1, ft_strlen(s1)); if (s2) write(STDERR_FILENO, s2, ft_strlen(s2)); if (s3) write(STDERR_FILENO, s3, ft_strlen(s3)); perror(NULL); return (ret_val); }