commit 3ffefbfddcadd1787d2a2ca6551f8259d20b2c4f
parent 8637acb106f666dd454058f4d22045274d3259d5
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Mon, 25 Nov 2019 19:17:41 +0100
build: fix compilation for --enable-tiny --enable-histories
Diffstat:
4 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/src/global.c b/src/global.c
@@ -260,7 +260,9 @@ int menusymbols[NUMBER_OF_MENUS] = { MMAIN, MWHEREIS, MREPLACE, MREPLACEWITH,
MEXTCMD, MHELP, MSPELL, MLINTER,
MBROWSER, MWHEREISFILE, MGOTODIR,
MMOST|MBROWSER|MHELP|MYESNO };
+#endif
+#if defined(ENABLE_NANORC) || defined(ENABLE_HISTORIES)
char *startup_problem = NULL;
/* An error message (if any) about nanorc files or history files. */
#endif
diff --git a/src/nano.c b/src/nano.c
@@ -504,7 +504,7 @@ void finish(void)
/* Restore the old terminal settings. */
tcsetattr(0, TCSANOW, &original_state);
-#ifdef ENABLE_NANORC
+#if defined(ENABLE_NANORC) || defined(ENABLE_HISTORIES)
display_rcfile_errors();
#endif
diff --git a/src/proto.h b/src/proto.h
@@ -173,7 +173,7 @@ extern int interface_color_pair[NUMBER_OF_ELEMENTS];
extern char *homedir;
extern char *statedir;
-#ifdef ENABLE_NANORC
+#if defined(ENABLE_NANORC) || defined(ENABLE_HISTORIES)
extern char *startup_problem;
#endif
@@ -470,9 +470,11 @@ int do_prompt(bool allow_tabs, bool allow_files,
int do_yesno_prompt(bool all, const char *msg);
/* Most functions in rcfile.c. */
-#ifdef ENABLE_NANORC
+#if defined(ENABLE_NANORC) || defined(ENABLE_HISTORIES)
void display_rcfile_errors(void);
void jot_error(const char *msg, ...);
+#endif
+#ifdef ENABLE_NANORC
#ifdef ENABLE_COLOR
void parse_one_include(char *file, syntaxtype *syntax);
void grab_and_store(const char *kind, char *ptr, regexlisttype **storage);
diff --git a/src/rcfile.c b/src/rcfile.c
@@ -146,7 +146,9 @@ static bool seen_color_command = FALSE;
static colortype *lastcolor = NULL;
/* The end of the color list for the current syntax. */
#endif
+#endif /* ENABLE_NANORC */
+#if defined(ENABLE_NANORC) || defined(ENABLE_HISTORIES)
static linestruct *errors_head = NULL;
static linestruct *errors_tail = NULL;
/* Beginning and end of a list of errors in rcfiles, if any. */
@@ -175,17 +177,19 @@ void jot_error(const char *msg, ...)
errors_tail = error;
if (startup_problem == NULL) {
+#ifdef ENABLE_NANORC
if (nanorc != NULL) {
snprintf(textbuf, MAXSIZE, _("Mistakes in '%s'"), nanorc);
startup_problem = copy_of(textbuf);
} else
+#endif
startup_problem = copy_of(_("Problems with history file"));
}
-
+#ifdef ENABLE_NANORC
if (lineno > 0)
length = snprintf(textbuf, MAXSIZE, _("Error in %s on line %zu: "),
nanorc, lineno);
-
+#endif
va_start(ap, msg);
length += vsnprintf(textbuf + length, MAXSIZE - length, _(msg), ap);
va_end(ap);
@@ -193,7 +197,9 @@ void jot_error(const char *msg, ...)
error->data = nmalloc(length + 1);
sprintf(error->data, "%s", textbuf);
}
+#endif /* ENABLE_NANORC || ENABLE_HISTORIES */
+#ifdef ENABLE_NANORC
/* Parse the next word from the string, null-terminate it, and return
* a pointer to the first character after the null terminator. The
* returned pointer will point to '\0' if we hit the end of the line. */