示例#1
0
int	my_check_arg(int argc, char **argv, t_tetris *tetris)
{
  int	k;
  int	i;
  bool	end;
  int	check;
  t_opt	opt[OPT_LEN];

  k = 0;
  init_tab_opt(opt, argc);
  while (++k < argc)
    {
      end = false;
      i = - 1;
      while (end == false && ++i < OPT_LEN)
	if ((check = my_check_opt(argv, &k, opt[i], tetris)) == 2)
	  end = true;
	else if (check != 0)
	  return (check);
      if (i == OPT_LEN)
	{
	  my_putstr_error(ARG_ERR_MSG);
	  my_putnbr_error(k, true);
	  return (- 1);
	}
    }
  return (0);
}
示例#2
0
void	my_echo(char **arr)
{
  int	i;
  char	opt[3];

  i = 1;
  opt[0] = '0';
  opt[1] = '0';
  opt[2] = '\0';
  if (arr[i] == NULL)
    {
      write(0, "\n", 1);
      return ;
    }
  while (arr[i][0] == '-')
    {
      my_built_opt(arr, i, opt);
      i++;
    }
  my_check_opt(arr, i, opt);
}