Working on scanner.c

This commit is contained in:
Maieul BOYER 2024-09-05 17:17:53 +00:00
parent f925aea552
commit c5bc77f467
6 changed files with 722 additions and 762 deletions

View file

@ -37,28 +37,28 @@ t_error _handle_redirections_inherited(t_spawn_info *info, t_process *process)
t_error _handle_redirections_fds(t_spawn_info *info, t_process *process)
{
t_fd *tmp;
// t_fd *tmp;
if (info->stdin.tag == R_FD)
{
tmp = info->stdin.fd.fd;
// tmp = info->stdin.fd.fd;
info->stdin = fd(dup_fd(info->stdin.fd.fd));
process->stdin = dup_fd(info->stdin.fd.fd);
close_fd(tmp);
// close_fd(tmp);
}
if (info->stdout.tag == R_FD)
{
tmp = info->stdin.fd.fd;
// tmp = info->stdin.fd.fd;
info->stdout = fd(dup_fd(info->stdout.fd.fd));
process->stdout = dup_fd(info->stdout.fd.fd);
close_fd(tmp);
// close_fd(tmp);
}
if (info->stderr.tag == R_FD)
{
tmp = info->stdin.fd.fd;
// tmp = info->stdin.fd.fd;
info->stderr = fd(dup_fd(info->stderr.fd.fd));
process->stderr = dup_fd(info->stderr.fd.fd);
close_fd(tmp);
// close_fd(tmp);
}
return (NO_ERROR);
}

View file

@ -21,6 +21,8 @@ t_str str_clone(t_const_str source)
t_str res;
t_usize len;
if (source == NULL)
return (NULL);
len = str_len(source) + 1;
res = mem_alloc_array(sizeof(*res), len);
if (res == NULL)