From 504303f5e4b384ed773b89788ac2c01f2023005b Mon Sep 17 00:00:00 2001 From: ygor-sena Date: Thu, 4 Apr 2024 13:06:27 -0300 Subject: [PATCH 1/3] docs: add 9th revision of README --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 89cff19..7e35f77 100644 --- a/README.md +++ b/README.md @@ -13,20 +13,20 @@ The 8th project of 42 cursus syllabus asks students to implement a simplified shell. It's about minishell, as beautiful as a shell. -As the project's subject states, the existence of shells is linked to the very existence of IT. At the time, al developers agreed that _communicating with a computer using aligned 1/0 swiches was seriously irritating_. It was only logical that they came up with the idea of creating a software to communicate with a computer using interactive lines of commands in a language somehat close to the human language. +As the project's subject states, the existence of shells is linked to the very existence of IT. At the time, all developers agreed that _communicating with a computer using aligned 1/0 swiches was seriously irritating_. It was only logical that they came up with the idea of creating a software to communicate with a computer using interactive lines of commands in a language somewhat close to the human language. ## How to compile and run the project #### 1) Copy this repository to your local workstation ```html -git@github.com:magalhaesm/minishell.git +git clone https://github.com/magalhaesm/minishell.git ``` #### 2) Install the required libraries to run the functions from readline library ```html -sudo apt-get install libreadline6 libreadline6-dev +sudo apt-get install -y libreadline6 libreadline6-dev ``` #### 3) Compile the project with Makefile From 98c7282f1b342b6670e4e545e7c12a0592e43aa4 Mon Sep 17 00:00:00 2001 From: ygor-sena Date: Thu, 4 Apr 2024 13:07:38 -0300 Subject: [PATCH 2/3] ci: pin workflow to norminette v3.3.51 --- .github/workflows/unit_tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 64eee9c..5a70843 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -26,11 +26,11 @@ jobs: - uses: actions/checkout@v3 # Runs a set of commands using the runners shell - - name: Set up Criterion framework on Ubuntu 22.04 + - name: Set up Criterion framework and norminette on Ubuntu 22.04 run: | - sudo apt-get install libcriterion-dev + sudo apt-get install -y libcriterion-dev python3 -m pip install --upgrade pip setuptools - python3 -m pip install norminette + python3 -m pip install norminette==3.3.51 # Runs a single command using the runners shell - name: Run norminette validation run: norminette include src From c9d731a8e002122638f87685c18147012cfb0e68 Mon Sep 17 00:00:00 2001 From: ygor-sena Date: Thu, 4 Apr 2024 13:10:13 -0300 Subject: [PATCH 3/3] chore: standardize code formatting to norminette v3.3.55 --- include/exec.h | 7 ++++--- include/parser.h | 7 ++++--- include/tree.h | 16 ++++++++++------ src/builtins/cd.c | 4 ++-- src/table/hash_table.c | 6 +++--- 5 files changed, 23 insertions(+), 17 deletions(-) diff --git a/include/exec.h b/include/exec.h index 31fecf4..2e61aeb 100644 --- a/include/exec.h +++ b/include/exec.h @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* exec.h :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: mdias-ma +#+ +:+ +#+ */ +/* By: yde-goes +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/12/13 11:45:35 by mdias-ma #+# #+# */ -/* Updated: 2023/01/20 17:57:26 by mdias-ma ### ########.fr */ +/* Updated: 2024/04/04 13:07:57 by yde-goes ### ########.fr */ /* */ /* ************************************************************************** */ @@ -27,7 +27,8 @@ # define PIPE_LIMIT 1024 # define HEREDOC_TEMPFILE "/tmp/heredoc_tempfile" -typedef struct s_context { +typedef struct s_context +{ int fd[2]; int pid[PIPE_LIMIT]; int fd_close; diff --git a/include/parser.h b/include/parser.h index 9855161..bd54afd 100644 --- a/include/parser.h +++ b/include/parser.h @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* parser.h :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: mdias-ma +#+ +:+ +#+ */ +/* By: yde-goes +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/11/24 09:49:48 by mdias-ma #+# #+# */ -/* Updated: 2022/12/21 14:40:55 by mdias-ma ### ########.fr */ +/* Updated: 2024/04/04 13:08:39 by yde-goes ### ########.fr */ /* */ /* ************************************************************************** */ @@ -16,7 +16,8 @@ # include "scanner.h" # include "tree.h" -typedef enum e_nonterminal { +typedef enum e_nonterminal +{ LIST = 0, PIPELINE = LIST, CMD = LIST, diff --git a/include/tree.h b/include/tree.h index 16664a3..743ea5d 100644 --- a/include/tree.h +++ b/include/tree.h @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* tree.h :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: mdias-ma +#+ +:+ +#+ */ +/* By: yde-goes +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/11/30 15:36:15 by mdias-ma #+# #+# */ -/* Updated: 2022/12/24 11:03:19 by mdias-ma ### ########.fr */ +/* Updated: 2024/04/04 13:08:10 by yde-goes ### ########.fr */ /* */ /* ************************************************************************** */ @@ -15,7 +15,8 @@ # include "scanner.h" -typedef enum e_node_type { +typedef enum e_node_type +{ COMMAND, AND, OR, @@ -30,17 +31,20 @@ typedef enum e_node_type { typedef struct s_node t_node; typedef char ** t_command; -typedef struct s_operand { +typedef struct s_operand +{ t_node *left; t_node *right; } t_operand; -typedef union u_node_value { +typedef union u_node_value +{ t_command cmd; t_operand pair; } t_node_value; -typedef struct s_node { +typedef struct s_node +{ t_node_type type; t_node_value data; } t_node; diff --git a/src/builtins/cd.c b/src/builtins/cd.c index 4d9ca78..82cc9cd 100644 --- a/src/builtins/cd.c +++ b/src/builtins/cd.c @@ -6,7 +6,7 @@ /* By: yde-goes +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/12/24 19:00:09 by yde-goes #+# #+# */ -/* Updated: 2023/01/01 19:15:34 by mdias-ma ### ########.fr */ +/* Updated: 2024/04/04 13:08:29 by yde-goes ### ########.fr */ /* */ /* ************************************************************************** */ @@ -69,7 +69,7 @@ static char *handle_special_cd(char **args) { getcwd(pwd, PATH_MAX); return (pwd); - } + } else if (arg_len == 2 && ft_strncmp(args[1], "..", 2) == 0) dir_param = ".."; return (dir_param); diff --git a/src/table/hash_table.c b/src/table/hash_table.c index 0726e32..36df114 100644 --- a/src/table/hash_table.c +++ b/src/table/hash_table.c @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* hash_table.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: mdias-ma +#+ +:+ +#+ */ +/* By: yde-goes +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2022/11/09 17:39:31 by mdias-ma #+# #+# */ -/* Updated: 2022/12/15 21:10:47 by mdias-ma ### ########.fr */ +/* Updated: 2024/04/04 13:08:21 by yde-goes ### ########.fr */ /* */ /* ************************************************************************** */ @@ -56,7 +56,7 @@ t_entry *find_entry(t_entry *entries, int capacity, char *key) return (entry); } else if (tombstone == NULL) - tombstone = entry; + tombstone = entry; } else if (ft_strncmp(entry->key, key, ft_strlen(key)) == 0) return (entry);