Example #1
0
char		*preparsing_echo(t_echo *echo, char **cmd)
{
  char		*result;
  int		i;

  result = "\0";
  i = 0;
  if (cmd[echo->i + 1] != NULL)
    echo->i++;
  else
    return (NULL);
  while (cmd[echo->i])
    {
      if (i != 0)
	result = get_fusion(result, " ");
      result = get_fusion(result, cmd[echo->i]);
      echo->i++;
      i++;
    }
  return (result);
}
Example #2
0
int			get_data(char *path, char *word, t_gb *gb)
{
  char			*temp;
  glob_t		gl;
  int			len;
  int			i;

  i = -1;
  if (!(temp = get_fusion(path, word, &len)))
    return (FAILURE);
  check_match(temp, gb, len, *path);
  glob(temp, GLOB_TILDE_CHECK, NULL, &gl);
  XFREE(temp);
  if (gl.gl_pathc <= 0)
    return (FAILURE);
  while (++i < (int)gl.gl_pathc)
    if (add_glob(gb, gl.gl_pathv[i], len) == FAILURE)
      return (FAILURE);
  globfree(&gl);
  return (SUCCESS);
}