diff --git a/README.md b/README.md index da0883a..9847e8c 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -# fish - Yet another shell with C +# dish - Yet another shell with C # TODO -- [x] History save - [x] Environment variable settings +- [ ] History save - [ ] Color - [ ] Completion - [ ] Config dotfile support diff --git a/line.c b/line.c index 47a81c9..8df7b91 100644 --- a/line.c +++ b/line.c @@ -1,16 +1,13 @@ /* * @Author: 1ridic * @Date: 2022-09-18 14:14:05 - * @Last Modified by: 1ridic - * @Last Modified time: 2022-09-18 22:08:27 + * @Last Modified by: 1ridic + * @Last Modified time: 2022-09-18 14:14:05 */ #include "line.h" #include #include #include -#include - -FILE *hf = NULL; char *readLine(void) { int bufsize = LINE_BUF_SIZE; @@ -29,8 +26,6 @@ char *readLine(void) { // repleace EOF with a null character and return if (c == EOF || c == '\n') { buffer[position] = '\0'; - time_t tick=time(NULL); - fprintf(hf,"%d:%s\n",(int)tick,buffer); return buffer; } else { buffer[position] = c; diff --git a/main.c b/main.c index 6316679..4403875 100644 --- a/main.c +++ b/main.c @@ -19,9 +19,7 @@ void intHandler(int dummy) { if (isWaiting==1) { return; } - extern FILE* hf; - fprintf(stderr,"\nSIGINT exit."); - fclose(hf); + fprintf(stderr,"\nSIGINT exit.\n"); exit(EXIT_FAILURE); } @@ -31,18 +29,11 @@ int main(int argc, char *argv[]) { signal(SIGINT, intHandler); /* clear screen */ fprintf(stdout,"\033[H\033[J"); - /* open history file */ - extern FILE* hf; - const char* hf_path=strcat(getenv("HOME"), "/.dish_history"); - hf = fopen(hf_path, "a+"); - #ifdef DEBUG fprintf(stdout,"DEBUG is defined\n"); #endif while (1) { loop(); } - - fclose(hf); return 0; -} \ No newline at end of file +}