file norming
This commit is contained in:
@@ -6,32 +6,12 @@
|
||||
/* By: tmaze <tmaze@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2019/09/26 16:25:00 by tmaze #+# #+# */
|
||||
/* Updated: 2020/01/30 11:48:25 by tmaze ### ########.fr */
|
||||
/* Updated: 2020/02/01 15:47:08 by tmaze ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "minishell.h"
|
||||
|
||||
int ft_isin(char *str, char c)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = 0;
|
||||
while (str && str[i])
|
||||
if (str[i++] == c)
|
||||
return (i - 1);
|
||||
return (-1);
|
||||
}
|
||||
|
||||
void *put_error(char *file, char *msg)
|
||||
{
|
||||
ft_putstr("minishell: ");
|
||||
ft_putstr(file);
|
||||
ft_putstr(": ");
|
||||
ft_putendl(msg);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
char *check_path_slash(char *exec)
|
||||
{
|
||||
int i;
|
||||
@@ -82,12 +62,6 @@ char *check_path_dot(char *exec, t_env *env)
|
||||
return (put_error(exec, "no such file or directory"));
|
||||
}
|
||||
|
||||
void *ft_strdel_null(char **s)
|
||||
{
|
||||
ft_strdel(s);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
char *check_path_elems(char **path_elems, char *exec)
|
||||
{
|
||||
int i;
|
||||
@@ -146,17 +120,6 @@ char *check_path(char *exec, t_env *env)
|
||||
return (ret);
|
||||
}
|
||||
|
||||
void exec_cmd_child(char *path, char **argv, char **env_tab, t_env **env)
|
||||
{
|
||||
execve(path, argv, env_tab);
|
||||
ft_putendl_fd("minishell: error", 1);
|
||||
if (ft_strcmp(path, argv[0]) != 0)
|
||||
ft_strdel(&path);
|
||||
ft_del_words_tables(&env_tab);
|
||||
ft_envdel(env);
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
int exec_cmd(char **argv, t_env **env)
|
||||
{
|
||||
int ret;
|
||||
|
Reference in New Issue
Block a user