manage errors
This commit is contained in:
parent
78f6fcc82f
commit
117631d50e
5 changed files with 60 additions and 40 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/04/23 14:15:12 by mcolonna #+# #+# */
|
||||
/* Updated: 2024/04/26 14:21:43 by mcolonna ### ########.fr */
|
||||
/* Updated: 2024/04/29 15:48:25 by mcolonna ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -46,7 +46,7 @@ typedef struct s_call
|
|||
// Represents a command given by the user.
|
||||
typedef struct s_command
|
||||
{
|
||||
bool error; // true if an error occured in interpret_command().
|
||||
int error; // 0 if parse_command() succeded, error status if not
|
||||
const t_call *calls; // all calls to programs (ended by .program == NULL)
|
||||
int input_fd; // fd to use with '<' redirection (0 by default)
|
||||
int output_fd; // fd to use with '>' redirection (1 by default)
|
||||
|
|
@ -65,10 +65,10 @@ int execute_command(t_memclass mc, t_command command,
|
|||
///// ERROR /////
|
||||
|
||||
// Call to show an error.
|
||||
// If msg == "errno", use strerror(errno)
|
||||
// If msg == "errno", use perror()
|
||||
void minishell_error(const char *msg);
|
||||
|
||||
// Call to write the error and exit the program.
|
||||
// Call perror() and exit the program.
|
||||
void fatal_error(const char *msg);
|
||||
|
||||
///// PATH /////
|
||||
|
|
@ -82,4 +82,7 @@ char **get_path(char *const envp[]);
|
|||
const char *search_path(
|
||||
const t_memclass mc, const char **path, const char *prog);
|
||||
|
||||
///// MAIN /////
|
||||
extern t_memclass g_mc;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue