-
Notifications
You must be signed in to change notification settings - Fork 0
/
uni_manyrange.c
33 lines (30 loc) · 1.18 KB
/
uni_manyrange.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
31
32
33
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* uni_manyrange.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: qle-guen <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/10/19 12:57:20 by qle-guen #+# #+# */
/* Updated: 2016/10/19 15:47:21 by qle-guen ### ########.fr */
/* */
/* ************************************************************************** */
#include "libparse.h"
char *uni_manyrange(t_parg arg, t_pfun p, char *inp)
{
int count;
count = 0;
while (*inp)
{
if (run_pfun(p, inp))
count++;
else
break ;
inp++;
}
if (arg.r.a == -1)
return (inp);
if (count >= arg.r.a && (arg.r.b == -1 || count <= arg.r.b))
return (inp);
return (NULL);
}