maxishell
Implementation of a shell for Linux-like systems
Loading...
Searching...
No Matches
initialise.c File Reference
#include "tokens.h"
#include "env.h"
#include "signals.h"
Include dependency graph for initialise.c:

Go to the source code of this file.

Functions

void init_ms_data (t_ms_data *data, char **argv, char **envp)
 
void initialise (int argc, char **argv)
 

Function Documentation

◆ init_ms_data()

void init_ms_data ( t_ms_data data,
char **  argv,
char **  envp 
)

Definition at line 20 of file initialise.c.

21{
22 (void)argv;
23 data->args = NULL;
24 data->envp = NULL;
25 init_env(&data->envp, envp);
26 data->shell_variables = NULL;
27 handle_add_set_shell_variable(&data->shell_variables, "_=/usr/bin/env");
28 set_shell_var(&data->shell_variables, "?", "0");
29 data->current_dir = getcwd(NULL, 0);
30 data->exit_status = 0;
31 data->std_in = -1;
32 data->std_out = -1;
33 data->std_err = 2;
34}
void init_env(t_env **data_envp, char **envp)
Definition env.c:24
void set_shell_var(t_env **shell_var, const char *key, const char *value)
int handle_add_set_shell_variable(t_env **shell_var, char *line)
int exit_status
Definition shell.h:30
t_env * envp
Definition shell.h:24
int std_err
Definition shell.h:28
int std_out
Definition shell.h:27
t_env * shell_variables
Definition shell.h:25
char * current_dir
Definition shell.h:29
char ** args
Definition shell.h:23
int std_in
Definition shell.h:26

References s_ms_data::args, s_ms_data::current_dir, s_ms_data::envp, s_ms_data::exit_status, handle_add_set_shell_variable(), init_env(), set_shell_var(), s_ms_data::shell_variables, s_ms_data::std_err, s_ms_data::std_in, and s_ms_data::std_out.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ initialise()

void initialise ( int  argc,
char **  argv 
)

Definition at line 36 of file initialise.c.

37{
38 if (argc > 1)
39 {
40 ft_printf("Usage: %s\n", argv[0]);
41 exit(EXIT_FAILURE);
42 }
43 read_history(HISTORY_PATH);
44}
#define EXIT_FAILURE
Definition exit_status.h:17
int ft_printf(const char *format,...)
Definition ft_printf.c:37
#define HISTORY_PATH
Definition tokens.h:27

References EXIT_FAILURE, ft_printf(), and HISTORY_PATH.

Referenced by main().

Here is the call graph for this function:
Here is the caller graph for this function: