Correction

This commit is contained in:
Etienne Rey-bethbeder 2023-04-07 13:26:05 +02:00
parent 8a2eb85dc6
commit e65a9f32c0
6 changed files with 6 additions and 60 deletions

View File

@ -1,40 +0,0 @@
# Minishell
Minishell is a 42 School project that involves creating a minimalistic shell in C language. The shell should be able to handle basic commands, manage environment variables and implement several built-in functions.
## Features
- Prompt management (display, editing, history)
- Command execution (with or without arguments)
- Basic shell operations (pipes, redirections)
- Environment variables management (listing, setting, unsetting)
- Built-in functions management (echo, cd, env, exit, export, pwd, unset)
## Getting started
1. Clone this repository: `git clone https://github.com/<your_username>/minishell.git`
2. `cd` into the cloned directory: `cd minishell`
3. Run the `make` command to compile the program: `make`
4. Start the shell by running the executable: `./minishell`
## Usage
Once the shell is started, you can enter commands as you would with any other shell. The following are some examples of commands that can be executed:
- Display the working directory: `pwd`
- Change directory: `cd <directory_name>`
- Print the value of an environment variable: `echo $<variable_name>`
- Set an environment variable: `export <variable_name>=<value>`
- Unset an environment variable: `unset <variable_name>`
- Display a list of environment variables: `env`
- Exit the shell: `exit`
## Resources
- ![The project subject](./subject.pdf)
- The C library documentation for the standard library functions used in the program
- bash man
## Authors
This project was created by [Camille CHAUVET](mailto:camille@chauvet.pro) and [Xamora](mailto:ogame.xamora@42l.fr). If you have any questions or suggestions, feel free to contact us.

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */ /* By: cchauvet <cchauvet@student.42angouleme.fr +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/03/27 13:41:42 by cchauvet #+# #+# */ /* Created: 2023/03/27 13:41:42 by cchauvet #+# #+# */
/* Updated: 2023/03/27 13:41:44 by cchauvet ### ########.fr */ /* Updated: 2023/03/31 20:07:36 by erey-bet ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */

View File

@ -6,7 +6,7 @@
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */ /* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/22 13:28:27 by erey-bet #+# #+# */ /* Created: 2023/02/22 13:28:27 by erey-bet #+# #+# */
/* Updated: 2023/03/30 15:07:10 by erey-bet ### ########.fr */ /* Updated: 2023/04/07 12:46:28 by erey-bet ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -16,7 +16,7 @@ int error(char *str, int fd)
{ {
write(fd, "bozoshell: unset: `", 19); write(fd, "bozoshell: unset: `", 19);
write(fd, str, ft_strlen(str)); write(fd, str, ft_strlen(str));
write(fd, "': not a valid identifier", 25); write(fd, "': not a valid identifier\n", 26);
return (1); return (1);
} }

5
env/env3.c vendored
View File

@ -6,7 +6,7 @@
/* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */ /* By: erey-bet <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/17 17:25:09 by erey-bet #+# #+# */ /* Created: 2023/02/17 17:25:09 by erey-bet #+# #+# */
/* Updated: 2023/03/30 12:51:54 by erey-bet ### ########.fr */ /* Updated: 2023/04/07 13:21:54 by erey-bet ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -70,6 +70,7 @@ int delete_by_key(char *key, t_list **head)
t_list *current; t_list *current;
current = *head; current = *head;
last = NULL;
while (current->next != NULL) while (current->next != NULL)
{ {
if (ft_strcmp(((t_env *)current->content)->key, key) == 0) if (ft_strcmp(((t_env *)current->content)->key, key) == 0)
@ -77,7 +78,7 @@ int delete_by_key(char *key, t_list **head)
free(((t_env *)current->content)->key); free(((t_env *)current->content)->key);
free(((t_env *)current->content)->value); free(((t_env *)current->content)->value);
free(current->content); free(current->content);
if (last->next != NULL) if (last && last->next)
last->next = current->next; last->next = current->next;
else else
*head = current->next; *head = current->next;

Binary file not shown.

15
vsupp
View File

@ -1,15 +0,0 @@
{
readline
Memcheck:Leak
...
fun:readline
...
}
{
readline
Memcheck:Leak
...
fun:add_history
...
}