Compare commits

...

3 Commits

Author SHA1 Message Date
Camille Chauvet
e709eb0dbb norm 2023-02-17 18:24:24 +01:00
Camille Chauvet
3ce5b64420 Merge branch 'master' of git.chauvet.pro:starnakin/minishell 2023-02-17 18:23:26 +01:00
Camille Chauvet
a183971a7a bozo 2023-02-17 18:23:17 +01:00
7 changed files with 178 additions and 32 deletions

BIN
.minishell.h.swp Normal file

Binary file not shown.

2
cmd.c
View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/15 14:18:21 by cchauvet #+# #+# */
/* Updated: 2023/02/16 18:25:14 by cchauvet ### ########.fr */
/* Updated: 2023/02/17 17:30:22 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/16 16:29:08 by cchauvet #+# #+# */
/* Updated: 2023/02/17 13:41:51 by cchauvet ### ########.fr */
/* Updated: 2023/02/17 17:31:16 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
@ -55,7 +55,8 @@ char *ft_env_filler(t_list **env, const char *str)
while (out[i] == '$')
{
y = i + 1;
while (out[y] != '\0' && out[y] != '$' && out[y] != ' ')
while (out[y] != '\0' && out[y] != '$' && out[y] != ' '
&& out[y] != '"')
y++;
value = ft_get_value(env, out, i + 1, y - i - 1);
if (value == NULL)

14
main.c
View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/16 15:16:14 by cchauvet #+# #+# */
/* Updated: 2023/02/17 16:06:02 by cchauvet ### ########.fr */
/* Updated: 2023/02/17 18:22:52 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
@ -91,9 +91,6 @@ int main(int ac, char **av, char **env)
data.env = init_env(env);
if (data.env == NULL)
return (1);
free(data.env);
return (1);
}
if (ft_minishell(data.env, av[1]) == 1)
{
ft_lstclear(data.env, env_del);
@ -102,7 +99,6 @@ int main(int ac, char **av, char **env)
}
ft_lstclear(data.env, env_del);
free(data.env);
free(line);
return (0);
}
@ -127,13 +123,7 @@ int main(int ac, char **av, char **env)
}
while (line != NULL)
{
if (ft_minishell(data.env, line) == 1)
{
ft_lstclear(data.env, env_del);
free(data.env);
free(line);
return (1);
}
ft_minishell(data.env, line);
free(line);
line = ft_get_user_input(data.env);
if (line == NULL)

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/14 13:45:30 by cchauvet #+# #+# */
/* Updated: 2023/02/17 16:52:41 by erey-bet ### ########.fr */
/* Updated: 2023/02/17 18:24:08 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
@ -21,7 +21,8 @@
# include <stdio.h>
# include <readline/readline.h>
# include <readline/history.h>
# define DEBUG 0
# define DEBUG 1
int ft_syntatic_verif(const char *str);
int ft_file_is_readable(const char *path);
int ft_file_is_writable(const char *path);
@ -42,23 +43,23 @@ char *ft_env_filler(t_list **env, const char *str);
char **env_to_strs(t_list **head);
/* Environnement */
t_list **init_env(char **env);
char **env_to_strs(t_list **head);
int create_value_by_key(char *key, char *value, t_list **head);
int set_value_by_key(char *key, char *value, t_list **head);
char *get_value_by_key(char *key, t_list **head);
int get_index(char *s, char c);
void swap_env_3(void **a, void **b, void **c);
void swap_env(void **a, void **b);
void env_del(void *ptr);
char **env_to_strs(t_list **head);
char *get_value(char *str);
char *get_key(char *str);
t_list **init_env(char **env);
char **env_to_strs(t_list **head);
int create_value_by_key(char *key, char *value, t_list **head);
int set_value_by_key(char *key, char *value, t_list **head);
char *get_value_by_key(char *key, t_list **head);
int get_index(char *s, char c);
void swap_env_3(void **a, void **b, void **c);
void swap_env(void **a, void **b);
void env_del(void *ptr);
char **env_to_strs(t_list **head);
char *get_value(char *str);
char *get_key(char *str);
/* Echo */
int echo(int fd, char *str);
int echo(int fd, char *str);
/* PWD */
int pwd(t_list **env, int fd);
int pwd(t_list **env, int fd);
typedef struct s_cmd
{

1
t
View File

@ -1 +0,0 @@
bozt

155
test.sh Normal file
View File

@ -0,0 +1,155 @@
# MINISHELL-TESTER
RESET="\033[0m"
BLACK="\033[30m"
RED="\033[31m"
GREEN="\033[32m"
YELLOW="\033[33m"
BLUE="\033[34m"
MAGENTA="\033[35m"
CYAN="\033[36m"
WHITE="\033[37m"
BOLDBLACK="\033[1m\033[30m"
BOLDRED="\033[1m\033[31m"
BOLDGREEN="\033[1m\033[32m"
BOLDYELLOW="\033[1m\033[33m"
BOLDBLUE="\033[1m\033[34m"
BOLDMAGENTA="\033[1m\033[35m"
BOLDCYAN="\033[1m\033[36m"
BOLDWHITE="\033[1m\033[37m"
# Compile and set executable rights
make -C ../ > /dev/null
cp ../minishell .
chmod 755 minishell
function exec_test()
{
TEST1=$(echo $@ "; exit" | ./minishell 2>&-)
ES_1=$?
TEST2=$(echo $@ "; exit" | bash 2>&-)
ES_2=$?
if [ "$TEST1" == "$TEST2" ] && [ "$ES_1" == "$ES_2" ]; then
printf " $BOLDGREEN%s$RESET" "✓ "
else
printf " $BOLDRED%s$RESET" "✗ "
fi
printf "$CYAN \"$@\" $RESET"
if [ "$TEST1" != "$TEST2" ]; then
echo
echo
printf $BOLDRED"Your output : \n%.20s\n$BOLDRED$TEST1\n%.20s$RESET\n" "-----------------------------------------" "-----------------------------------------"
printf $BOLDGREEN"Expected output : \n%.20s\n$BOLDGREEN$TEST2\n%.20s$RESET\n" "-----------------------------------------" "-----------------------------------------"
fi
if [ "$ES_1" != "$ES_2" ]; then
echo
echo
printf $BOLDRED"Your exit status : $BOLDRED$ES_1$RESET\n"
printf $BOLDGREEN"Expected exit status : $BOLDGREEN$ES_2$RESET\n"
fi
echo
sleep 0.1
}
printf "$BOLDMAGENTA __ __ _____ _ _ _____ _____ _ _ ______ _ _ \n"
printf "| \/ |_ _| \ | |_ _|/ ____| | | | ____| | | | \n"
printf "| \ / | | | | \| | | | | (___ | |__| | |__ | | | | \n"
printf "| |\/| | | | | . \` | | | \___ \| __ | __| | | | | \n"
printf "| | | |_| |_| |\ |_| |_ ____) | | | | |____| |____| |____ \n"
printf "|_| |_|_____|_| \_|_____|_____/|_| |_|______|______|______|\n$RESET"
echo
# ECHO TESTS
exec_test 'echo test tout'
exec_test 'echo test tout'
exec_test 'echo -n test tout'
exec_test 'echo -n -n -n test tout'
# CD TESTS
exec_test 'cd .. ; pwd'
exec_test 'cd /Users ; pwd'
exec_test 'cd ; pwd'
exec_test 'mkdir test_dir ; cd test_dir ; rm -rf ../test_dir ; cd . ; pwd ; cd . ; pwd ; cd .. ; pwd'
# PIPE TESTS
exec_test 'cat tests/lorem.txt | grep arcu | cat -e'
exec_test 'echo test | cat -e | cat -e | cat -e | cat -e | cat -e | cat -e | cat -e | cat -e | cat -e | cat -e| cat -e| cat -e| cat -e| cat -e| cat -e| cat -e| cat -e| cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e|cat -e'
exec_test 'cat /dev/random | head -c 100 | wc -c'
exec_test 'ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|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|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls|ls'
# ENV EXPANSIONS + ESCAPE
exec_test 'echo test \ test'
exec_test 'echo \"test'
exec_test 'echo $TEST'
exec_test 'echo "$TEST"'
exec_test "echo '$TEST'"
exec_test 'echo "$TEST$TEST$TEST"'
exec_test 'echo "$TEST$TEST=lol$TEST"'
exec_test 'echo " $TEST lol $TEST"'
exec_test 'echo $TEST$TEST$TEST'
exec_test 'echo $TEST$TEST=lol$TEST""lol'
exec_test 'echo $TEST lol $TEST'
exec_test 'echo test "" test "" test'
exec_test 'echo "\$TEST"'
exec_test 'echo "$=TEST"'
exec_test 'echo "$"'
exec_test 'echo "$?TEST"'
exec_test 'echo $TEST $TEST'
exec_test 'echo "$1TEST"'
exec_test 'echo "$T1TEST"'
# ENV EXPANSIONS
ENV_SHOW="env | sort | grep -v SHLVL | grep -v _="
EXPORT_SHOW="export | sort | grep -v SHLVL | grep -v _= | grep -v OLDPWD"
exec_test 'export ='
exec_test 'export 1TEST= ;' $ENV_SHOW
exec_test 'export TEST ;' $EXPORT_SHOW
exec_test 'export ""="" ; ' $ENV_SHOW
exec_test 'export TES=T="" ;' $ENV_SHOW
exec_test 'export TE+S=T="" ;' $ENV_SHOW
exec_test 'export TEST=LOL ; echo $TEST ;' $ENV_SHOW
exec_test 'export TEST=LOL ; echo $TEST$TEST$TEST=lol$TEST'
exec_test 'export TEST=LOL; export TEST+=LOL ; echo $TEST ;' $ENV_SHOW
exec_test $ENV_SHOW
exec_test $EXPORT_SHOW
exec_test 'export TEST="ls -l - a" ; echo $TEST ; $LS ; ' $ENV_SHOW
# REDIRECTIONS
exec_test 'echo test > ls ; cat ls'
exec_test 'echo test > ls >> ls >> ls ; echo test >> ls; cat ls'
exec_test '> lol echo test lol; cat lol'
exec_test '>lol echo > test>lol>test>>lol>test mdr >lol test >test; cat test'
exec_test 'cat < ls'
exec_test 'cat < ls > ls'
# MULTI TESTS
exec_test 'echo testing multi ; echo "test 1 ; | and 2" ; cat tests/lorem.txt | grep Lorem'
# SYNTAX ERROR
exec_test ';; test'
exec_test '| test'
exec_test 'echo > <'
exec_test 'echo | |'
exec_test '<'
# EXIT
exec_test "exit 42"
exec_test "exit 42 53 68"
exec_test "exit 259"
exec_test "exit 9223372036854775807"
exec_test "exit -9223372036854775808"
exec_test "exit 9223372036854775808"
exec_test "exit -9223372036854775810"
exec_test "exit -4"
exec_test "exit wrong"
exec_test "exit wrong_command"
exec_test "gdagadgag"
exec_test "ls -Z"
exec_test "cd gdhahahad"
exec_test "ls -la | wtf"
rm lol ls test