-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparse_mod.c
30 lines (28 loc) · 1.38 KB
/
parse_mod.c
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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* parse_mod.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: alischyn <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/22 17:14:06 by alischyn #+# #+# */
/* Updated: 2017/03/22 17:19:54 by alischyn ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_printf.h"
const char *parse_mod(t_fmt *fmt, const char *f)
{
if (STRNCMP(f, "hh", 2) == 0 && (f += 2))
STRCPY(fmt->mod, "hh");
else if (STRNCMP(f, "h", 1) == 0 && (f += 1))
STRCPY(fmt->mod, "h");
else if (STRNCMP(f, "ll", 2) == 0 && (f += 2))
STRCPY(fmt->mod, "ll");
else if (STRNCMP(f, "l", 1) == 0 && (f += 1))
STRCPY(fmt->mod, "l");
else if (STRNCMP(f, "j", 1) == 0 && (f += 1))
STRCPY(fmt->mod, "j");
else if (STRNCMP(f, "z", 1) == 0 && (f += 1))
STRCPY(fmt->mod, "z");
return (f);
}