char		*before_str(char *str, int i, char c)
{
  if (is_carac(*str, c))
    while (is_carac(*str, c))
      str++;
  return (str);
}
int		nb_word(char *str, char c)
{
  t_nbword	t;

  init_nb_word(&t);
  if (is_carac(str[t.i], c))
    while (is_carac(str[t.i], c))
      t.i += 1;
  while (str[t.i])
    {
      if (str[t.i] == 10)
	{
	  t.nb += 1;
	  return (t.nb);
	}
      else if (is_carac(str[t.i], c))
	{
	  t.nb += 1;
	  while (is_carac(str[t.i], c))
	    t.i += 1;
	  if (str[t.i] == 0)
	    return (t.nb);
	}
      t.i += 1;
    }
  t.nb += 1;
  return (t.nb);
}
void	my_echo(t_env *e)
{
  char	*puts;

  puts = e->buff;
  while (is_carac(*puts, ' ') == 0)
    puts++;
  while (is_carac(*puts, ' ') == 1)
    puts++;
  my_printf("%s\n", puts);
}
Exemple #4
0
static void check_elem(t_board *board, int *is_entry, int *is_exit, int *is_key)
{
  int i;
  int h;
  int size;
  int len;

  len = 0;
  h = 0;
  i = 0;
  while (board->map && board->map[i])
    {
      size = len;
      while (board->map[i] && board->map[i] != endLine)
	{
	  is_carac(board->map[i++], is_entry, is_exit, is_key);
	  (len == 0) ? (size++) : (size--);
	}
      if (size != 0 && len)
	gere_errors(1);
      if (!len)
	len = size;
      i++;
      h++;
    }
  board->size = len;
  board->h = h;
}
char		*after_str(char *str, char c)
{
  int	i;

  i = my_strlen(str) - 1;
  while (is_carac(str[i], c))
    {
      str[i] = 0;
      i--;
    }
  return (str);
}