Beispiel #1
0
int		main(int ac, char **av)
{
  if (ac <= 2)
    {
      my_putstr("\n");
      return 0;
    }
  char		*tab = malloc(128);
  int		i = 0;
  int		j = 0;
  int		k = 0;

  while (av[1][i])
    {
      j = 0;
      while (av[2][j])
	{
	  if (av[1][i] == av[2][j] && is_in_tab(av[1][i], tab, k) == 0)
	    {
	      tab[k] = av[1][i];
	      ++k;
	    }
	  ++j;
	}
      ++i;
    }
  tab[k] = 0;
  my_putstr(tab);
  my_putstr("\n");
}
Beispiel #2
0
void	cut_cut_p2(char *str, char *str2, int *tab, int i)
{
	if (is_label_char(ft_strsub(str, 2, ft_strlen(str) - 3)) == 1)
	{
		if (is_in_tab(T_DIR, tab, i))
			;
		else
			exit_prgm_type_dir_l(str2, str);
	}
	else
		exit_prgm_lab_in(str2, str);
}
Beispiel #3
0
void	cut_check_p1(char *str, char *str2, int *tab, int i)
{
	if (is_number(str) == 1 && the_number(str) <= REG_NUMBER &&
			the_number(str) > 0)
	{
		if (is_in_tab(T_REG, tab, i))
			;
		else
			exit_prgm_type_rg(str2, str);
	}
	else
		exit_prgm_rg_big(str2, str);
}
Beispiel #4
0
void	cut_check_p3(char *str, char *str2, int *tab, int i)
{
	if (ft_strcmp(str, "\0") == 0)
	{
		ft_putstr_fd("No params for function : ", 2);
		ft_putstr_fd(str2, 2);
		ft_putchar('\n');
		exit(0);
	}
	if (is_number(str) == 1)
	{
		if (is_in_tab(T_IND, tab, i))
			;
		else
			exit_prgm_type_ind(str2, str);
	}
	else if (str[0] == LABEL_CHAR)
		if (is_in_tab(T_IND, tab, i))
			;
		else
			exit_prgm_type_ind(str2, str);
	else
		exit_prgm_nbr(str2, str);
}
Beispiel #5
0
void	cut_check_p2(char *str, char *str2, int *tab, int i)
{
	if (str[1] == LABEL_CHAR)
		cut_cut_p2(str, str2, tab, i);
	else
	{
		if (str[1] == '-')
			;
		else if (is_number(str) == 1)
		{
			if (is_in_tab(T_DIR, tab, i))
				;
			else
				exit_prgm_type_dir_n(str2, str);
		}
		else
			exit_prgm_fk_dir(str2, str);
	}
}
Beispiel #6
0
void		fill_list(char **tmp, t_flag tab[], t_obj *obj, t_spot *spot)
{
  static int	i = 0;

  i++;
  if (is_in_tab(tmp[0], tab) == 1)
    {
      check_obj(tmp, i);
      new_obj(tmp, obj);
    }
  else if (my_strcompare("SPOT", tmp[0]))
    {
      check_spot(tmp, i);
      new_spot(tmp, spot);
    }
  else
    {
      fprintf(stderr, "Unknown object line %d\n", i);
      exit(EXIT_FAILURE);
    }
}