Giter VIP home page Giter VIP logo

42_minishell's Introduction

Minishell [110 / 100]

Summary

The eighth project in the 42sp fundamentals track, Minishell, is based on the creation of a simple shell, which must need to be able to execute some build-ins (echo, cd, pwd, export, unset, env, exit), single and multiple commands with pipes, the redirects >, >>, < and << (heredoc) must be implemented too, in addition to signal management (Ctrl+C, Ctrl+D and Ctrl+\).


Run the Program

  • Make sure you clone the repository with the following command:
$> git clone [email protected]:ArthurSobreira/42_minishell.git
  • Once cloned, to compile the program, use the following commands:
$> make / make bonus

The Project



42_minishell's People

Contributors

arthursobreira avatar phm-aguiar avatar

Stargazers

Cauê Mendes avatar Jaqueline Ribeiro avatar  avatar

Watchers

 avatar

Forkers

phm-aguiar

42_minishell's Issues

arquivo de supressão

{
   <Readline>
   Memcheck:Leak
   match-leak-kinds: reachable
   ...
   fun:readline
   ...
}
{
   <Readline/AddHistory>
   Memcheck:Leak
   match-leak-kinds: reachable
   fun:malloc
   ...
   fun:add_history
   ...
}

ainda quero resolver o problema do erro

Structs

typedef struct s_command
{
	char				*executable;
	char				**arguments;
	char				**env;
	int					background;
	struct s_command	*next;
}						t_command;

/**
 * @brief Enumeração que representa o tipo de token
 * @param TOKEN_WORD Palavra
 * @param TOKEN_REDIRECTION Redirecionamento (<, >, >>)
 * @param TOKEN_PIPE Pipe (|)
 * @param TOKEN_BACKGROUND Background (&)
 */
typedef enum e_token_type
{
	TOKEN_WORD,
	TOKEN_REDIRECTION,
	TOKEN_PIPE,
	TOKEN_BACKGROUND,
	TOKEN_HERE_DOC
}						t_token_type;

typedef struct s_token
{
	char				*value;
	t_token_type		type;
}						t_token;

/**
 * @brief Estrutura que representa uma pipeline

 * @param commands Lista de comandos
 * @param num_commands Número de comandos na pipeline
*/

typedef struct s_pipeline
{
	t_command			**commands;
	int					num_commands;
}						t_pipeline;

/**
 * @brief Estrutura que representa um redirecionamento

 * @param file Nome do arquivo para redirecionamento
 * @param type Tipo de redirecionamento (entrada/saída)
*/

typedef struct s_redirection
{
	char				*file;
	int					type;
}						t_redirection;

/**
 * @brief Estrutura que representa um job

 * @param pipeline Sequência de comandos
 * @param input Redirecionamento de entrada
 * @param output Redirecionamento de saída
*/

typedef struct s_job
{
	t_pipeline			*pipeline;
	t_redirection		*input;
	t_redirection		*output;
}						t_job;

/**
 * @brief Estrutura que representa um ambiente

 * @param variables Lista de variáveis de ambiente
 * @param size Número de variáveis de ambiente
 * @param capacity Capacidade máxima da lista de variáveis
*/

typedef struct s_environment
{
	char				**variables;
	int					size;
	int					capacity;
}						t_environment;

/**
 * @brief Estrutura que representa um processo

 * @param pid PID do processo
 * @param status Status do processo
*/

typedef struct s_process
{
	pid_t				pid;
	int					status;
}						t_process;

/**
 * @brief Estrutura que contem o signal
 * @param action Ação a ser executada
 */

typedef struct s_minishell
{
	t_environment		*env;
	t_command			*command;
	t_pipeline			*pipeline;
	t_redirection		*redirection;
	t_job				*job;
	t_process			*process;
	t_token				input[1024];
	char				*built_in[8];
}						t_minishell;

atualmente essas structs estão em analise

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.