Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/less/less Change the behaviour when in `more' mode (...
details: https://anonhg.NetBSD.org/src/rev/4414a98927ec
branches: trunk
changeset: 476028:4414a98927ec
user: kleink <kleink%NetBSD.org@localhost>
date: Fri Sep 03 22:07:05 1999 +0000
description:
Change the behaviour when in `more' mode (less invoked as more):
* Treat search patterns as BREs only, per 1003.2 and XCU5.
* Do not perform any special treatment when an unqoted * or @ is given as
the first character of the search pattern.
Addresses PR bin/8269 by Chris Demetriou.
diffstat:
usr.bin/less/less/command.c | 15 ++++++++++-----
usr.bin/less/less/help.c | 3 ++-
usr.bin/less/less/less.1 | 7 +++++--
usr.bin/less/less/search.c | 5 +++--
4 files changed, 20 insertions(+), 10 deletions(-)
diffs (123 lines):
diff -r ddfded97a3ad -r 4414a98927ec usr.bin/less/less/command.c
--- a/usr.bin/less/less/command.c Fri Sep 03 21:35:05 1999 +0000
+++ b/usr.bin/less/less/command.c Fri Sep 03 22:07:05 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: command.c,v 1.6 1999/04/06 05:57:35 mrg Exp $ */
+/* $NetBSD: command.c,v 1.7 1999/09/03 22:07:05 kleink Exp $ */
/*
* Copyright (c) 1984,1985,1989,1994,1995,1996,1999 Mark Nudelman
@@ -52,6 +52,7 @@
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[];
@@ -346,8 +347,8 @@
* Certain characters as the first char of
* the pattern have special meaning:
* ! Toggle the NO_MATCH flag
- * * Toggle the PAST_EOF flag
- * @ Toggle the FIRST_FILE flag
+ * * Toggle the PAST_EOF flag (less extension)
+ * @ Toggle the FIRST_FILE flag (less extension)
*/
if (len_cmdbuf() > 0)
/*
@@ -358,12 +359,16 @@
flag = 0;
switch (c)
{
+ case '*':
+ if (more_mode)
+ break;
case CONTROL('E'): /* ignore END of file */
- case '*':
flag = SRCH_PAST_EOF;
break;
+ case '@':
+ if (more_mode)
+ break;
case CONTROL('F'): /* FIRST file */
- case '@':
flag = SRCH_FIRST_FILE;
break;
case CONTROL('K'): /* KEEP position */
diff -r ddfded97a3ad -r 4414a98927ec usr.bin/less/less/help.c
--- a/usr.bin/less/less/help.c Fri Sep 03 21:35:05 1999 +0000
+++ b/usr.bin/less/less/help.c Fri Sep 03 22:07:05 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: help.c,v 1.1.1.4 1999/04/06 05:30:34 mrg Exp $ */
+/* $NetBSD: help.c,v 1.2 1999/09/03 22:07:06 kleink Exp $ */
/* This file was generated by mkhelp from less.hlp */
#include "less.h"
@@ -50,6 +50,7 @@
' ',' ',' ',' ',' ',' ',' ',' ','^','F',' ','o','r',' ','@',' ',' ','S','t','a','r','t',' ','s','e','a','r','c','h',' ','a','t',' ','F','I','R','S','T',' ','f','i','l','e',' ','(','f','o','r','
','/',')',' ','o','r',' ','l','a','s','t',' ','f','i','l','e',' ','(','f','o','r',' ','?',')','.','\n',
' ',' ',' ',' ',' ',' ',' ',' ','^','K',' ',' ',' ',' ',' ',' ',' ','H','i','g','h','l','i','g','h','t',' ','m','a','t','c','h','e','s',',',' ','b','u','t',' ','d','o','n','\'','t','
','m','o','v','e',' ','(','K','E','E','P',' ','p','o','s','i','t','i','o','n',')','.','\n',
' ',' ',' ',' ',' ',' ',' ',' ','^','R',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','u','s','e',' ','R','E','G','U','L','A','R',' ','E','X','P','R','E','S','S','I','O','N','S','.','\n',
+' ',' ',' ',' ',' ',' ',' ',' ','*',' ','a','n','d',' ','@',' ','m','o','d','i','f','i','e','r','s',' ','a','r','e',' ','r','e','c','o','g','n','i','z','e','d',' ','i','n',' ','l','e','s','s','
','m','o','d','e',' ','o','n','l','y','.','\n',
'
','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\n',
'\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','
','J','\b','J','U','\b','U','M','\b','M','P','\b','P','I','\b','I','N','\b','N','G','\b','G','\n',
diff -r ddfded97a3ad -r 4414a98927ec usr.bin/less/less/less.1
--- a/usr.bin/less/less/less.1 Fri Sep 03 21:35:05 1999 +0000
+++ b/usr.bin/less/less/less.1 Fri Sep 03 22:07:05 1999 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: less.1,v 1.8 1999/08/02 12:41:20 sommerfeld Exp $
+.\" $NetBSD: less.1,v 1.9 1999/09/03 22:07:06 kleink Exp $
.\"
.TH LESS 1 "Version 335: 03 Apr 1999"
.SH NAME
@@ -174,7 +174,8 @@
.IP /pattern
Search forward in the file for the N-th line containing the pattern.
N defaults to 1.
-The pattern is a regular expression, as recognized by
+When invoked as less, the pattern is an extended regular expression.
+Otherwise, the pattern is a basic regular expression, as recognized by
.I ed.
The search starts at the second line displayed
(but see the -a and -j options, which change this).
@@ -190,11 +191,13 @@
That is, if the search reaches the END of the current file
without finding a match,
the search continues in the next file in the command line list.
+The * modifier is available when invoked as less only.
.IP "^F or @"
Begin the search at the first line of the FIRST file
in the command line list,
regardless of what is currently displayed on the screen
or the settings of the -a or -j options.
+The @ modifier is available when invoked as less only.
.IP "^K"
Highlight any text which matches the pattern on the current screen,
but don't move to the first match (KEEP current position).
diff -r ddfded97a3ad -r 4414a98927ec usr.bin/less/less/search.c
--- a/usr.bin/less/less/search.c Fri Sep 03 21:35:05 1999 +0000
+++ b/usr.bin/less/less/search.c Fri Sep 03 22:07:05 1999 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: search.c,v 1.3 1999/04/06 05:57:36 mrg Exp $ */
+/* $NetBSD: search.c,v 1.4 1999/09/03 22:07:06 kleink Exp $ */
/*
* Copyright (c) 1984,1985,1989,1994,1995,1996,1999 Mark Nudelman
@@ -40,7 +40,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
@@ -81,6 +81,7 @@
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
Home |
Main Index |
Thread Index |
Old Index