예제 #1
0
파일: main.c 프로젝트: chocht/minishell
int		main(int argc, char **argv, char **env)
{
  if (!env)
    return (at_exit_1(ERR_ENV));
  if (signal(SIGINT, sig) == SIG_ERR)
    return (at_exit_1(ERR_SIG));
  if (minishell(env))
    return (1);
  return (0);
}
예제 #2
0
int	main(int ac, char **av, char **envp)
{
  ac = 0;
  av = NULL;
  if (*envp == NULL)
    {
      my_putstr("Environment not found.\n");
      return (0);
    }
  minishell(envp);
  return (0);
}
예제 #3
0
int				main(int argc, char **argv, char **environ)
{
	t_sh	sh;
	char	*nb;

	UNUSED(argv);
	if (argc > 1)
	{
		ft_putendl_fd("minishell cannot execute commands", 2);
		return (0);
	}
	minishell_init_builtins(&sh);
	sh.env_list = NULL;
	minishell_env_to_list(&sh.env_list, environ);
	if (minishell_env_get(sh.env_list, "SHLVL"))
		nb = ft_itoa(ft_atoi(minishell_env_get(sh.env_list, "SHLVL")) + 1);
	else
		nb = ft_itoa(1);
	minishell_builtins_setenv_set(&sh.env_list, "SHLVL", nb);
	if (nb)
		free(nb);
	minishell_signals();
	return (minishell(&sh));
}