Exemple #1
0
void		ft_options4(t_print *print)
{
	char	*tmp;

	if (*(print->fmt) == 's')
	{
		tmp = ft_strdupp(va_arg(print->ap, char*));
		if (print->precision == -1)
			tmp = ft_strdupp("");
		else if (print->precision > 0)
		{
			if (tmp)
				tmp = ft_update(tmp, print->precision);
			else
				tmp = ft_update("(null)", print->precision);
		}
		ft_strjoinnstringlen(&(print->dsp), tmp, print);
		free(tmp);
		print->fmt++;
	}
Exemple #2
0
static int	ft_cd_home(t_env *shell)
{
	char	*path;

	if ((path = ft_update(shell, "HOME", shell->home,
		" cd: << HOME >> undefined\n\n")))
	{
		ft_set_env_value(shell, "PWD", path);
		chdir(path);
		free(shell->pwd);
		shell->pwd = path;
		return (1);
	}
	return (0);
}