Let loadHistory return an error code
This is in preparation for a following patch.
This commit is contained in:
@@ -31,16 +31,16 @@ historyBuffer(Hist *hist)
|
|||||||
return loadHTMLString(src);
|
return loadHTMLString(src);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
int
|
||||||
loadHistory(Hist *hist)
|
loadHistory(Hist *hist)
|
||||||
{
|
{
|
||||||
FILE *f;
|
FILE *f;
|
||||||
Str line;
|
Str line;
|
||||||
|
|
||||||
if (hist == NULL)
|
if (hist == NULL)
|
||||||
return;
|
return 1;
|
||||||
if ((f = fopen(rcFile(HISTORY_FILE), "rt")) == NULL)
|
if ((f = fopen(rcFile(HISTORY_FILE), "rt")) == NULL)
|
||||||
return;
|
return 1;
|
||||||
|
|
||||||
while (!feof(f)) {
|
while (!feof(f)) {
|
||||||
line = Strfgets(f);
|
line = Strfgets(f);
|
||||||
@@ -52,6 +52,7 @@ loadHistory(Hist *hist)
|
|||||||
pushHist(hist, url_quote(line->ptr));
|
pushHist(hist, url_quote(line->ptr));
|
||||||
}
|
}
|
||||||
fclose(f);
|
fclose(f);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
2
proto.h
2
proto.h
@@ -391,7 +391,7 @@ extern char *inputLineHistSearch(char *prompt, char *def_str, int flag,
|
|||||||
extern Str unescape_spaces(Str s);
|
extern Str unescape_spaces(Str s);
|
||||||
#ifdef USE_HISTORY
|
#ifdef USE_HISTORY
|
||||||
extern Buffer *historyBuffer(Hist *hist);
|
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 saveHistory(Hist *hist, size_t size);
|
||||||
extern void ldHist(void);
|
extern void ldHist(void);
|
||||||
#else /* not USE_HISTORY */
|
#else /* not USE_HISTORY */
|
||||||
|
|||||||
Reference in New Issue
Block a user