/* By: lnikolov <lnikolov@student.42prague.com +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/08/31 15:57:29 by lnikolov #+# #+# */
-/* Updated: 2024/08/31 16:28:30 by lnikolov ### ########.fr */
+/* Updated: 2024/09/01 11:19:35 by ljiriste ### ########.fr */
/* */
/* ************************************************************************** */
len = 0;
i = 0;
while (expanded_split[i])
- len += ft_strlen(expanded_split[i++]) + 1;
- *str = malloc(len + 1 + 1);
- if (!str)
- {
- *str = tmp;
+ len += ft_strlen(expanded_split[i++]) + 2 + 1;
+ tmp = malloc(len + 1 + 1);
+ if (!tmp)
return (1);
- }
+ free(*str);
+ *str = tmp;
str[0][0] = '\0';
i = 0;
while (expanded_split[i])
{
+ if (g_last_signal)
+ return (1);
ft_strlcat(*str, expanded_split[i++], len + 1 + 1);
ft_strlcat(*str, " ", len + 1 + 1);
}
- free(tmp);
return (0);
}
i = 0;
while (expanded_split[i])
{
+ if (g_last_signal)
+ return (1);
ft_strlcat(*str, "'", len + 1 + 1);
ft_strlcat(*str, expanded_split[i++], len + 1 + 1);
ft_strlcat(*str, "'", len + 1 + 1);