🔨」 fix: fixed quote in $

This commit is contained in:
2024-07-15 18:19:07 +02:00
parent ab8177a419
commit 4f56de1c24
3 changed files with 15 additions and 5 deletions

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */ /* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/20 20:25:06 by adjoly #+# #+# */ /* Created: 2024/05/20 20:25:06 by adjoly #+# #+# */
/* Updated: 2024/07/03 19:07:12 by adjoly ### ########.fr */ /* Updated: 2024/07/15 18:05:05 by adjoly ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -23,7 +23,7 @@
# define ERROR_NO_EOF "need delimiter to heredoc" # define ERROR_NO_EOF "need delimiter to heredoc"
# define ERROR_NO_FILE "No such file or directory" # define ERROR_NO_FILE "No such file or directory"
# define ERROR_CMD_PIPE "No command after pipe" # define ERROR_CMD_PIPE "No command after pipe"
# define ERROR_NO_CMD "No command in the pipe" # define ERROR_NO_CMD "command not found"
# define ERROR_COREDUMP "(core dumped)" # define ERROR_COREDUMP "(core dumped)"

View File

@ -6,7 +6,7 @@
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */ /* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/03 10:50:52 by mmoussou #+# #+# */ /* Created: 2024/07/03 10:50:52 by mmoussou #+# #+# */
/* Updated: 2024/07/15 14:25:01 by adjoly ### ########.fr */ /* Updated: 2024/07/15 18:17:50 by adjoly ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -38,6 +38,16 @@ char *format_quotes_string(char *cmd)
ft_strlcat(ret, tmp + 1, ft_strlen(ret) + inquote); ft_strlcat(ret, tmp + 1, ft_strlen(ret) + inquote);
tmp += inquote; tmp += inquote;
} }
else if (*tmp == -1)
{
ft_strlcat(ret, "\'", ft_strlen(ret) + 2);
tmp++;
}
else if (*tmp == -1)
{
ft_strlcat(ret, "\"", ft_strlen(ret) + 2);
tmp++;
}
else else
{ {
ft_strlcat(ret, tmp, ft_strlen(ret) + 2); ft_strlcat(ret, tmp, ft_strlen(ret) + 2);

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */ /* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/21 11:59:34 by adjoly #+# #+# */ /* Created: 2024/06/21 11:59:34 by adjoly #+# #+# */
/* Updated: 2024/06/30 16:11:23 by adjoly ### ########.fr */ /* Updated: 2024/07/15 18:16:52 by adjoly ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -24,7 +24,7 @@ size_t count_quote(char *readline, t_quote type)
while (*tmp) while (*tmp)
{ {
if (*tmp == type) if (*tmp == type)
count++; count += search_for_next_quote(tmp, type) - tmp;
tmp++; tmp++;
} }
return (count); return (count);