-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_printf.h
80 lines (70 loc) · 2.7 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_printf.h :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ptroger <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/01/06 13:47:23 by ptroger #+# #+# */
/* Updated: 2020/02/11 14:08:42 by ptroger ### ########.fr */
/* */
/* ************************************************************************** */
#ifndef FT_PRINTF_H
# define FT_PRINTF_H
# include <stdlib.h>
# include <stdarg.h>
# include <string.h>
# include <unistd.h>
struct s_opt
{
char wildcard;
char negative;
char zero;
char dot;
char dothash;
char hash;
} s_opt;
struct s_val
{
int index;
int result;
int precision;
int width;
} s_val;
void ft_handle_numbers(const char format, va_list tab,
struct s_val *val, struct s_opt *opt);
void ft_handle_nb(struct s_val *val, struct s_opt *opt, int nb,
char *str);
void ft_handle_hexa(const char format, va_list tab,
struct s_val *val, struct s_opt *opt);
void handle_zero_zero(struct s_val *val, struct s_opt *opt,
const char format);
void ft_handle_options(struct s_val *val, struct s_opt *opt,
char *str, const char format);
struct s_opt *initialise_opt(void);
struct s_val *initialise_val(void);
void reset_opt(struct s_val *val, struct s_opt *opt);
int ft_handle_opt(struct s_val *val,
struct s_opt *opt, char *str);
int ft_putchar(int c);
int ft_putstr(char *str, struct s_val *val, struct s_opt *opt,
const char format);
void ft_handle_char(const char format, va_list tab,
struct s_val *val, struct s_opt *opt);
char *ft_to_upper(char *str);
char *ft_itoa_base(unsigned long nb, unsigned int base);
int ft_atoi(const char *str);
void ft_handle_modulo(struct s_val *val, struct s_opt *opt);
char *ft_itoa(int n);
char *ft_unsigned_itoa(unsigned int n);
int ft_isdigit(int c);
int ft_strlen(char *str);
char *ft_strdup(const char *src);
void put_tab(const char *format, va_list tab, struct s_val *val,
struct s_opt *opt);
void parse(const char *format, va_list tab,
struct s_val *val, struct s_opt *opt);
void parse_opt(const char *format, va_list tab, struct s_val *val,
struct s_opt *opt);
int ft_printf(const char *format, ...);
#endif