diff --git a/.gitignore b/.gitignore index ddc98a8..430d710 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ .DS_Store -main \ No newline at end of file +main +a.out +*.dSYM \ No newline at end of file diff --git a/history.c b/history.c new file mode 100644 index 0000000..f0d20aa --- /dev/null +++ b/history.c @@ -0,0 +1,22 @@ +#include "include/minishell.h" +//gcc history.c -lreadlineでコンパイル +int main() +{ + char *command; + + command = NULL; + while (1) + { + command = readline("6shell> "); + if (command == NULL || strlen(command) == 0) + { + free(command); + break; + } + //printf("command is '%s'\n", command); + add_history(command); + //コマンドの処理 + free(command); + } + return 0; +} \ No newline at end of file diff --git a/include/minishell.h b/include/minishell.h index 4f4e36e..0dca7d5 100644 --- a/include/minishell.h +++ b/include/minishell.h @@ -4,3 +4,5 @@ #include #include "./builtin.h" #include +#include +#include