fix(history): fix history file write bug

This commit is contained in:
iridiumR 2022-09-18 22:35:31 +08:00
parent e0c5cab7c8
commit 54ea6337e9
No known key found for this signature in database
GPG key ID: 5574BE4450D55618

4
main.c
View file

@ -2,7 +2,7 @@
* @Author: 1ridic * @Author: 1ridic
* @Date: 2022-09-18 14:13:59 * @Date: 2022-09-18 14:13:59
* @Last Modified by: 1ridic * @Last Modified by: 1ridic
* @Last Modified time: 2022-09-18 22:01:12 * @Last Modified time: 2022-09-18 22:34:28
*/ */
#include <signal.h> #include <signal.h>
#include <stdio.h> #include <stdio.h>
@ -33,7 +33,7 @@ int main(int argc, char *argv[]) {
fprintf(stdout,"\033[H\033[J"); fprintf(stdout,"\033[H\033[J");
/* open history file */ /* open history file */
extern FILE* hf; extern FILE* hf;
hf = fopen(strcat(getenv("HOME"), "/.dish_history"), "w"); hf = fopen(strcat(getenv("HOME"), "/.dish_history"), "a+");
#ifdef DEBUG #ifdef DEBUG
fprintf(stdout,"DEBUG is defined\n"); fprintf(stdout,"DEBUG is defined\n");