summaryrefslogtreecommitdiffstats
path: root/src/history.c
diff options
context:
space:
mode:
authorSosthène Guédon <sosthene.gued@gmail.com>2019-06-16 11:40:18 +0200
committerSosthène Guédon <sosthene.gued@gmail.com>2019-06-16 11:40:18 +0200
commit201fa8ea2bed703dd1187550f94892b9ee82a00d (patch)
tree761edb60f69407aa2e0c112fc76986b9e36a018f /src/history.c
parent6f1f41ffe3283a0bbfe2c2f745d348c30be2adbf (diff)
Make the location of sc-imfo easier to change
Diffstat (limited to 'src/history.c')
-rw-r--r--src/history.c9
1 files changed, 3 insertions, 6 deletions
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