/* ************************************************************************** */
/*                                                                            */
/*                                                        ::::::::            */
/*   utils.h                                            :+:    :+:            */
/*                                                     +:+                    */
/*   By: whaffman <whaffman@student.codam.nl>         +#+                     */
/*                                                   +#+                      */
/*   Created: 2025/02/05 16:06:35 by whaffman      #+#    #+#                 */
/*   Updated: 2025/03/02 22:05:22 by whaffman      ########   odam.nl         */
/*                                                                            */
/* ************************************************************************** */

#ifndef UTILS_H
# define UTILS_H

void		free_minishell_line(t_minishell *msh);
void		free_minishell(t_minishell **msh);
void		free_command_list(t_minishell *msh, void *content);
t_minishell	*init_minishell(void);
void		print_banner(void);
void		print_list(void *content);
void		simple_builtins(t_minishell *msh);
void		error_msg(char *func, char *msg);
void		check_malloc(t_minishell *msh, void *ptr);
char		*ft_strdup_safe(t_minishell *msh, const char *str);
char		*ft_substr_safe(t_minishell *msh,
				const char *str, unsigned int start, size_t len);
char		*ft_strjoin_safe(t_minishell *msh,
				const char *s1, const char *s2);
char		**ft_split_safe(t_minishell *msh, const char *s, char c);
void		*malloc_safe(t_minishell *msh, size_t size);
void		free_safe(t_minishell *msh, void **ptr);
void		ft_free_arr_safe(t_minishell *msh, char **arr);
void		free_freelist(t_minishell *msh);
void		ft_lstclear_safe(t_minishell *msh,
				t_list **lst, void (*del)(t_minishell *msh, void *));
t_list		*ft_lstnew_safe(t_minishell *msh, void *content);

#endif // UTILS_H
