35 lines
1.2 KiB
C
35 lines
1.2 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* :::::::: */
|
|
/* error_msg.c :+: :+: */
|
|
/* +:+ */
|
|
/* By: whaffman <whaffman@student.codam.nl> +#+ */
|
|
/* +#+ */
|
|
/* Created: 2025/02/20 17:03:13 by whaffman #+# #+# */
|
|
/* Updated: 2025/02/20 17:59:36 by whaffman ######## odam.nl */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "minishell.h"
|
|
|
|
|
|
void error_msg(char *func, char *msg)
|
|
{
|
|
if (errno)
|
|
perror(RED BOLD "minishell" RESET);
|
|
else
|
|
{
|
|
ft_putstr_fd(RED BOLD "minishell" RESET ": ", 2);
|
|
if (func != NULL)
|
|
{
|
|
ft_putstr_fd(func, 2);
|
|
ft_putstr_fd(": ", 2);
|
|
}
|
|
if (msg != NULL)
|
|
ft_putstr_fd(msg, 2);
|
|
else
|
|
ft_putstr_fd("general error", 2);
|
|
ft_putstr_fd("\n", 2);
|
|
}
|
|
}
|