diff options
author | Colin Watson <cjwatson@debian.org> | 2022-12-31 22:38:15 +0000 |
---|---|---|
committer | Colin Watson <cjwatson@debian.org> | 2022-12-31 22:38:15 +0000 |
commit | 206b2ff154d0793b344abb09d5b4459e331554aa (patch) | |
tree | 77df8d97e1ee6e79045812923e2ba5afc87f2e4d | |
parent | f7c775bd3bcd408eea178371e932b5496a8a2602 (diff) |
Fix compile and test failures when troff is not groff
Fixes https://gitlab.com/man-db/man-db/-/issues/12.
* src/man.c (ONLY_TROFF_IS_GROFF): Only define if `HAS_TROFF` is
defined.
(init_html_pager): Only define if `TROFF_IS_GROFF` is defined.
(format_display): Mark `man_file` as unused if `TROFF_IS_GROFF` is not
defined.
* configure.ac: Substitute `troff_is_groff`.
* src/tests/Makefile.am (TESTS_ENVIRONMENT): Export `troff_is_groff`.
* src/tests/man-language-specific-requests: Adjust expected
language-specific requests if `troff_is_groff` is not `yes`.
* NEWS.md: Document this.
-rw-r--r-- | NEWS.md | 7 | ||||
-rw-r--r-- | configure.ac | 1 | ||||
-rw-r--r-- | src/man.c | 22 | ||||
-rw-r--r-- | src/tests/Makefile.am | 3 | ||||
-rwxr-xr-x | src/tests/man-language-specific-requests | 8 |
5 files changed, 33 insertions, 8 deletions
@@ -1,3 +1,10 @@ +man-db 2.11.2 +============= + +Fixes: + + * Fix compile and test failures when `troff` is not `groff`. + man-db 2.11.1 (15 November 2022) ================================ diff --git a/configure.ac b/configure.ac index cacf2391..fa1757c7 100644 --- a/configure.ac +++ b/configure.ac @@ -196,6 +196,7 @@ else AC_CHECK_PROGS([troff], [troff gtroff]) TROFF=troff fi +AC_SUBST([troff_is_groff]) AC_SUBST([TROFF]) if test -n "$troff" then @@ -263,11 +263,13 @@ static const char args_doc[] = N_("[SECTION] PAGE..."); # define ONLY_NROFF_WARNINGS OPTION_HIDDEN # endif -# ifdef TROFF_IS_GROFF -# define ONLY_TROFF_IS_GROFF 0 -# else -# define ONLY_TROFF_IS_GROFF OPTION_HIDDEN -# endif +# ifdef HAS_TROFF +# ifdef TROFF_IS_GROFF +# define ONLY_TROFF_IS_GROFF 0 +# else +# define ONLY_TROFF_IS_GROFF OPTION_HIDDEN +# endif +# endif /* HAS_TROFF */ /* Please keep these options in the same order as in parse_opt below. */ static struct argp_option options[] = { @@ -363,12 +365,14 @@ static struct argp_option options[] = { { 0 } }; +#ifdef TROFF_IS_GROFF static void init_html_pager (void) { html_pager = getenv ("BROWSER"); if (!html_pager) html_pager = PROG_BROWSER; } +#endif /* TROFF_IS_GROFF */ static error_t parse_opt (int key, char *arg, struct argp_state *state) { @@ -1946,13 +1950,19 @@ static int format_display_and_save (decompress *d, } #endif /* MAN_CATS */ +#ifdef TROFF_IS_GROFF +# define MAN_FILE_UNUSED +#else /* !TROFF_IS_GROFF */ +# define MAN_FILE_UNUSED MAYBE_UNUSED +#endif /* TROFF_IS_GROFF */ + /* Format a manual page with format_cmd and display it with disp_cmd. * Handle temporary file creation if necessary. * TODO: merge with format_display_and_save */ static void format_display (decompress *d, pipeline *format_cmd, pipeline *disp_cmd, - const char *man_file) + const char *man_file MAN_FILE_UNUSED) { pipeline *decomp = decompress_get_pipeline (d); int format_status = 0, disp_status = 0; diff --git a/src/tests/Makefile.am b/src/tests/Makefile.am index 6491417b..3cadd2c9 100644 --- a/src/tests/Makefile.am +++ b/src/tests/Makefile.am @@ -22,7 +22,8 @@ TESTS_ENVIRONMENT = PATH=$(abs_builddir)/..:$$PATH; export PATH; \ DBTYPE=$(DBTYPE); export DBTYPE; \ MANDIR_LAYOUT=$(MANDIR_LAYOUT); export MANDIR_LAYOUT; \ abs_top_builddir=$(abs_top_builddir); export abs_top_builddir; \ - OVERRIDE_DIR="$(override_dir)"; export OVERRIDE_DIR; + OVERRIDE_DIR="$(override_dir)"; export OVERRIDE_DIR; \ + troff_is_groff=$(troff_is_groff); export troff_is_groff; # Each test must use the configure-detected shell, not necessarily /bin/sh. AM_LOG_FLAGS = $(SHELL) ALL_TESTS = \ diff --git a/src/tests/man-language-specific-requests b/src/tests/man-language-specific-requests index 3c7a4137..5051d50b 100755 --- a/src/tests/man-language-specific-requests +++ b/src/tests/man-language-specific-requests @@ -35,9 +35,15 @@ write_page test 1 "$tmpdir/usr/share/man/xyzzy/man1/test.1" \ write_page xyz 1 "$tmpdir/usr/share/man/man1/xyz.1" \ UTF-8 '' '' 'test \- top-level xyz page' -cat >"$tmpdir/1.exp" <<'EOF' +: >"$tmpdir/1.exp" +# shellcheck disable=SC2154 +if [ "$troff_is_groff" = yes ]; then + cat >>"$tmpdir/1.exp" <<'EOF' . mso xyzzy.tmac .hla xyzzy +EOF +fi +cat >>"$tmpdir/1.exp" <<'EOF' test \- xyzzy language page for test EOF |