mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-29 00:12:45 +00:00
Make less act like more(1) when it is invoked as more.
Obtained from: NetBSD
This commit is contained in:
parent
d1db20032f
commit
a8f92a7ce5
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=60812
@ -1,3 +1,4 @@
|
||||
/* $FreeBSD$ */
|
||||
/*
|
||||
* Copyright (C) 1984-2000 Mark Nudelman
|
||||
*
|
||||
@ -35,6 +36,7 @@ extern int ignore_eoi;
|
||||
extern int secure;
|
||||
extern int hshift;
|
||||
extern int show_attn;
|
||||
extern int more_mode;
|
||||
extern char *every_first_cmd;
|
||||
extern char *curr_altfilename;
|
||||
extern char version[];
|
||||
@ -468,12 +470,16 @@ mca_char(c)
|
||||
flag = 0;
|
||||
switch (c)
|
||||
{
|
||||
case CONTROL('E'): /* ignore END of file */
|
||||
case '*':
|
||||
if (more_mode)
|
||||
break;
|
||||
case CONTROL('E'): /* ignore END of file */
|
||||
flag = SRCH_PAST_EOF;
|
||||
break;
|
||||
case CONTROL('F'): /* FIRST file */
|
||||
case '@':
|
||||
if (more_mode)
|
||||
break;
|
||||
case CONTROL('F'): /* FIRST file */
|
||||
flag = SRCH_FIRST_FILE;
|
||||
break;
|
||||
case CONTROL('K'): /* KEEP position */
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* $FreeBSD$ */
|
||||
/*
|
||||
* Copyright (C) 1984-2000 Mark Nudelman
|
||||
*
|
||||
@ -27,6 +28,7 @@ extern int top_scroll;
|
||||
extern int quiet;
|
||||
extern int sc_width, sc_height;
|
||||
extern int quit_at_eof;
|
||||
extern int more_mode;
|
||||
extern int plusoption;
|
||||
extern int forw_scroll;
|
||||
extern int back_scroll;
|
||||
@ -142,9 +144,12 @@ forw(n, pos, force, only_last, nblank)
|
||||
pos_clear();
|
||||
add_forw_pos(pos);
|
||||
force = 1;
|
||||
if (top_scroll == OPT_ONPLUS || first_time)
|
||||
clear();
|
||||
home();
|
||||
if (more_mode == 0)
|
||||
{
|
||||
if (top_scroll == OPT_ONPLUS || first_time)
|
||||
clear();
|
||||
home();
|
||||
}
|
||||
} else
|
||||
{
|
||||
clear_bot();
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* $FreeBSD$ */
|
||||
/*
|
||||
* Copyright (C) 1984-2000 Mark Nudelman
|
||||
*
|
||||
@ -29,6 +30,7 @@ public char * progname;
|
||||
public int quitting;
|
||||
public int secure;
|
||||
public int dohelp;
|
||||
public int more_mode = 0;
|
||||
|
||||
#if LOGFILE
|
||||
public int logfile = -1;
|
||||
@ -60,6 +62,7 @@ main(argc, argv)
|
||||
{
|
||||
IFILE ifile;
|
||||
char *s;
|
||||
extern char *__progname;
|
||||
|
||||
#ifdef __EMX__
|
||||
_response(&argc, &argv);
|
||||
@ -99,6 +102,9 @@ main(argc, argv)
|
||||
* Process command line arguments and LESS environment arguments.
|
||||
* Command line arguments override environment arguments.
|
||||
*/
|
||||
if (strcmp(__progname, "more") == 0)
|
||||
more_mode = 1;
|
||||
|
||||
is_tty = isatty(1);
|
||||
get_term();
|
||||
init_cmds();
|
||||
@ -106,7 +112,16 @@ main(argc, argv)
|
||||
init_charset();
|
||||
init_line();
|
||||
init_option();
|
||||
s = lgetenv("LESS");
|
||||
|
||||
if (more_mode) {
|
||||
scan_option("-E");
|
||||
scan_option("-m");
|
||||
scan_option("-G");
|
||||
scan_option("-f");
|
||||
s = lgetenv("MORE");
|
||||
} else {
|
||||
s = lgetenv("LESS");
|
||||
}
|
||||
if (s != NULL)
|
||||
scan_option(save(s));
|
||||
|
||||
@ -197,7 +212,7 @@ main(argc, argv)
|
||||
quit(QUIT_OK);
|
||||
}
|
||||
|
||||
if (missing_cap && !know_dumb)
|
||||
if (missing_cap && !know_dumb && !more_mode)
|
||||
error("WARNING: terminal is not fully functional", NULL_PARG);
|
||||
init_mark();
|
||||
raw_mode(1);
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* $FreeBSD$ */
|
||||
/*
|
||||
* Copyright (C) 1984-2000 Mark Nudelman
|
||||
*
|
||||
@ -223,6 +224,8 @@ extern int quiet; /* If VERY_QUIET, use visual bell for bell */
|
||||
extern int no_back_scroll;
|
||||
extern int swindow;
|
||||
extern int no_init;
|
||||
extern int quit_at_eof;
|
||||
extern int more_mode;
|
||||
extern int sigs;
|
||||
extern int wscroll;
|
||||
extern int screen_trashed;
|
||||
@ -1108,11 +1111,19 @@ get_term()
|
||||
if (sc_e_keypad == NULL)
|
||||
sc_e_keypad = "";
|
||||
|
||||
sc_init = ltgetstr("ti", &sp);
|
||||
/*
|
||||
* This loses for terminals with termcap entries with ti/te strings
|
||||
* that switch to/from an alternate screen, and we're in quit_at_eof
|
||||
* (eg, more(1)).
|
||||
*/
|
||||
if (!quit_at_eof && !more_mode) {
|
||||
sc_init = ltgetstr("ti", &sp);
|
||||
sc_deinit = ltgetstr("te", &sp);
|
||||
}
|
||||
|
||||
if (sc_init == NULL)
|
||||
sc_init = "";
|
||||
|
||||
sc_deinit= ltgetstr("te", &sp);
|
||||
if (sc_deinit == NULL)
|
||||
sc_deinit = "";
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
/* $FreeBSD$ */
|
||||
/*
|
||||
* Copyright (C) 1984-2000 Mark Nudelman
|
||||
*
|
||||
@ -22,7 +23,7 @@
|
||||
#if HAVE_POSIX_REGCOMP
|
||||
#include <regex.h>
|
||||
#ifdef REG_EXTENDED
|
||||
#define REGCOMP_FLAG REG_EXTENDED
|
||||
#define REGCOMP_FLAG (more_mode ? 0 : REG_EXTENDED)
|
||||
#else
|
||||
#define REGCOMP_FLAG 0
|
||||
#endif
|
||||
@ -52,6 +53,7 @@ extern int linenums;
|
||||
extern int sc_height;
|
||||
extern int jump_sline;
|
||||
extern int bs_mode;
|
||||
extern int more_mode;
|
||||
extern POSITION start_attnpos;
|
||||
extern POSITION end_attnpos;
|
||||
#if HILITE_SEARCH
|
||||
|
Loading…
Reference in New Issue
Block a user