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

Functions for checking the exit code of a process. More...

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

Functions

void check_exitcode (int wstatus, bool *is_print)
 Checks the exit code of a child process and update g_exit_code.
 

Detailed Description

Functions for checking the exit code of a process.

Contains functions for checking the exit code of a child process and updating g_exit_code accordingly. Handles normal exit and signal termination.

Function Documentation

◆ check_exitcode()

void check_exitcode ( int  wstatus,
bool *  is_print 
)

Checks the exit code of a child process and update g_exit_code.

Checks the exit code of a child process and updates g_exit_code based on wether the process exited normally or was terminated by a signal. If the process exited normally, the exit status is used. If the process was terminated bt a signal, the signalnumber is added to the base (128) to set the exit code.

Parameters
[in]wstatusThe status of the child process.
[in,out]is_printA pointer to a boolean indicating wether to print the SIGQUIT message.