gros merge
This commit is contained in:
44
includes/exec/builtins.h
Normal file
44
includes/exec/builtins.h
Normal file
@@ -0,0 +1,44 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* builtins.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: lderidde <lderidde@student.s19.be> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/01/28 09:01:33 by lderidde #+# #+# */
|
||||
/* Updated: 2025/01/30 10:40:49 by lderidde ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef BUILTINS_H
|
||||
# define BUILTINS_H
|
||||
|
||||
# include "../lib/libft/libft.h"
|
||||
# include "../minishell.h"
|
||||
# include <stdio.h>
|
||||
# include <sys/types.h>
|
||||
# include <signal.h>
|
||||
# include <stdbool.h>
|
||||
# include <unistd.h>
|
||||
# include <errno.h>
|
||||
# include <stdlib.h>
|
||||
# include <string.h>
|
||||
|
||||
# define EXPRT_INV "not a valid identifier"
|
||||
// void echo(char *msg, int flag);
|
||||
int builtin_echo(char **arg, char **envp);
|
||||
int builtin_exit(char **arg, bool depth);
|
||||
int builtin_pwd(char **arg);
|
||||
int builtin_env(char **arg, char **envp);
|
||||
int builtin_unset(char **arg, t_ast_n *head);
|
||||
int builtin_cd(char **arg, t_ast_n *head);
|
||||
int builtin_export(char **arg, t_ast_n *head);
|
||||
|
||||
//UTILS
|
||||
int count_char(char *str);
|
||||
int count_args(char **tab);
|
||||
int extractenv(char *str, char **envp);
|
||||
char *ft_getenv(char *str, char **envp);
|
||||
int err_msg_cmd(char *cmd, char *arg, char *msg, int code);
|
||||
|
||||
#endif
|
||||
33
includes/exec/env.h
Normal file
33
includes/exec/env.h
Normal file
@@ -0,0 +1,33 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* env.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: lderidde <lderidde@student.s19.be> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/01/28 10:11:07 by lderidde #+# #+# */
|
||||
/* Updated: 2025/01/28 10:31:54 by lderidde ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef ENV_H
|
||||
# define ENV_H
|
||||
|
||||
# include "../lib/libft/libft.h"
|
||||
# include "../minishell.h"
|
||||
# include <unistd.h>
|
||||
# include <stdlib.h>
|
||||
# include <stdbool.h>
|
||||
|
||||
//VAR
|
||||
int count_var(char **envp);
|
||||
int get_var_index(char *key, t_ast_n *head);
|
||||
void free_null_ptr(void *ptr);
|
||||
char **copy_env_var(char **envp, int count);
|
||||
char *get_var_value(char *key, char **envp);
|
||||
bool is_valid_key(char *key, t_ast_n *head);
|
||||
int remove_env_var(char *key, t_ast_n *head);
|
||||
void set_var_env(char *key, char *value, t_ast_n *head);
|
||||
char **init_env(char **envp);
|
||||
|
||||
#endif
|
||||
25
includes/exec/exec.h
Normal file
25
includes/exec/exec.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* exec.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: lderidde <lderidde@student.s19.be> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/01/27 11:21:23 by lderidde #+# #+# */
|
||||
/* Updated: 2025/01/27 15:02:20 by lderidde ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef EXEC_H
|
||||
#define EXEC_H
|
||||
|
||||
# include "../minishell.h"
|
||||
# include <stdio.h>
|
||||
# include <sys/wait.h>
|
||||
# include <sys/types.h>
|
||||
# include <stdlib.h>
|
||||
# include <unistd.h>
|
||||
|
||||
int execute_command(t_ast_n *node);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user