This project aim to recreate the C readline library, it main functions and functionality
In the original library, readline() leaks a lot, so I decided to redo it WITHOUT any leaks
char *readline(char *prompt, int ret);
void add_history(char *line);
void clear_history(void);
readline() takes two arguments, a string (prompt) and an int (ret). Both are use to make the prompt: ret to take account a value (return value for example), and prompt to write watever you want as prompt
add_history() take one argument and it add the line to the history file (.rdlrc/history)
clear_history() reset the history file (.rdlrc/history)
- auto-completion and Tab [shows the different results or changes the word if there is only one possibility]
- history with directional keys (up and down) [the history is preserved even if you quit the programm thanks to history file .rdlrc/,history]
make--> compile a library "libreadline.a"make test--> compile the C file test.c to test the function into "test"make clean--> delete .o filesmake fclean--> delete .o files, the library and testmake dclean--> delete the directory .rdlrc/
If you want to link this library, just include the header file and link the static library
# include "./readline/readline.h"
${GCC} ${FLAGS} file.c -c
${GCC} ${FLAGS} *.o -L. -lreadline
Date: 27 Jul 2023