diff options
| -rw-r--r-- | Makefile | 12 | ||||
| -rw-r--r-- | README.md | 42 | ||||
| -rw-r--r-- | include/minishell.h | 29 | ||||
| m--------- | libft | 0 | ||||
| -rw-r--r-- | src/main.c | 18 | ||||
| -rw-r--r-- | subject.pdf | bin | 1275144 -> 1544202 bytes | |||
| -rwxr-xr-x | test.sh | 2 |
7 files changed, 101 insertions, 2 deletions
@@ -1,3 +1,15 @@ +# **************************************************************************** # +# # +# ::: :::::::: # +# Makefile :+: :+: :+: # +# +:+ +:+ +:+ # +# By: cacharle <marvin@42.fr> +#+ +:+ +#+ # +# +#+#+#+#+#+ +#+ # +# Created: 2020/02/03 04:14:24 by cacharle #+# #+# # +# Updated: 2020/02/03 04:14:25 by cacharle ### ########.fr # +# # +# **************************************************************************** # + RM = rm -f MAKE = make @@ -1,3 +1,45 @@ # minishell minishell project of school 42 + +## Testing + +``` +>make test +``` + +## TODO + +### Mandatory + +- [ ] Show a prompt when waiting for a new command +- [ ] Search and launch the right executable (based on the *PATH* variable or by using relative or absolute path) like in bash @HappyTramp +- [ ] It must implement the builtins like in bash: @nass1pro + - [ ] `echo` with option `-n` + - [ ] `cd` without `-` option + - [ ] `pwd` without any options + - [ ] `export` without any options + - [ ] `unset` without any options + - [ ] `env` without any options and any arguments + - [ ] `exit` without any options +- [ ] `;` in the command should separate commands like in bash +- [ ] `'` and `"` should work like in bash except for multiline commands +- [ ] Redirections `<` `>` `>>` should work like in bash except for file descriptor aggregation +- [ ] Pipes | should work like in bash +- [ ] Environment variables (`$` followed by characters) should work like in bash +- [ ] `$?` should work like in bash +- [ ] `ctrl-C`, `ctrl-D` and `ctrl-\` should have the same result as in bash + +### Bonus + +- [ ] Redirection `<<` like in bash +- [ ] History and line editing with Termcaps (`man tgetent` for examples) + - [ ] Edit the line where the cursor is located. + - [ ] Move the cursor left and right to be able to edit the line at a specific location. Obviously new characters have to be inserted between the existing ones similarly to a classic shell. + - [ ] Use up and down arrows to navigate through the command history which we will then be able to edit if we feel like it (the line, not the history). + - [ ] Cut, copy, and/or paste all or part of a line using the key sequence you prefer. + - [ ] Move directly by word towards the left or the right using ctrl+LEFT and ctrl+RIGHT. + - [ ] Go directly to the beginning or the end of a line by pressing `home` and `end`. + - [ ] Write AND edit a command over a few lines. In that case, we would love that ctrl+UP and ctrl+DOWN allow to go from one line to another in the command while remaining in the same column or otherwise the most appropriate column. +- [ ] &&, || with parenthesis for priorities, like in bash +- [ ] wilcard * like in bash diff --git a/include/minishell.h b/include/minishell.h index 2dc9a38..f47fc65 100644 --- a/include/minishell.h +++ b/include/minishell.h @@ -2,5 +2,34 @@ # define MINISHELL_H # include "libft.h" +# include "libft_ht.h" + + +typedef struct +{ + int argc; + char **argv; +} t_command; + +// void find_exe(char *name); + +typedef int t_status; + +/* +** +*/ + +/* +** builtin*.c +*/ + +typedef t_status (*t_builtin_func)(int argc, char **argv, char **envp); +t_builtin_func ms_echo; +t_builtin_func ms_cd; +t_builtin_func ms_pwd; +t_builtin_func ms_export; +t_builtin_func ms_unset; +t_builtin_func ms_env; +t_builtin_func ms_exit; #endif diff --git a/libft b/libft -Subproject fe37597119353ce183fc404417b81bd4702f64b +Subproject 08e90bf28afbad52e9768469304c8eec08a5d80 @@ -1,7 +1,21 @@ #include "minishell.h" -int main(void) +int main(int argc, char **argv, char **envp) { - ft_putendl("Hello world"); + + // init + // find executable in PATH + + // user_loop + // get user input + // parse input + // if error: + // continue + // interpret command + // waiting for process to end + + // destroy + + return (0); } diff --git a/subject.pdf b/subject.pdf Binary files differindex caeda22..da124ad 100644 --- a/subject.pdf +++ b/subject.pdf @@ -10,3 +10,5 @@ green() { } echo "minishell test" + +echo "echo -n bonjour" | ./minishell |
