ARABIE AHLAWAKBAR

This commit is contained in:
Etienne Rey-bethbeder
2023-02-21 15:42:05 +01:00
parent 96de7639cd
commit b40762478a
2 changed files with 37 additions and 7 deletions

View File

@ -6,7 +6,7 @@
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/17 13:09:08 by erey-bet #+# #+# */
/* Updated: 2023/02/17 17:07:50 by erey-bet ### ########.fr */
/* Updated: 2023/02/21 15:38:53 by erey-bet ### ########.fr */
/* */
/* ************************************************************************** */
@ -45,11 +45,40 @@ int check_argument(char *str, int *check, int i)
return (i);
}
int echo(int fd, char *str)
{
int check;
int i;
char *conca(char **strings)
{
int len;
char *result;
char *p;
int i;
i = -1;
while (strings[++i] != NULL)
len += strlen(strings[i]);
result = (char *) malloc(len * 2 + 1);
if (result == NULL)
return NULL;
p = result;
i = 0;
while (strings[i] != NULL)
{
ft_strncpy(p, strings[i], ft_strlen(strings[i]));
ft_strncpy(p, " ", 1);
p += strlen(strings[i]);
i++;
}
return (result);
}
int echo(int fd, char **strs)
{
int check;
int i;
char *str;
str = conca(strs);
check = 0;
i = 0;
while (is_space(str[i]))