Merge branch 'mylan2' into mylan

This commit is contained in:
mcolonna 2024-04-24 13:29:49 +02:00
commit 24d8b38510
43 changed files with 1395 additions and 17 deletions

View file

@ -6,7 +6,7 @@
/* By: mcolonna <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/04/23 14:15:12 by mcolonna #+# #+# */
/* Updated: 2024/04/23 16:01:17 by mcolonna ### ########.fr */
/* Updated: 2024/04/24 13:19:28 by mcolonna ### ########.fr */
/* */
/* ************************************************************************** */
@ -17,6 +17,12 @@
# include <stdio.h>
# include <errno.h>
# include <string.h>
# include <sys/types.h>
# include <unistd.h>
# include <fcntl.h>
# include <stdlib.h>
# include <strings.h>
# include "libft.h"
# include "libtf.h"
///// ASK COMMAND /////
@ -30,7 +36,7 @@ const char *ask_command(t_memclass mc);
// Represents a call to a program (the program name and its arguments)
typedef struct s_call
{
char *program; // path of the program to call.
const char *program; // path of the program to call.
int argc; // number of arguments given
const char *const *argv; // arguments given
// (argc and argv must include the program name)
@ -39,11 +45,11 @@ typedef struct s_call
// Represents a command given by the user.
typedef struct s_command
{
bool error; // true means an error occured in interpret_command().
t_call *calls; // all calls to programs.
int input_fd; // fd to use with '<' redirection (0 by default)
int output_fd; // fd to use with '>' redirection (1 by default)
} t_command;
bool error; // true means an error occured in interpret_command().
const t_call *calls; // all calls to programs.
int input_fd; // fd to use with '<' redirection (0 by default)
int output_fd; // fd to use with '>' redirection (1 by default)
} t_command;
// Return the t_command representing the command given by the user.
// If error, return a t_command wth the value .error = true.
@ -60,4 +66,10 @@ int execute_command(t_command command);
// If msg == "errno", use strerror(errno)
void minishell_error(const char *msg);
///// PATH /////
// Get the PATH values.
// Return a list of strings ended by NULL.
const char **get_path(const char **envp);
#endif