예제 #1
0
int			ft_print_signed_number(long long int arg, t_env *env)
{
	int		i;
	int		excep;

	i = 0;
	excep = (env->isprecision && env->precision == 0) ? 1 : 0;
	if (env->minus && ((env->precision < env->size && env->isprecision)
		|| !env->precision))
		i += ft_minus(arg, env, excep);
	else if (env->isprecision && env->precision >= env->size)
		i += ft_precision(arg, env, excep);
	else if (env->size)
		i += ft_size_sn(arg, env, excep);
	else if (env->plus || env->space)
		i += ft_cortex(arg, env, excep);
	else
	{
		if (!excep)
			ft_putnbr_ll(arg);
		i = excep ? 0 : intlen(arg);
		i += (arg < 0 ? 1 : 0);
		i += (arg == LLONG_MIN ? 18 : 0);
	}
	return (i);
}
예제 #2
0
int			ft_print_c(t_env *env)
{
	int i;

	i = 0;
	if (env->size && !env->zero && !env->minus && env->quest)
		i = ft_space(env->size, env);
	else if (env->size && env->zero && !env->minus && env->quest)
		i = ft_zero(env->size, env);
	else if (env->size && env->minus && env->quest)
		i = ft_minus(env->size, env);
	else
	{
		i = ft_strcmp(env->quest, "0") == -48 ? 1 : ft_strlen(env->quest);
		write(1, env->quest, ft_strlen(env->quest));
	}
	return (i);
}