Exemplo n.º 1
0
t_modif		ft_pf_check_modifier(t_pf *t)
{
	t_modif	modif;
	int		i;

	if (ft_is_in(t->s, 'z'))
		modif = Z;
	else if (ft_is_in(t->s, 'j'))
		modif = J;
	else if ((i = ft_pf_is_lh(t->s, 'l')))
		modif = (i == 2) ? LL : L;
	else if ((i = ft_pf_is_lh(t->s, 'h')))
		modif = (i == 2) ? HH : H;
	else
		modif = NONE;
	return (modif);
}
Exemplo n.º 2
0
Arquivo: union.c Projeto: NegMozzie/42
void	ft_union(char *s1, char *s2)
{
	char	*tmp;

	tmp = s1;
	while (*s1)
	{
		if (!ft_is_before(s1, tmp, *s1))
			write(1, s1, 1);
		s1++;
	}
	while (*s2)
	{
		if (!ft_is_in(tmp, *s2))
			write(1, s2, 1);
		s2 = ft_erase(s2, *tmp);
		s2++;
	}
	write(1, "\n", 1);
}
Exemplo n.º 3
0
/*
** ----------------------------------------------------------------------------
** void
**		ft_treat_arg_other(t_pf *t, va_list va)
** Modify the t->s and t->l variables if none conversions are given, such as
** "%%".
** ----------------------------------------------------------------------------
*/
static int	ft_getnumber(char *s, va_list va, char *comp)
{
	int i;
	int sign;
	int	cpt;

	i = 1;
	sign = 1;
	cpt = 0;
	while (s[i])
	{
		if ((s[i] == '*' || ft_isdigit(s[i])) && !ft_is_in(comp, s[i - 1])
				&& s[i] != '0')
		{
			cpt = (s[i] == '*') ? va_arg(va, int) : ft_atoi(s + i);
			if (cpt < 0)
				sign = -1;
			i++;
			while (ft_isdigit(s[i]) && s[i - 1] != '*')
				i++;
		}
		else