コード例 #1
0
ファイル: ft_check_conv.c プロジェクト: vbaudin/ft_printf
void	ft_check_conv(t_printf *s, const char *format, va_list ap)
{
	s->i++;
	ft_setflags(s);
	while (ft_isflag(&s->i, format))
	{
		ft_check_flags(s, format, ap);
	}
	if (ft_isconv(s->i, format))
	{
		if (format[s->i] == '%')
			ft_putpercent(s);
		else if (format[s->i] == 'c')
			ft_putchar_pf(ap, s);
		else if (format[s->i] == 's' || format[s->i] == 'i')
			ft_putstr_pf(ap, s);
		else if (format[s->i] == 'd')
			ft_which_digit(ap, s);
		else if (format[s->i] == 'x')
			ft_which_hexa_min(ap, s);
		else if (format[s->i] == 'X')
			ft_which_hexa_maj(ap, s);
		else if (format[s->i] == 'o')
			ft_put_octa(ap, s);
		s->i++;
	}
}
コード例 #2
0
ファイル: ft_calc_tag.c プロジェクト: Draeyo/FdF
int		ft_get_conv(char *tag, t_print *lst)
{
	if (ft_isconv(tag[0]))
	{
		CONV = tag[0];
		return (1);
	}
	else
		return (-1);
}
コード例 #3
0
ファイル: ft_calc_tag.c プロジェクト: Draeyo/FdF
int		ft_get_modif(char *tag, t_print *lst)
{
	char	*str;
	int		i;

	i = 0;
	if (!ft_ismod(tag[i]))
		return (0);
	str = ft_strnew(3);
	while (i < 2 && ft_ismod(tag[i]))
	{
		str[i] = tag[i];
		i++;
	}
	MODIF = ft_strdup(str);
	free(str);
	if (i == 0)
		return (0);
	else if (!ft_isconv(tag[i]))
		return (-1);
	return (1);
}