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

Utility functions for handling the exit command. More...

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

Functions

void child (t_shell *shell, char **args, int number)
 Handles the exit command when executed within a child process.
 
void handle_child (t_shell *shell, char **args, int number)
 Handles the exit command when executed within a child process.
 
void parent (t_shell *shell, char **args, int number)
 Handles the exit command when executed within the parent process.
 
int handle_parent (t_shell *shell, char **args, int number)
 Handles the exit command when executed within the parent process.
 

Detailed Description

Utility functions for handling the exit command.

Function Documentation

◆ child()

void child ( t_shell shell,
char **  args,
int  number 
)

Handles the exit command when executed within a child process.

This function is called when the exit command is executed within a child process. It handles the termination of the child process based on the provided arguments, including the exit status.

Parameters
[in]shellA pointer to the shell struct.
[in]argsAn array of strings containing the arguments.
[in]numberThe number of arguments in the array.

◆ handle_child()

void handle_child ( t_shell shell,
char **  args,
int  number 
)

Handles the exit command when executed within a child process.

This function is called when the exit command is executed within a child process. It handles the termination of the child process based on the provided arguments, including the exit status.

Parameters
[in]shellA pointer to the shell struct.
[in]argsAn array of strings containing the arguments.
[in]numberThe number of arguments in the array.

◆ handle_parent()

int handle_parent ( t_shell shell,
char **  args,
int  number 
)

Handles the exit command when executed within the parent process.

This function is called when the exit command is executed within the parent process. It handles the termination of the shell or reports an error when provided with invalid arguments.

Parameters
[in]shellA pointer to the shell struct.
[in]argsAn array of strings containing the arguments.
[in]numberThe number of arguments in the array.
Returns
An exit status (EXIT_SUCCESS on successful exit, or an error code on failure).

◆ parent()

void parent ( t_shell shell,
char **  args,
int  number 
)

Handles the exit command when executed within the parent process.

This function is called when the exit command is executed within the parent process. It handles the termination of the shell or reports an error when provided with invalid arguments.

Parameters
[in]shellA pointer to the shell.
[in]argsAn array of strings containing the arguments.
[in]numberThe number of arguments in the array.