ajout des builtins pwd cd et export

This commit is contained in:
hugogogo
2021-11-11 17:44:42 +01:00
parent d65a701186
commit 47ae67ed14
12 changed files with 127 additions and 147 deletions

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/08 02:59:58 by lperrey #+# #+# */
/* Updated: 2021/11/10 13:41:58 by hulamy ### ########.fr */
/* Updated: 2021/11/11 09:58:01 by hulamy ### ########.fr */
/* */
/* ************************************************************************** */
@@ -15,12 +15,7 @@
// Init
int init(t_all *c, char *envp[]);
//int set_signals_handling(struct sigaction *ori_signal_behaviour,
// struct sigaction *signal_behaviour);
int set_signals_handling(struct sigaction *signal_behaviour);
//int set_terminal_attributes(struct termios *ori_termios,
// struct termios *interactive_termios,
// int *termios_changed);
// Shell modes
void shell_loop(t_all *c);
@@ -38,8 +33,12 @@ t_cmd **fill_cmd(t_token *token, char **envp);
void cmd_expansion(t_cmd **cmd_arr, char **envp);
// Builtins
int builtin_env(int argc, char *argv[], t_all *c);
int builtin_cd(int argc, char *argv[], t_all *c);
int builtin_pwd(int argc, char *argv[], t_all *c);
int builtin_export(int argc, char *argv[], t_all *c);
int builtin_unset(int argc, char *argv[], t_all *c);
int builtin_exit(int argc, char *argv[], t_all *c);
int builtin_env(int argc, char *argv[], t_all *c);
int builtin_echo(int argc, char *argv[], t_all *c);
// Free

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/08 02:35:52 by lperrey #+# #+# */
/* Updated: 2021/10/30 13:31:07 by lperrey ### ########.fr */
/* Updated: 2021/11/10 17:33:37 by hulamy ### ########.fr */
/* */
/* ************************************************************************** */
@@ -35,7 +35,7 @@ typedef struct s_token
enum e_token_id id;
} t_token;
typedef int (*t_builtin_ptr)(int,char **,struct s_all *);
typedef int t_builtin_ptr(int,char **,struct s_all *);
typedef struct s_cmd
{
@@ -54,10 +54,10 @@ typedef struct s_all
char *prompt;
t_token *token_list;
int last_exit_status;
struct termios ori_termios;
struct termios interactive_termios;
int termios_changed;
struct sigaction ori_signal_behaviour;
// struct termios ori_termios;
// struct termios interactive_termios;
// int termios_changed;
// struct sigaction ori_signal_behaviour;
struct sigaction signal_behaviour;
} t_all;