-
Notifications
You must be signed in to change notification settings - Fork 0
/
ft_printf.h
55 lines (49 loc) · 1.9 KB
/
ft_printf.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ldulling <ldulling@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/10/22 19:26:08 by ldulling #+# #+# */
/* Updated: 2023/10/22 20:29:29 by ldulling ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FT_PRINTF_H
# define FT_PRINTF_H
# include "libft/libft.h"
# include <stdarg.h>
# include <unistd.h>
# ifndef FD
# define FD 1
# endif
# define SPECIFIERS "cspdiuxX%"
# define FLAGS "#+- 0"
# define NULL_PRINTOUT_PTR "(nil)"
# define NULL_PRINTOUT_STR "(null)"
# define FROM_NEGATIVE_WIDTH 2
# define NO_PRECISION_SET -1
# define NEGATIVE_PRECISION -2
typedef struct s_struct
{
int hash;
int plus;
int space;
int minus;
int zero;
int width;
int precision;
char specifier;
int unresolved;
} t_struct;
int ft_printf(const char *format, ...);
int ft_putnbr_base_fd(long n, const char *base, int fd);
size_t ft_putnchar_fd(unsigned char c, size_t n, int fd);
size_t ft_putnstr_fd(const char *s, size_t n, int fd);
int print_char(unsigned char c, t_struct *f);
int print_nbr(long nbr, t_struct *f);
int print_parsed(const char *format, int parsed, t_struct *f);
int print_ptr(size_t ptr, t_struct *f);
int print_str(const char *str, t_struct *f);
int set_format(const char *format, int *i, t_struct *f, va_list *ap);
#endif