tests flag p
This commit is contained in:
20
main.c
20
main.c
@@ -816,15 +816,21 @@ int main(int ac, char **av)
|
||||
printf("----------------------------------------------------------------\n\n");
|
||||
|
||||
char *s;
|
||||
PRINT("%p", "test")
|
||||
PRINT("%p", s)
|
||||
PRINT("%p", "test");
|
||||
PRINT("%p", s);
|
||||
s = "truc";
|
||||
PRINT("%p", s)
|
||||
PRINT("%p", s);
|
||||
unsigned int u = 4;
|
||||
PRINT("%p", &u)
|
||||
PRINT("%s-%p", s, s)
|
||||
PRINT("%u-%p", u, &u)
|
||||
PRINT("%up", u)
|
||||
PRINT("%p", &u);
|
||||
PRINT("%s-%p", s, s);
|
||||
PRINT("%u-%p", u, &u);
|
||||
PRINT("%up", u);
|
||||
PRINT("%p", NULL);
|
||||
PRINT("%5p", NULL);
|
||||
PRINT("%05p", NULL);
|
||||
PRINT("%0p", NULL);
|
||||
PRINT("%5.p", NULL);
|
||||
PRINT("%5.5p", NULL);
|
||||
}
|
||||
|
||||
if (ac == 2 || !strcmp(av[2], "%"))
|
||||
|
||||
@@ -188,13 +188,13 @@ char *ft_flag_transform(char *s, char *print, char *type, int *size)
|
||||
print = ft_precision(s, print, type);
|
||||
print = ft_plus(s, print, type);
|
||||
print = ft_sharp(s, print, type);
|
||||
print = ft_width(s, print, size, type);
|
||||
print = ft_sharp_again(s, print, type);
|
||||
print = ft_space(s, print, type, size);
|
||||
if (ft_strchr(type, 'p'))
|
||||
{
|
||||
print = ft_concat_free(ft_strdup("0x"), print);
|
||||
*size += 2;
|
||||
}
|
||||
print = ft_width(s, print, size, type);
|
||||
print = ft_sharp_again(s, print, type);
|
||||
print = ft_space(s, print, type, size);
|
||||
return (print);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user