fix Unix build with DEF_PAGER defined

Eliminate a couple of compile warnings produced when DEF_PAGER is
defined:  unixmain.c: g.catmore=DEF_PAGER; wintty.c: fd=open(...).

Override its use when DLB is also defined since an external pager
could access 'license' but not 'history', 'opthelp', &c when those
are in the dlb container file.

In the commented out value for DEF_PAGER, show a viable value for
the default configuration these days.
This commit is contained in:
PatR
2021-10-05 01:11:24 -07:00
parent 013f3770d1
commit ccfddd47de
4 changed files with 23 additions and 6 deletions

View File

@@ -36,6 +36,20 @@ extern void msmsg(const char *, ...);
#endif
#endif
#ifdef DEF_PAGER
/* DEF_PAGER implies UNIX; when dlb is in use, the only file accessible
to an external pager is 'license'; override 'DEF_PAGER' for that
situation rather than using code to fallback to DLB plus internal
pager after open() failure */
#ifdef DLB
#undef DEF_PAGER
#else
#ifndef O_RDONLY /* (same logic as unixmain.c) */
#include <fcntl.h>
#endif
#endif /* DLB */
#endif /* DEF_PAGER */
#if defined(TTY_TILES_ESCCODES) || defined(TTY_SOUND_ESCCODES)
#define VT_ANSI_COMMAND 'z'
#endif
@@ -2791,7 +2805,7 @@ tty_display_file(const char *fname, boolean complain)
#ifdef DEF_PAGER /* this implies that UNIX is defined */
{
/* use external pager; this may give security problems */
register int fd = open(fname, 0);
int fd = open(fname, O_RDONLY);
if (fd < 0) {
if (complain)