aboutsummaryrefslogtreecommitdiff
path: root/src/praise_the_norme.c
blob: 5639b7d10acf56e5f1ee4e0bb2da1583b9c21592 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/* ************************************************************************** */
/*                                                                            */
/*                                                        :::      ::::::::   */
/*   praise_the_norme.c                                 :+:      :+:    :+:   */
/*                                                    +:+ +:+         +:+     */
/*   By: chuhlig <chuhlig@student.42.fr>            +#+  +:+       +#+        */
/*                                                +#+#+#+#+#+   +#+           */
/*   Created: 2025/01/20 18:35:41 by dkaiser           #+#    #+#             */
/*   Updated: 2025/01/23 18:31:49 by chuhlig          ###   ########.fr       */
/*                                                                            */
/* ************************************************************************** */

#include "minishell.h"

void	i_love_the_norme(t_token **cur, t_token **tokens)
{
	t_token	*next_token;

	next_token = (*cur)->next;//setting next token to the adress of the next token
	free_token_and_connect(*cur);// do i neee a double call here
	//but technically it would remove the redir token
	if (next_token)// if after redir is stuff
	{
		if (next_token->previous == NULL)// then if is the first token or token after pipe
			*tokens = next_token->next;// how does here come no error
			//anyways i twould the redir adress token to the next token 
		*cur = next_token->next;
		free_token_and_connect(next_token);
	}
	else // else makes sense
		*cur = NULL;
}

// takes adress of token head or pos after pipe and the token specifer