mirror of
https://github.com/KeyZox71/ft_minipowershell.git
synced 2025-03-15 03:16:51 +01:00
「✨」 feat: changed heredoc parsing behavior
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
/* By: mmoussou <mmoussou@student.42angouleme.fr +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/07/03 10:50:52 by mmoussou #+# #+# */
|
||||
/* Updated: 2024/07/21 18:39:15 by mmoussou ### ########.fr */
|
||||
/* Updated: 2024/07/24 18:12:44 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -32,7 +32,6 @@ void copy_until_next(char *cmd, char quote, uint *i, uint *i_offset)
|
||||
}
|
||||
(*i_offset)++;
|
||||
}
|
||||
|
||||
char *format_quotes_string(char *cmd)
|
||||
{
|
||||
uint i;
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/25 15:06:15 by adjoly #+# #+# */
|
||||
/* Updated: 2024/07/21 19:06:25 by mmoussou ### ########.fr */
|
||||
/* Updated: 2024/07/24 18:13:17 by adjoly ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@ -16,34 +16,37 @@
|
||||
|
||||
size_t __cpy_arg(char *dst, char *src);
|
||||
size_t __get_len_arg(char *s);
|
||||
char *format_quotes_string(char *cmd);
|
||||
|
||||
char *__redir_filename_cpy(char *redir_s)
|
||||
{
|
||||
char *filename;
|
||||
size_t len;
|
||||
size_t i;
|
||||
size_t j;
|
||||
//char *filename;
|
||||
//size_t len;
|
||||
//size_t i;
|
||||
//size_t j;
|
||||
char *tmp;
|
||||
|
||||
tmp = ft_calloc(__get_len_arg(redir_s) + 1, sizeof(char));
|
||||
len = __cpy_arg(tmp, redir_s);
|
||||
i = 0;
|
||||
j = 0;
|
||||
filename = ft_calloc(len + 1, sizeof(char));
|
||||
while (i < len)
|
||||
{
|
||||
if (tmp[i] == DOUBLE || tmp[i] == SINGLE)
|
||||
i++;
|
||||
else
|
||||
{
|
||||
filename[j] = tmp[i];
|
||||
i++;
|
||||
j++;
|
||||
}
|
||||
}
|
||||
filename[j] = 0;
|
||||
free(tmp);
|
||||
return (filename);
|
||||
__cpy_arg(tmp, redir_s);
|
||||
// i = 0;
|
||||
// j = 0;
|
||||
// filename = ft_calloc(len + 1, sizeof(char));
|
||||
// while (i < len)
|
||||
// {
|
||||
// if (tmp[i] == DOUBLE || tmp[i] == SINGLE)
|
||||
// i++;
|
||||
// else
|
||||
// {
|
||||
// filename[j] = tmp[i];
|
||||
// i++;
|
||||
// j++;
|
||||
// }
|
||||
// }
|
||||
// filename[j] = 0;
|
||||
// free(tmp);
|
||||
// return (filename);
|
||||
tmp = format_quotes_string(tmp);
|
||||
return (tmp);
|
||||
}
|
||||
|
||||
t_redirection *__to_redir(char *redir_s)
|
||||
|
Reference in New Issue
Block a user