-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathft_lsttoupper.c
37 lines (34 loc) · 1.3 KB
/
ft_lsttoupper.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* ft_lsttoupper.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: erli <[email protected]> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2018/11/08 17:24:47 by erli #+# #+# */
/* Updated: 2018/11/08 17:38:15 by erli ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include <stdlib.h>
t_list *ft_lsttoupper(t_list *elem)
{
void *str;
unsigned char *strc;
size_t i;
t_list *new;
i = 0;
if (!(str = malloc(elem->content_size)))
return (NULL);
str = elem->content;
strc = (unsigned char *)str;
while (i < elem->content_size)
{
if (strc[i] >= 'a' && strc[i] <= 'z')
strc[i] -= 32;
i++;
}
new = ft_lstnew(str, elem->content_size);
free(str);
return (new);
}