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

Command Execution Functions. More...

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

Functions

void close_fds (t_executor *current)
 Close file descriptors based on command redirection settings.
 
void handle_single (t_shell *shell)
 Handle the execution of a single command.
 
void executor (t_shell *shell)
 Primary entrypoint of command execution.
 

Detailed Description

Command Execution Functions.

Function Documentation

◆ close_fds()

void close_fds ( t_executor *  current)

Close file descriptors based on command redirection settings.

This function is responsible for closing file descriptors associated with input and output redirection, as determined by the settings in the current executor node.

Parameters
[in]currentA pointer to the executor struct.

◆ executor()

void executor ( t_shell *  shell)

Primary entrypoint of command execution.

The executor function determines whether to handle a single command or multiple command based on the size of commands passed to it.

Parameters
[in,out]shellA pointer to the shell struct.

◆ handle_single()

void handle_single ( t_shell *  shell)

Handle the execution of a single command.

The handle_single function first checks if the command is an empty string and fails accordingly. If the command is a builtin it would execute it in the parent process, otherwise it would do a fork and execute the external command in the child process.

Parameters
[in,out]shellA pointer to the shell struct.