Ejemplo n.º 1
0
int		printf_char(va_list ap, t_opts *opts)
{
	int		len;
	char	c;

	if (opts->flags & L)
		return (printf_wchar(ap, opts));
	c = va_arg(ap, int);
	len = sizeof(char);
	if (!(opts->flags & MINUS))
		len = printf_spaces(opts->min_width, len, opts->flags);
	ft_putchar(c);
	if (opts->flags & MINUS)
		len = printf_spaces(opts->min_width, len, opts->flags);
	return (len);
}
Ejemplo n.º 2
0
static int	printf_type(t_printf *p, const int flag)
{
	if (flag & C_WCHAR)
		return (printf_wchar(p));
	if (flag & C_WSTRING)
		return (printf_wstring(p));
	if (flag & C_STRING)
		return (printf_string(p));
	if (flag & C_CHAR)
		return (printf_char(p));
	if (flag & (C_INT | C_LONG))
		return (printf_long(p, p->arg));
	if (flag & C_UINT)
		return (printf_ulong_base(p, p->arg, 10));
	if (flag & C_ULONG)
		return (printf_ulong_base(p, p->arg, 10));
	if (flag & (C_HEXA | C_MHEXA))
		return (printf_ulong_base(p, p->arg, 16));
	if (flag & (C_LOCTAL | C_OCTAL))
		return (printf_ulong_base(p, p->arg, 8));
	if (flag & C_BIN)
		return (printf_ulong_base(p, p->arg, 2));
	return (1);
}