-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauxil.c
39 lines (36 loc) · 1.3 KB
/
auxil.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
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* auxil.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: fvieira <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2022/12/13 12:57:05 by fvieira #+# #+# */
/* Updated: 2022/12/14 12:32:44 by fvieira ### ########.fr */
/* */
/* ************************************************************************** */
#include "minitalk.h"
unsigned char *ft_alt_strjoin(unsigned char *s1, unsigned char c)
{
int len_s1;
int counter;
unsigned char *str;
counter = 0;
len_s1 = 0;
if (s1)
len_s1 = ft_strlen((char *) s1);
str = malloc((len_s1 + 2) * sizeof(char));
if (s1)
{
while (s1[counter] != '\0')
{
str[counter] = s1[counter];
counter++;
}
}
str[counter] = c;
str[counter + 1] = '\0';
if (s1)
free(s1);
return (str);
}