🔨」 fix: fixed ./{file}

This commit is contained in:
2024-07-15 16:25:15 +02:00
parent b76e67b004
commit 605d9dd2eb

View File

@ -6,11 +6,12 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/25 15:06:15 by adjoly #+# #+# */
/* Updated: 2024/07/15 14:12:50 by adjoly ### ########.fr */
/* Updated: 2024/07/15 16:22:01 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "tokenizer.h"
#include <stdio.h>
t_redirection *__to_redir(char *redir_s)
{
@ -29,10 +30,9 @@ t_redirection *__to_redir(char *redir_s)
tmp = redir_s;
if (!ft_isalnum(*tmp) && *tmp != '/' && *tmp != '.')
return (redir);
while (*tmp && ft_isalnum(*tmp) && *tmp != '/' && *tmp != '.')
while (*tmp && (ft_isalnum(*tmp) || *tmp == '/' || *tmp == '.'))
tmp++;
redir->file_name = ft_calloc(tmp - redir_s + 1, sizeof(char));
ft_strlcpy(redir->file_name, redir_s, tmp - redir_s + 1);
redir_s += (tmp - redir_s);
return (redir);
}