-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexpansions_spaces_utils.c
44 lines (38 loc) · 1.25 KB
/
expansions_spaces_utils.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
34
35
36
37
38
39
40
41
42
43
44
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* expansions_spaces_utils.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: ngasco <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/04/05 12:47:44 by ngasco #+# #+# */
/* Updated: 2022/04/05 12:47:45 by ngasco ### ########.fr */
/* */
/* ************************************************************************** */
#include "minishell.h"
int ft_calc_spaces_token_len(char *str)
{
int i;
i = 0;
while (!ft_isspace(str[i]))
i++;
return (i);
}
int ft_has_spaces(char *str)
{
int i;
i = 0;
while (str[i] != '\0')
{
if (ft_isspace(str[i]))
return (1);
i++;
}
return (0);
}
int ft_isspace(char c)
{
if (c == ' ' || c == '\t' || c == '\r' || c == '\v')
return (1);
return (0);
}