Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
.DS_Store
main
main
a.out
*.dSYM
22 changes: 22 additions & 0 deletions history.c
Original file line number Diff line number Diff line change
@@ -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;
}
2 changes: 2 additions & 0 deletions include/minishell.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
#include <unistd.h>
#include "./builtin.h"
#include <string.h>
#include <readline/readline.h>
#include <readline/history.h>