prexifed printf parsing functions for double naming, must really not include the printf header...
This commit is contained in:
parent
96075b130d
commit
729e28d6b9
3 changed files with 15 additions and 15 deletions
|
|
@ -35,11 +35,11 @@ extern t_conv g_convs[];
|
||||||
t_fmt *ft_fmt_init(void);
|
t_fmt *ft_fmt_init(void);
|
||||||
void ft_fmt_print(t_fmt *fmt);
|
void ft_fmt_print(t_fmt *fmt);
|
||||||
|
|
||||||
t_fmt *ft_parse(char **format, va_list ap);
|
t_fmt *ft_printf_parse(char **format, va_list ap);
|
||||||
void ft_parse_flags(t_fmt *fmt, char **format);
|
void ft_printf_parse_flags(t_fmt *fmt, char **format);
|
||||||
void ft_parse_width(t_fmt *fmt, char **format, va_list ap);
|
void ft_printf_parse_width(t_fmt *fmt, char **format, va_list ap);
|
||||||
void ft_parse_precision(t_fmt *fmt, char **format, va_list ap);
|
void ft_printf_parse_precision(t_fmt *fmt, char **format, va_list ap);
|
||||||
void ft_parse_modifiers(t_fmt *fmt, char **format);
|
void ft_printf_parse_modifiers(t_fmt *fmt, char **format);
|
||||||
|
|
||||||
int ft_printf(const char *format, ...);
|
int ft_printf(const char *format, ...);
|
||||||
char *ft_transform(t_fmt *fmt, va_list ap);
|
char *ft_transform(t_fmt *fmt, va_list ap);
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,14 @@
|
||||||
#include "ftprintf.h"
|
#include "ftprintf.h"
|
||||||
|
|
||||||
t_fmt *ft_parse(char **format, va_list ap)
|
t_fmt *ft_printf_parse(char **format, va_list ap)
|
||||||
{
|
{
|
||||||
t_fmt *fmt;
|
t_fmt *fmt;
|
||||||
|
|
||||||
fmt = ft_fmt_init();
|
fmt = ft_fmt_init();
|
||||||
ft_parse_flags(fmt, format);
|
ft_printf_parse_flags(fmt, format);
|
||||||
ft_parse_width(fmt, format, ap);
|
ft_printf_parse_width(fmt, format, ap);
|
||||||
ft_parse_precision(fmt, format, ap);
|
ft_printf_parse_precision(fmt, format, ap);
|
||||||
ft_parse_modifiers(fmt, format);
|
ft_printf_parse_modifiers(fmt, format);
|
||||||
fmt->conversion = **format;
|
fmt->conversion = **format;
|
||||||
(*format)++;
|
(*format)++;
|
||||||
ft_fmt_validate_mod(fmt);
|
ft_fmt_validate_mod(fmt);
|
||||||
|
|
@ -20,7 +20,7 @@ t_fmt *ft_parse(char **format, va_list ap)
|
||||||
return (fmt);
|
return (fmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ft_parse_flags(t_fmt *fmt, char **format)
|
void ft_printf_parse_flags(t_fmt *fmt, char **format)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char *str;
|
char *str;
|
||||||
|
|
@ -44,7 +44,7 @@ void ft_parse_flags(t_fmt *fmt, char **format)
|
||||||
/* fflush(stdout); */
|
/* fflush(stdout); */
|
||||||
}
|
}
|
||||||
|
|
||||||
void ft_parse_width(t_fmt *fmt, char **format, va_list ap)
|
void ft_printf_parse_width(t_fmt *fmt, char **format, va_list ap)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char buf[10];
|
char buf[10];
|
||||||
|
|
@ -70,7 +70,7 @@ void ft_parse_width(t_fmt *fmt, char **format, va_list ap)
|
||||||
/* fflush(stdout); */
|
/* fflush(stdout); */
|
||||||
}
|
}
|
||||||
|
|
||||||
void ft_parse_precision(t_fmt *fmt, char **format, va_list ap)
|
void ft_printf_parse_precision(t_fmt *fmt, char **format, va_list ap)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
char buf[10];
|
char buf[10];
|
||||||
|
|
@ -98,7 +98,7 @@ void ft_parse_precision(t_fmt *fmt, char **format, va_list ap)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ft_parse_modifiers(t_fmt *fmt, char **format)
|
void ft_printf_parse_modifiers(t_fmt *fmt, char **format)
|
||||||
{
|
{
|
||||||
char *str;
|
char *str;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ int ft_printf(const char *format, ...)
|
||||||
if (*str == '%')
|
if (*str == '%')
|
||||||
{
|
{
|
||||||
str++;
|
str++;
|
||||||
if (!(fmt = ft_parse(&str, ap1)))
|
if (!(fmt = ft_printf_parse(&str, ap1)))
|
||||||
return (1);
|
return (1);
|
||||||
if (!fmt->valid)
|
if (!fmt->valid)
|
||||||
ft_strncat(final, &fmt->conversion, 1);
|
ft_strncat(final, &fmt->conversion, 1);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue