Exemplo n.º 1
0
void			type_s(t_var *e)
{
	char *str;
	char *res;

	res = va_arg(e->ap, char*);
	if (res)
		str = ft_strdup(res);
	else if (!res && e->f_zero == 0)
	{
		ft_putstr("(null)");
		e->ret += 6;
		return ;
	}
	if (e->f_precis != 1)
		str = ft_strsub(str, 0, e->f_precis);
	if (e->f_width == 0)
	{
		ft_putstr(str);
		e->ret += ft_strlen(str);
		free(str);
		return ;
	}
	else if (e->f_width != 0 && e->f_left == 1)
		ft_putstr_left(str, e);
	else if (e->f_width != 0 && e->f_left == 0)
		ft_putstr_right(str, e);
}
Exemplo n.º 2
0
static void	putlf(t_list *lst, t_max buff, t_opt opt)
{
	ft_putchar(((t_ls*)(lst->content))->type);
	ft_putendchar(((t_ls*)(lst->content))->rights, ' ');
	ft_putstr_right(ft_itoa(((t_ls*)(lst->content))->nb_hlink), buff.mx_hl);
	ft_putchar(' ');
	if (!opt.g)
	{
		ft_putstr_left(((t_ls*)(lst->content))->u_name, buff.mx_un);
		ft_putstr("  ");
	}
	ft_putstr_left(((t_ls*)(lst->content))->g_name, buff.mx_gn);
	ft_putstr("  ");
	ft_putstr_right(ft_itoa(((t_ls*)(lst->content))->size), buff.mx_sz);
	ft_putchar(' ');
	puttime(lst, opt);
	ft_putstr(((t_ls*)(lst->content))->name);
	print_link(((t_ls*)(lst->content))->link);
}
Exemplo n.º 3
0
static void					exep_effect(t_var *e, int select, unsigned long nb)
{
	if (select == 0)
	{
		ft_putchar('0');
		e->ret++;
		e->error = 1;
	}
	else if (select == 1)
	{
		if (e->f_left == 0 && e->f_width != 0 && e->f_width > e->t_size)
			ft_putstr_right(e, nb);
		else
			ft_putstr_left(e, nb);
	}
}
Exemplo n.º 4
0
void			type_c(t_var *e)
{
	char c;

	c = va_arg(e->ap, int);
	if (e->f_width == 0)
	{
		ft_putchar(c);
		e->ret++;
		return ;
	}
	else if (e->f_width != 0 && e->f_left == 1)
		ft_putstr_left(c, e);
	else if (e->f_width != 0 && e->f_left == 0)
		ft_putstr_right(c, e);
}