From 201fa8ea2bed703dd1187550f94892b9ee82a00d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sosth=C3=A8ne=20Gu=C3=A9don?= Date: Sun, 16 Jun 2019 11:40:18 +0200 Subject: Make the location of sc-imfo easier to change --- src/history.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'src/history.c') diff --git a/src/history.c b/src/history.c index 64fd77f..b1dcfd2 100644 --- a/src/history.c +++ b/src/history.c @@ -157,8 +157,7 @@ void load_history(struct history * h, wchar_t mode) { FILE * f; if ((home = getenv("HOME"))) { - sprintf(infofile, "%s/", home); - strcat(infofile, HISTORY_FILE); + sprintf(infofile, "%s/%s/%s", home,HISTORY_FOLDER,HISTORY_FILE); if ((c = open(infofile, O_RDONLY)) > -1) { close(c); f = fopen(infofile, "r"); @@ -196,11 +195,9 @@ int save_history(struct history * h, char * mode) { struct hlist * nl = h->list; if ((home = getenv("HOME"))) { char history_folder[PATHLEN]; - sprintf(history_folder, "%s/", home); - strcat(history_folder, HISTORY_FOLDER); + sprintf(history_folder, "%s/%s", home,HISTORY_FOLDER); mkdir(history_folder,0777); - sprintf(infofile, "%s/", home); - strcat(infofile, HISTORY_FILE); + sprintf(infofile, "%s/%s/%s", home,HISTORY_FOLDER,HISTORY_FILE); f = fopen(infofile, mode); if (f == NULL) return 0; // Go to the end -- cgit v1.2.3