From f186e8331f361a96c4fd9c2d0d2410cc8d84bccf Mon Sep 17 00:00:00 2001 From: Rene Kita Date: Mon, 5 Sep 2022 11:53:40 +0200 Subject: [PATCH] Let loadHistory return an error code This is in preparation for a following patch. --- history.c | 7 ++++--- proto.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/history.c b/history.c index 4f6739c..0aeae12 100644 --- a/history.c +++ b/history.c @@ -31,16 +31,16 @@ historyBuffer(Hist *hist) return loadHTMLString(src); } -void +int loadHistory(Hist *hist) { FILE *f; Str line; if (hist == NULL) - return; + return 1; if ((f = fopen(rcFile(HISTORY_FILE), "rt")) == NULL) - return; + return 1; while (!feof(f)) { line = Strfgets(f); @@ -52,6 +52,7 @@ loadHistory(Hist *hist) pushHist(hist, url_quote(line->ptr)); } fclose(f); + return 0; } void diff --git a/proto.h b/proto.h index 3be7d22..dd7a0eb 100644 --- a/proto.h +++ b/proto.h @@ -391,7 +391,7 @@ extern char *inputLineHistSearch(char *prompt, char *def_str, int flag, extern Str unescape_spaces(Str s); #ifdef USE_HISTORY extern Buffer *historyBuffer(Hist *hist); -extern void loadHistory(Hist *hist); +extern int loadHistory(Hist *hist); extern void saveHistory(Hist *hist, size_t size); extern void ldHist(void); #else /* not USE_HISTORY */