Compare commits
No commits in common. "03a2cc055c171c30caf66ae3f02f7f08b28279e0" and "0ece156b974b5c69f1ed0933ca4a5ca310bb373c" have entirely different histories.
03a2cc055c
...
0ece156b97
@ -6,7 +6,7 @@
|
||||
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2023/02/17 13:09:08 by erey-bet #+# #+# */
|
||||
/* Updated: 2023/02/21 16:02:09 by erey-bet ### ########.fr */
|
||||
/* Updated: 2023/02/21 15:38:53 by erey-bet ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -56,14 +56,16 @@ char *conca(char **strings)
|
||||
i = -1;
|
||||
while (strings[++i] != NULL)
|
||||
len += strlen(strings[i]);
|
||||
result = (char *) ft_calloc(len * 2 + 1, sizeof(char));
|
||||
result = (char *) malloc(len * 2 + 1);
|
||||
if (result == NULL)
|
||||
return NULL;
|
||||
p = result;
|
||||
i = 0;
|
||||
while (strings[i] != NULL)
|
||||
{
|
||||
ft_strncpy(result + ft_strlen(result), strings[i], ft_strlen(strings[i]));
|
||||
ft_strncpy(result + ft_strlen(result), " ", 1);
|
||||
ft_strncpy(p, strings[i], ft_strlen(strings[i]));
|
||||
ft_strncpy(p, " ", 1);
|
||||
p += strlen(strings[i]);
|
||||
i++;
|
||||
}
|
||||
return (result);
|
||||
@ -83,14 +85,8 @@ int echo(int fd, char **strs)
|
||||
i++;
|
||||
i = check_argument(str, &check, i);
|
||||
while (str[i])
|
||||
ft_putchar_fd(str[i++], fd);
|
||||
ft_putchar_fd(fd, str[i++]);
|
||||
if (!check)
|
||||
write(fd, "\n", 1);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
echo(1, argv);
|
||||
return (0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user