diff options
Diffstat (limited to 'contrib/less')
-rw-r--r-- | contrib/less/command.c | 10 | ||||
-rw-r--r-- | contrib/less/forwback.c | 11 | ||||
-rw-r--r-- | contrib/less/less.h | 1 | ||||
-rw-r--r-- | contrib/less/line.c | 1 | ||||
-rw-r--r-- | contrib/less/main.c | 13 | ||||
-rw-r--r-- | contrib/less/prompt.c | 1 | ||||
-rw-r--r-- | contrib/less/screen.c | 1 | ||||
-rw-r--r-- | contrib/less/search.c | 4 | ||||
-rw-r--r-- | contrib/less/signal.c | 4 |
9 files changed, 38 insertions, 8 deletions
diff --git a/contrib/less/command.c b/contrib/less/command.c index ff48909..032606b 100644 --- a/contrib/less/command.c +++ b/contrib/less/command.c @@ -1,3 +1,4 @@ +/* $FreeBSD$ */ /* * Copyright (C) 1984-2007 Mark Nudelman * @@ -37,6 +38,7 @@ extern int ignore_eoi; extern int secure; extern int hshift; extern int show_attn; +extern int less_is_more; extern char *every_first_cmd; extern char *curr_altfilename; extern char version[]; @@ -484,12 +486,16 @@ mca_char(c) flag = 0; switch (c) { - case CONTROL('E'): /* ignore END of file */ case '*': + if (less_is_more) + break; + case CONTROL('E'): /* ignore END of file */ flag = SRCH_PAST_EOF; break; - case CONTROL('F'): /* FIRST file */ case '@': + if (less_is_more) + break; + case CONTROL('F'): /* FIRST file */ flag = SRCH_FIRST_FILE; break; case CONTROL('K'): /* KEEP position */ diff --git a/contrib/less/forwback.c b/contrib/less/forwback.c index 7b5bb2d..08a9721 100644 --- a/contrib/less/forwback.c +++ b/contrib/less/forwback.c @@ -1,3 +1,4 @@ +/* $FreeBSD$ */ /* * Copyright (C) 1984-2007 Mark Nudelman * @@ -27,6 +28,7 @@ extern int sigs; extern int top_scroll; extern int quiet; extern int sc_width, sc_height; +extern int less_is_more; extern int plusoption; extern int forw_scroll; extern int back_scroll; @@ -136,8 +138,10 @@ forw(n, pos, force, only_last, nblank) pos_clear(); add_forw_pos(pos); force = 1; - clear(); - home(); + if (less_is_more == 0) { + clear(); + home(); + } } if (pos != position(BOTTOM_PLUS_ONE) || empty_screen()) @@ -217,7 +221,8 @@ forw(n, pos, force, only_last, nblank) * start the display after the beginning of the file, * and it is not appropriate to squish in that case. */ - if (first_time && pos == NULL_POSITION && !top_scroll && + if ((first_time || less_is_more) && + pos == NULL_POSITION && !top_scroll && #if TAGS tagoption == NULL && #endif diff --git a/contrib/less/less.h b/contrib/less/less.h index 8f0d2d8..eb40a0f 100644 --- a/contrib/less/less.h +++ b/contrib/less/less.h @@ -1,3 +1,4 @@ +/* $FreeBSD$ */ /* * Copyright (C) 1984-2007 Mark Nudelman * diff --git a/contrib/less/line.c b/contrib/less/line.c index d61b872..217c24c 100644 --- a/contrib/less/line.c +++ b/contrib/less/line.c @@ -1,3 +1,4 @@ +/* $FreeBSD$ */ /* * Copyright (C) 1984-2007 Mark Nudelman * diff --git a/contrib/less/main.c b/contrib/less/main.c index 36a230e..e139a62 100644 --- a/contrib/less/main.c +++ b/contrib/less/main.c @@ -1,3 +1,4 @@ +/* $FreeBSD$ */ /* * Copyright (C) 1984-2007 Mark Nudelman * @@ -58,6 +59,7 @@ static char consoleTitle[256]; extern int missing_cap; extern int know_dumb; extern int quit_if_one_screen; +extern int no_init; extern int pr_type; @@ -71,6 +73,7 @@ main(argc, argv) { IFILE ifile; char *s; + extern char *__progname; #ifdef __EMX__ _response(&argc, &argv); @@ -133,11 +136,15 @@ main(argc, argv) init_prompt(); + if (less_is_more) + scan_option("-fG"); + s = lgetenv(less_is_more ? "MORE" : "LESS"); if (s != NULL) scan_option(save(s)); -#define isoptstring(s) (((s)[0] == '-' || (s)[0] == '+') && (s)[1] != '\0') +#define isoptstring(s) less_is_more ? (((s)[0] == '-') && (s)[1] != '\0') : \ + (((s)[0] == '-' || (s)[0] == '+') && (s)[1] != '\0') while (argc > 0 && (isoptstring(*argv) || isoptpending())) { s = *argv++; @@ -158,6 +165,8 @@ main(argc, argv) quit(QUIT_OK); } + if (less_is_more) + no_init = TRUE; if (less_is_more && get_quit_at_eof()) quit_if_one_screen = TRUE; @@ -235,7 +244,7 @@ main(argc, argv) quit(QUIT_OK); } - if (missing_cap && !know_dumb) + if (missing_cap && !know_dumb && !less_is_more) error("WARNING: terminal is not fully functional", NULL_PARG); init_mark(); open_getchr(); diff --git a/contrib/less/prompt.c b/contrib/less/prompt.c index 67b5ddc..4f96895 100644 --- a/contrib/less/prompt.c +++ b/contrib/less/prompt.c @@ -1,3 +1,4 @@ +/* $FreeBSD$ */ /* * Copyright (C) 1984-2007 Mark Nudelman * diff --git a/contrib/less/screen.c b/contrib/less/screen.c index 51ab799..a081918 100644 --- a/contrib/less/screen.c +++ b/contrib/less/screen.c @@ -1,3 +1,4 @@ +/* $FreeBSD$ */ /* * Copyright (C) 1984-2007 Mark Nudelman * diff --git a/contrib/less/search.c b/contrib/less/search.c index 6104964..c3a3e76 100644 --- a/contrib/less/search.c +++ b/contrib/less/search.c @@ -1,3 +1,4 @@ +/* $FreeBSD$ */ /* * Copyright (C) 1984-2007 Mark Nudelman * @@ -23,7 +24,7 @@ #if HAVE_POSIX_REGCOMP #include <regex.h> #ifdef REG_EXTENDED -#define REGCOMP_FLAG REG_EXTENDED +#define REGCOMP_FLAG (less_is_more ? 0 : REG_EXTENDED) #else #define REGCOMP_FLAG 0 #endif @@ -53,6 +54,7 @@ extern int linenums; extern int sc_height; extern int jump_sline; extern int bs_mode; +extern int less_is_more; extern int ctldisp; extern int status_col; extern void * constant ml_search; diff --git a/contrib/less/signal.c b/contrib/less/signal.c index ce3714c..def985d 100644 --- a/contrib/less/signal.c +++ b/contrib/less/signal.c @@ -8,6 +8,7 @@ * contact the author, see the README file. */ +/* $FreeBSD$ */ /* * Routines dealing with signals. @@ -34,6 +35,7 @@ extern int linenums; extern int wscroll; extern int reading; extern int quit_on_intr; +extern int less_is_more; extern long jump_sline_fraction; /* @@ -58,6 +60,8 @@ u_interrupt(type) if (kbhit()) getkey(); #endif + if (less_is_more) + quit(0); if (reading) intread(); } |