Exemplo n.º 1
0
void		test_key(char *rd2, t_char **list, char **envp)
{
	int		i;
	int		ret;

	i = 0;
	ret = 0;
	while (i < 21)
	{
		if (rd2[0] == (g_t[i]).rd[0] && rd2[1] == (g_t[i]).rd[1]
			&& rd2[2] == g_t[i].rd[2] && rd2[3] == g_t[i].rd[3])
		{
			ret = g_t[i].fct(list, envp);
			break ;
		}
		i++;
	}
	if (ret == 1)
		return ;
	if (rd2[0] && rd2[1] == 0 && rd2[2] == 0 && rd2[3] == 0)
	{
		char_add(list, char_new(rd2[0]));
		refresh_command_line(list);
	}
	else if (rd2[0] != 27 || rd2[1] != 91 || rd2[2] != 49 || rd2[3] != 59)
		refresh_command_line(list);
}
Exemplo n.º 2
0
void func_def_p_clone(func_t *f, func_t *g)
{
  if(func_ptype(g)!=FUNC_P_DEF){ FUNC_ERROR_ARG2("func_def_p_clone",f,g); }
  if(f->p.def!=NULL){ func_def_p_del(f); }
  f->ptype=FUNC_P_DEF;
  f->p.def=func_def_struct_new();
  (*(f->p.def))=(*(g->p.def));
  f->p.def->name=char_new(g->p.def->name," \t\n");
}
Exemplo n.º 3
0
// def
func_t *func_def(const char *name, func_t *g, int amin, int amax)
{
  func_t *f=NULL;
  f=func_new(__func_def);
  f->p.def->name=char_new(name," \t\n");
  f->p.def->amin=amin;
  f->p.def->amax=amax;
  func_aset(f,0,g);
  return f;
}
Exemplo n.º 4
0
int			main(int argc, char **argv, char **envp)
{
	t_char	*list;
	t_env	**env;

	(void)argc;
	(void)argv;
	list = NULL;
	char_add(&list, char_new('-'));
	*(getactivelist()) = &list;
	env = ft_getenv();
	*env = ft_load_env(envp);
	(ft_saved_env())->home = ft_strdup(get_env_value("HOME"));
	term_initiate();
	ft_putstr_fd("$> ", *(gettty()));
	*(getcurpos()) = 3;
	show_prompt(&list, envp);
	return (0);
}