1
0
mirror of https://github.com/KeyZox71/ft_minipowershell.git synced 2025-05-13 16:08:45 +02:00

✏️」 norm: Normed everything and leak erased from the surface of the earth and what the fuck am i doing at this hour coding i shoud be sleeping 1:30am wtf god damn please give me a bed and fuck you yosyo 🖕

This commit is contained in:
2024-07-10 01:22:28 +02:00
parent b1f77b386a
commit 54e01e9bc3
19 changed files with 359 additions and 220 deletions

View File

@ -6,12 +6,13 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/07/09 16:32:21 by adjoly #+# #+# */
/* Updated: 2024/07/09 16:39:44 by adjoly ### ########.fr */
/* Updated: 2024/07/09 23:09:41 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "parsing.h"
#include "error_msg.h"
#include "minishell.h"
bool check_redir(t_list *list)
{

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/05 21:14:04 by adjoly #+# #+# */
/* Updated: 2024/07/09 16:12:34 by adjoly ### ########.fr */
/* Updated: 2024/07/09 20:23:16 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -64,5 +64,6 @@ char *env_var_replace(char *readline, t_env *env)
tmp++;
}
}
free(readline);
return (rl_dollared);
}

View File

@ -6,23 +6,28 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/31 12:47:13 by adjoly #+# #+# */
/* Updated: 2024/07/06 18:05:27 by adjoly ### ########.fr */
/* Updated: 2024/07/10 01:12:52 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "libft.h"
#include "parsing.h"
#include "minishell.h"
t_list *get_cmd_list(t_list *list, t_env *env)
t_list *get_cmd_list(t_list *list)
{
t_list *tmp;
t_list *cmd_list;
tmp = list;
cmd_list = NULL;
cmd_list = malloc(sizeof(t_list));
get_list2(&cmd_list);
cmd_list->next = NULL;
cmd_list->content = get_redir_fd(tmp->content);
tmp = tmp->next;
while (tmp)
{
ft_lstadd_back(&cmd_list, ft_lstnew(get_redir_fd(tmp->content, env)));
ft_lstadd_back(&cmd_list, ft_lstnew(get_redir_fd(tmp->content)));
tmp = tmp->next;
}
return (cmd_list);

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/30 10:48:41 by adjoly #+# #+# */
/* Updated: 2024/07/09 16:16:27 by adjoly ### ########.fr */
/* Updated: 2024/07/10 01:07:50 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
@ -18,12 +18,11 @@
#include <stdio.h>
#include "libft.h"
t_cmd *get_redir_fd(void *content, t_env *env)
t_cmd *get_redir_fd(void *content)
{
t_list *tmp;
t_redir_sign sign[2];
t_cmd *cmd;
char *env_varred;
tmp = ((t_token *)content)->redirection;
cmd = NULL;
@ -39,8 +38,6 @@ t_cmd *get_redir_fd(void *content, t_env *env)
cmd->outfile = STDOUT_FILENO;
if (sign[1] == OUTFILE)
cmd->infile = STDIN_FILENO;
env_varred = env_var_replace(((t_token *)content)->argv, env);
cmd = split_cmd(env_varred, cmd);
free(env_varred);
cmd = split_cmd(((t_token *)content)->argv, cmd);
return (cmd);
}

View File

@ -6,14 +6,15 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/06/30 15:56:53 by adjoly #+# #+# */
/* Updated: 2024/06/30 18:03:14 by adjoly ### ########.fr */
/* Updated: 2024/07/10 01:07:09 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "tokenizer.h"
#include <fcntl.h>
#include "execution.h"
#include "parsing.h"
#include "execution.h"
#include <stdio.h>
t_redir_sign __close_unused_fd(t_cmd *cmd, t_redir_sign sign)
{
@ -31,7 +32,7 @@ void open_redir(t_redirection *redir, t_cmd *cmd, t_redir_sign sign[2])
if (redir->sign == INFILE || redir->sign == HEREDOC)
sign[1] = __close_unused_fd(cmd, redir->sign);
if (redir->sign == HEREDOC)
cmd->infile = ft_heredoc(redir->file_name);
cmd->infile = ft_heredoc(redir->file_name, cmd);
else if (redir->sign == INFILE)
cmd->infile = open(redir->file_name, O_RDONLY);
else if (redir->sign == OUTFILE)

View File

@ -6,7 +6,7 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/25 15:06:15 by adjoly #+# #+# */
/* Updated: 2024/05/30 15:47:19 by adjoly ### ########.fr */
/* Updated: 2024/07/10 00:21:08 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */

View File

@ -6,13 +6,14 @@
/* By: adjoly <adjoly@student.42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/20 21:05:04 by adjoly #+# #+# */
/* Updated: 2024/06/26 12:56:14 by adjoly ### ########.fr */
/* Updated: 2024/07/09 23:43:39 by adjoly ### ########.fr */
/* */
/* ************************************************************************** */
#include "tokenizer.h"
#include "libft.h"
#include "parsing.h"
#include <stdio.h>
size_t __get_sizeof_redir(char *redir_s, t_redirection *redir)
{