diff options
author | delphij <delphij@FreeBSD.org> | 2006-08-20 15:49:51 +0000 |
---|---|---|
committer | delphij <delphij@FreeBSD.org> | 2006-08-20 15:49:51 +0000 |
commit | 5297f4bc59da861bbe3beb5ee12839fa05e79882 (patch) | |
tree | 66e8cb2705abe3d167ba3a94a60d37c894690ff2 /contrib/less/optfunc.c | |
parent | 71cad8a96df623ac7d9129aa5e8c983df1030b0c (diff) | |
download | FreeBSD-src-5297f4bc59da861bbe3beb5ee12839fa05e79882.zip FreeBSD-src-5297f4bc59da861bbe3beb5ee12839fa05e79882.tar.gz |
Import less v394
Diffstat (limited to 'contrib/less/optfunc.c')
-rw-r--r-- | contrib/less/optfunc.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/contrib/less/optfunc.c b/contrib/less/optfunc.c index 590b495..3f77a49 100644 --- a/contrib/less/optfunc.c +++ b/contrib/less/optfunc.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 1984-2002 Mark Nudelman + * Copyright (C) 1984-2005 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -37,6 +37,7 @@ extern int sc_height; extern int secure; extern int dohelp; extern int any_display; +extern int less_is_more; extern char openquote; extern char closequote; extern char *prproto[]; @@ -201,10 +202,13 @@ opt_t(type, s) } findtag(skipsp(s)); save_ifile = save_curr_ifile(); - if (edit_tagfile()) - break; - if ((pos = tagsearch()) == NULL_POSITION) + /* + * Try to open the file containing the tag + * and search for the tag in that file. + */ + if (edit_tagfile() || (pos = tagsearch()) == NULL_POSITION) { + /* Failed: reopen the old file. */ reedit_ifile(save_ifile); break; } @@ -259,7 +263,12 @@ opt_p(type, s) */ plusoption = TRUE; ungetsc(s); - ungetsc("/"); + /* + * In "more" mode, the -p argument is a command, + * not a search string, so we don't need a slash. + */ + if (!less_is_more); + ungetsc("/"); break; } } @@ -367,7 +376,7 @@ opt__V(type, s) any_display = 1; putstr("less "); putstr(version); - putstr("\nCopyright (C) 2002 Mark Nudelman\n\n"); + putstr("\nCopyright (C) 1984-2005 Mark Nudelman\n\n"); putstr("less comes with NO WARRANTY, to the extent permitted by law.\n"); putstr("For information about the terms of redistribution,\n"); putstr("see the file named README in the less distribution.\n"); @@ -450,8 +459,8 @@ opt_D(type, s) } if (type == TOGGLE) { - so_enter(); - so_exit(); + at_enter(AT_STANDOUT); + at_exit(); } break; case QUERY: |