minishell
Minishell Project for École 42
Loading...
Searching...
No Matches
process_command.c File Reference

Subfunctions for process_command(). More...

#include "minishell.h"
Include dependency graph for process_command.c:

Functions

int get_size_execs (t_lexer_list *lexer)
 Calculates the number of consecutive NONE type lexer list nodes.
 
char ** get_execs_array (t_lexer_list *lexer, int size)
 Creates an array of the found NONE type tokens from the lexer list.
 

Detailed Description

Subfunctions for process_command().

Function Documentation

◆ get_execs_array()

char ** get_execs_array ( t_lexer_list lexer,
int  size 
)

Creates an array of the found NONE type tokens from the lexer list.

Allocates memory for an array of NONE tokens. Fills the array with the strings from the consecutive NONE type tokens in the lexer list.

Parameters
lexerA pointer to the current lexer list node.
intThe size of the array.
Returns
A pointer to the allocated array, or NULL if allocation failed.

◆ get_size_execs()

int get_size_execs ( t_lexer_list lexer)

Calculates the number of consecutive NONE type lexer list nodes.

Calculates the number of command arguments based on the number of consecutive NONE type tokens in the lexer list. Each NONE token represents one of the following: a command(executable/buildin), a command option(-i –version), or a command argument(filenames, etc).

Parameters
lexerA pointer to the current lexer list node.
Returns
The number of consecutive NONE type tokens found.