🔨」 fix: if folder crash

This commit is contained in:
2024-07-14 15:39:28 +02:00
parent 4739d6b6f9
commit fe0285a5b2
17 changed files with 119 additions and 18 deletions

63
src/utils/get_to_free.c Normal file
View File

@ -0,0 +1,63 @@
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* get_to_free.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/09 17:24:15 by adjoly #+# #+# */
/* Updated: 2024/07/14 13:59:14 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "env.h"
#include "libft.h"
t_env **get_env(t_env **env)
{
static t_env **ret;
if (env)
ret = env;
return (ret);
}
t_list **get_list(t_list **list)
{
static t_list **ret;
if (list)
ret = list;
return (ret);
}
t_list **get_list2(t_list **list)
{
static t_list **ret;
if (list)
ret = list;
return (ret);
}
int get_exit_code(int in)
{
static int exit_code;
if (in == 727)
exit_code = 727;
if (in != -1)
exit_code = in % 256;
if (exit_code < 0)
exit_code += 256;
return (exit_code);
}
int get_fd_heredoc(int in)
{
static int fd;
if (in != -1)
fd = in;
return (fd);
}