aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXin LI <delphij@FreeBSD.org>2012-06-26 20:38:53 +0000
committerXin LI <delphij@FreeBSD.org>2012-06-26 20:38:53 +0000
commitae8c2162b0f1c1823dae013469f900b9882b77a2 (patch)
tree9492f724d6c5c2081c7f6b978b27d62af6523d31
parent5b2db585ea1bc974ea3553d32447fba4e9ec0c2a (diff)
downloadsrc-ae8c2162b0f1c1823dae013469f900b9882b77a2.tar.gz
src-ae8c2162b0f1c1823dae013469f900b9882b77a2.zip
Vendor import of less v449 (beta).vendor/less/v449
Notes
Notes: svn path=/vendor/less/dist/; revision=237607 svn path=/vendor/less/v449/; revision=237608; tag=vendor/less/v449
-rw-r--r--LICENSE2
-rw-r--r--Makefile.aut5
-rw-r--r--NEWS30
-rw-r--r--README13
-rw-r--r--brac.c17
-rw-r--r--ch.c19
-rw-r--r--charset.c17
-rw-r--r--charset.h17
-rw-r--r--cmd.h20
-rw-r--r--cmdbuf.c83
-rw-r--r--command.c85
-rwxr-xr-xconfigure409
-rw-r--r--configure.ac25
-rw-r--r--cvt.c42
-rw-r--r--decode.c18
-rw-r--r--defines.ds17
-rw-r--r--defines.h.in12
-rw-r--r--defines.o217
-rw-r--r--defines.o917
-rw-r--r--defines.wn17
-rw-r--r--edit.c21
-rw-r--r--filename.c65
-rw-r--r--forwback.c17
-rw-r--r--help.c25
-rw-r--r--ifile.c17
-rw-r--r--input.c19
-rw-r--r--jump.c17
-rw-r--r--less.h20
-rw-r--r--less.hlp25
-rw-r--r--less.man384
-rw-r--r--less.nro50
-rw-r--r--lessecho.c19
-rw-r--r--lessecho.man25
-rw-r--r--lessecho.nro19
-rw-r--r--lesskey.c18
-rw-r--r--lesskey.h17
-rw-r--r--lesskey.man7
-rw-r--r--lesskey.nro7
-rw-r--r--lglob.h17
-rw-r--r--line.c23
-rw-r--r--linenum.c17
-rw-r--r--lsystem.c17
-rw-r--r--main.c18
-rw-r--r--mark.c17
-rw-r--r--mkhelp.c17
-rw-r--r--optfunc.c42
-rw-r--r--option.c17
-rw-r--r--option.h17
-rw-r--r--opttbl.c17
-rw-r--r--os.c17
-rw-r--r--output.c39
-rw-r--r--pattern.c188
-rw-r--r--pattern.h28
-rw-r--r--pckeys.h17
-rw-r--r--position.c17
-rw-r--r--position.h17
-rw-r--r--prompt.c29
-rw-r--r--screen.c17
-rw-r--r--scrsize.c17
-rw-r--r--search.c93
-rw-r--r--signal.c17
-rw-r--r--tags.c17
-rw-r--r--ttyin.c17
-rw-r--r--version.c30
64 files changed, 1369 insertions, 1064 deletions
diff --git a/LICENSE b/LICENSE
index c7168e718272..3fe715f17063 100644
--- a/LICENSE
+++ b/LICENSE
@@ -2,7 +2,7 @@
------------
Less
-Copyright (C) 1984-2011 Mark Nudelman
+Copyright (C) 1984-2012 Mark Nudelman
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
diff --git a/Makefile.aut b/Makefile.aut
index b3ee3f4639d1..f7026249e663 100644
--- a/Makefile.aut
+++ b/Makefile.aut
@@ -1,6 +1,6 @@
# Makefile for authoring less.
-EMAIL = markn@greenwoodsoftware.com
+EMAIL = bug-less@gnu.org
HOMEPAGE = http://www.greenwoodsoftware.com/less
SHELL = /bin/sh
RCS = rcs
@@ -112,8 +112,7 @@ dist: ${DISTFILES}
echo "Preparing $$REL"; \
rm -rf $$REL; mkdir $$REL; \
for file in ${DISTFILES}; do \
- cp -p $$file $$REL; \
- chmod -w $$REL/$$file; \
+ ./add_copyright $$file $$REL; \
done; \
cd $$REL; chmod +w ${DISTFILES_W}; cd ..; \
echo "Creating release/$$REL/$$REL.tar.gz"; \
diff --git a/NEWS b/NEWS
index eb38025cbf45..9a8ea26372f0 100644
--- a/NEWS
+++ b/NEWS
@@ -7,8 +7,34 @@
http://www.greenwoodsoftware.com/less
You can also download the latest version of less from there.
- To report bugs, suggestions or comments, send email to
- bug-less@gnu.org or markn@greenwoodsoftware.com.
+ To report bugs, suggestions or comments, send email to bug-less@gnu.org.
+
+======================================================================
+
+ Major changes between "less" versions 444 and 449
+
+* Add ESC-F command to keep reading data until a pattern is found.
+
+* Use exit code of LESSOPEN script if LESSOPEN starts with "||".
+
+* When up/down arrow is used on the command line immediately after
+ typing text, the next command starting with that text is found.
+
+* Add support for GNU regex.
+
+* Add configure option --with-regex=none and fix compile errors
+ when compiling with no regex library.
+
+* Fix bugs handling SGR sequences in Win32.
+
+* Fix possible crashes caused by malformed LESSOPEN or
+ LESSCLOSE variables.
+
+* Fix bug highlighting text which is discontiguous in the file
+ due to backspace processing.
+
+* Fix bug in displaying status column when scrolling backwards
+ with -J and -S in effect.
======================================================================
diff --git a/README b/README
index c4cfa63ef23b..d19461852c09 100644
--- a/README
+++ b/README
@@ -1,7 +1,7 @@
- Less, version 444
+ Less, version 449
- This is the distribution of less, version 444, released 09 Jun 2011.
+ This is the distribution of less, version 449, released 26 Jun 2012.
This program is part of the GNU project (http://www.gnu.org).
This program is free software. You may redistribute it and/or
@@ -13,7 +13,7 @@
or
2. The Less License, in the file LICENSE.
- Please report any problems to bug-less@gnu.org or markn@greenwoodsoftware.com.
+ Please report any problems to bug-less@gnu.org.
See http://www.greenwoodsoftware.com/less for the latest info.
=========================================================================
@@ -52,10 +52,11 @@ INSTALLATION (Unix systems only):
regcomp Use the V8-compatible regcomp.
regcomp-local Use Henry Spencer's V8-compatible regcomp
(source is supplied with less).
+ none No regular expressions, only simple string matching.
--with-secure
Builds a "secure" version of less, with some features disabled
- to prevent users from viewing other files, accessing shell
- commands, etc.
+ to prevent users from viewing other files, accessing shell
+ commands, etc.
3. It is a good idea to look over the generated Makefile and defines.h
@@ -88,7 +89,7 @@ INSTALLATION (Unix systems only):
bindir and/or mandir to the appropriate directories.
If you have any problems building or running "less", suggestions,
-complaints, etc., you may mail to the author at markn@greenwoodsoftware.com.
+complaints, etc., you may mail to bug-less@gnu.org.
Note to hackers: comments noting possible improvements are enclosed
in double curly brackets {{ like this }}.
diff --git a/brac.c b/brac.c
index 22c71ebfc831..fcf9ed216fb6 100644
--- a/brac.c
+++ b/brac.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
diff --git a/ch.c b/ch.c
index 1b84ec1618fd..8e431df5fdf9 100644
--- a/ch.c
+++ b/ch.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
@@ -582,6 +581,8 @@ ch_length()
return (NULL_POSITION);
if (ch_flags & CH_HELPFILE)
return (size_helpdata);
+ if (ch_flags & CH_NODATA)
+ return (0);
return (ch_fsize);
}
diff --git a/charset.c b/charset.c
index 12b59d6b731a..4ce6a54f09bf 100644
--- a/charset.c
+++ b/charset.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
diff --git a/charset.h b/charset.h
index 8ccf748df09e..0ae636646a93 100644
--- a/charset.h
+++ b/charset.h
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 2005-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
#define IS_ASCII_OCTET(c) (((c) & 0x80) == 0)
#define IS_UTF8_TRAIL(c) (((c) & 0xC0) == 0x80)
diff --git a/cmd.h b/cmd.h
index 3176b917226a..627f85bcf0a5 100644
--- a/cmd.h
+++ b/cmd.h
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
#define MAX_USERCMD 500
@@ -66,6 +65,7 @@
#define A_NEXT_TAG 53
#define A_PREV_TAG 54
#define A_FILTER 55
+#define A_F_UNTIL_HILITE 56
#define A_INVALID 100
#define A_NOACTION 101
@@ -78,7 +78,7 @@
#define A_EXTRA 0200
-/* Line editting characters */
+/* Line editing characters */
#define EC_BACKSPACE 1
#define EC_LINEKILL 2
diff --git a/cmdbuf.c b/cmdbuf.c
index 74a74ffe9b10..804a0329b138 100644
--- a/cmdbuf.c
+++ b/cmdbuf.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
@@ -30,6 +29,7 @@ static int prompt_col; /* Column of cursor just after prompt */
static char *cp; /* Pointer into cmdbuf */
static int cmd_offset; /* Index into cmdbuf of first displayed char */
static int literal; /* Next input char should not be interpreted */
+static int updown_match = -1; /* Prefix length in up/down movement */
#if TAB_COMPLETE_FILENAME
static int cmd_complete();
@@ -122,6 +122,7 @@ cmd_reset()
cmd_offset = 0;
literal = 0;
cmd_mbc_buf_len = 0;
+ updown_match = -1;
}
/*
@@ -132,6 +133,7 @@ clear_cmd()
{
cmd_col = prompt_col = 0;
cmd_mbc_buf_len = 0;
+ updown_match = -1;
}
/*
@@ -504,6 +506,7 @@ cmd_ichar(cs, clen)
/*
* Reprint the tail of the line from the inserted char.
*/
+ updown_match = -1;
cmd_repaint(cp);
cmd_right();
return (CC_OK);
@@ -547,6 +550,7 @@ cmd_erase()
/*
* Repaint the buffer after the erased char.
*/
+ updown_match = -1;
cmd_repaint(cp);
/*
@@ -643,6 +647,7 @@ cmd_kill()
cmd_offset = 0;
cmd_home();
*cp = '\0';
+ updown_match = -1;
cmd_repaint(cp);
/*
@@ -675,12 +680,15 @@ set_mlist(mlist, cmdflags)
#if CMD_HISTORY
/*
* Move up or down in the currently selected command history list.
+ * Only consider entries whose first updown_match chars are equal to
+ * cmdbuf's corresponding chars.
*/
static int
cmd_updown(action)
int action;
{
char *s;
+ struct mlist *ml;
if (curr_mlist == NULL)
{
@@ -690,24 +698,47 @@ cmd_updown(action)
bell();
return (CC_OK);
}
- cmd_home();
- clear_eol();
+
+ if (updown_match < 0)
+ {
+ updown_match = cp - cmdbuf;
+ }
+
/*
- * Move curr_mp to the next/prev entry.
+ * Find the next history entry which matches.
*/
- if (action == EC_UP)
- curr_mlist->curr_mp = curr_mlist->curr_mp->prev;
- else
- curr_mlist->curr_mp = curr_mlist->curr_mp->next;
+ for (ml = curr_mlist->curr_mp;;)
+ {
+ ml = (action == EC_UP) ? ml->prev : ml->next;
+ if (ml == curr_mlist)
+ {
+ /*
+ * We reached the end (or beginning) of the list.
+ */
+ break;
+ }
+ if (strncmp(cmdbuf, ml->string, updown_match) == 0)
+ {
+ /*
+ * This entry matches; stop here.
+ * Copy the entry into cmdbuf and echo it on the screen.
+ */
+ curr_mlist->curr_mp = ml;
+ s = ml->string;
+ if (s == NULL)
+ s = "";
+ strcpy(cmdbuf, s);
+ cmd_home();
+ clear_eol();
+ for (cp = cmdbuf; *cp != '\0'; )
+ cmd_right();
+ return (CC_OK);
+ }
+ }
/*
- * Copy the entry into cmdbuf and echo it on the screen.
+ * We didn't find a history entry that matches.
*/
- s = curr_mlist->curr_mp->string;
- if (s == NULL)
- s = "";
- strcpy(cmdbuf, s);
- for (cp = cmdbuf; *cp != '\0'; )
- cmd_right();
+ bell();
return (CC_OK);
}
#endif
@@ -1457,9 +1488,6 @@ save_cmdhist()
FILE *f;
int modified = 0;
- filename = histfile_name();
- if (filename == NULL)
- return;
if (mlist_search.modified)
modified = 1;
#if SHELL_ESCAPE || PIPEC
@@ -1468,6 +1496,9 @@ save_cmdhist()
#endif
if (!modified)
return;
+ filename = histfile_name();
+ if (filename == NULL)
+ return;
f = fopen(filename, "w");
free(filename);
if (f == NULL)
diff --git a/command.c b/command.c
index bacb058a5e17..10f1ad900573 100644
--- a/command.c
+++ b/command.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
@@ -36,6 +35,7 @@ extern int ignore_eoi;
extern int secure;
extern int hshift;
extern int show_attn;
+extern POSITION highest_hilite;
extern char *every_first_cmd;
extern char *curr_altfilename;
extern char version[];
@@ -102,8 +102,8 @@ cmd_exec()
static void
start_mca(action, prompt, mlist, cmdflags)
int action;
- char *prompt;
- void *mlist;
+ constant char *prompt;
+ constant void *mlist;
int cmdflags;
{
mca = action;
@@ -680,7 +680,7 @@ make_display()
static void
prompt()
{
- register char *p;
+ register constant char *p;
if (ungot != NULL)
{
@@ -956,6 +956,44 @@ multi_search(pattern, n)
}
/*
+ * Forward forever, or until a highlighted line appears.
+ */
+ static int
+forw_loop(until_hilite)
+ int until_hilite;
+{
+ POSITION curr_len;
+
+ if (ch_getflags() & CH_HELPFILE)
+ return (A_NOACTION);
+
+ cmd_exec();
+ jump_forw();
+ curr_len = ch_length();
+ highest_hilite = until_hilite ? curr_len : NULL_POSITION;
+ ignore_eoi = 1;
+ while (!sigs)
+ {
+ if (until_hilite && highest_hilite > curr_len)
+ {
+ bell();
+ break;
+ }
+ make_display();
+ forward(1, 0, 0);
+ }
+ ignore_eoi = 0;
+
+ /*
+ * This gets us back in "F mode" after processing
+ * a non-abort signal (e.g. window-change).
+ */
+ if (sigs && !ABORT_SIGS())
+ return (A_F_FOREVER);
+ return (A_NOACTION);
+}
+
+/*
* Main command processor.
* Accept and execute commands until a quit command.
*/
@@ -973,6 +1011,7 @@ commands()
IFILE old_ifile;
IFILE new_ifile;
char *tagfile;
+ int until_hilite = 0;
search_type = SRCH_FORW;
wscroll = (sc_height + 1) / 2;
@@ -1200,23 +1239,11 @@ commands()
/*
* Forward forever, ignoring EOF.
*/
- if (ch_getflags() & CH_HELPFILE)
- break;
- cmd_exec();
- jump_forw();
- ignore_eoi = 1;
- while (!sigs)
- {
- make_display();
- forward(1, 0, 0);
- }
- ignore_eoi = 0;
- /*
- * This gets us back in "F mode" after processing
- * a non-abort signal (e.g. window-change).
- */
- if (sigs && !ABORT_SIGS())
- newaction = A_F_FOREVER;
+ newaction = forw_loop(0);
+ break;
+
+ case A_F_UNTIL_HILITE:
+ newaction = forw_loop(1);
break;
case A_F_SCROLL:
diff --git a/configure b/configure
index f2a7c8c73b3b..de1606173c30 100755
--- a/configure
+++ b/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.67 for less 1.
+# Generated by GNU Autoconf 2.68 for less 1.
#
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
@@ -89,6 +89,7 @@ fi
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
case $0 in #((
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -214,11 +215,18 @@ IFS=$as_save_IFS
# We cannot yet assume a decent shell, so we have to provide a
# neutralization value for shells without unset; and this also
# works around shells that cannot unset nonexistent variables.
+ # Preserve -v and -x to the replacement shell.
BASH_ENV=/dev/null
ENV=/dev/null
(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+ case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+ esac
+ exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
fi
if test x$as_have_required = xno; then :
@@ -1067,7 +1075,7 @@ Try \`$0 --help' for more information"
$as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
$as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
- : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
+ : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
;;
esac
@@ -1281,7 +1289,7 @@ Optional Packages:
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-secure Compile in secure mode
--with-no-float Do not use floating point
- --with-regex={auto,pcre,posix,regcmp,re_comp,regcomp,regcomp-local} Select a regular expression library auto
+ --with-regex={auto,gnu,pcre,posix,regcmp,re_comp,regcomp,regcomp-local,none} Select a regular expression library auto
--with-editor=PROGRAM use PROGRAM as the default editor vi
Some influential environment variables:
@@ -1361,7 +1369,7 @@ test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
less configure 1
-generated by GNU Autoconf 2.67
+generated by GNU Autoconf 2.68
Copyright (C) 2010 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
@@ -1407,7 +1415,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_compile
@@ -1453,7 +1461,7 @@ fi
# interfere with the next link command; also delete a directory that is
# left behind by Apple's compiler. We do this before executing the actions.
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_link
@@ -1490,7 +1498,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_cpp
@@ -1532,7 +1540,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=$ac_status
fi
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
as_fn_set_status $ac_retval
} # ac_fn_c_try_run
@@ -1545,10 +1553,10 @@ fi
ac_fn_c_check_header_mongrel ()
{
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- if eval "test \"\${$3+set}\"" = set; then :
+ if eval \${$3+:} false; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
fi
eval ac_res=\$$3
@@ -1611,7 +1619,7 @@ $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
esac
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
eval "$3=\$ac_header_compiler"
@@ -1620,7 +1628,7 @@ eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
fi
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_header_mongrel
@@ -1633,7 +1641,7 @@ ac_fn_c_check_header_compile ()
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -1651,7 +1659,7 @@ fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_header_compile
@@ -1664,7 +1672,7 @@ ac_fn_c_check_type ()
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
eval "$3=no"
@@ -1705,7 +1713,7 @@ fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_type
@@ -1717,7 +1725,7 @@ ac_fn_c_check_func ()
as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
$as_echo_n "checking for $2... " >&6; }
-if eval "test \"\${$3+set}\"" = set; then :
+if eval \${$3+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -1772,7 +1780,7 @@ fi
eval ac_res=\$$3
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
} # ac_fn_c_check_func
cat >config.log <<_ACEOF
@@ -1780,7 +1788,7 @@ This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by less $as_me 1, which was
-generated by GNU Autoconf 2.67. Invocation command line was
+generated by GNU Autoconf 2.68. Invocation command line was
$ $0 $@
@@ -2142,7 +2150,7 @@ if test -n "$ac_tool_prefix"; then
set dummy ${ac_tool_prefix}gcc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
@@ -2182,7 +2190,7 @@ if test -z "$ac_cv_prog_CC"; then
set dummy gcc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CC"; then
@@ -2235,7 +2243,7 @@ if test -z "$CC"; then
set dummy ${ac_tool_prefix}cc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
@@ -2275,7 +2283,7 @@ if test -z "$CC"; then
set dummy cc; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
@@ -2334,7 +2342,7 @@ if test -z "$CC"; then
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then :
+if ${ac_cv_prog_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
@@ -2378,7 +2386,7 @@ do
set dummy $ac_prog; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CC"; then
@@ -2661,7 +2669,7 @@ rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
ac_clean_files=$ac_clean_files_save
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
$as_echo_n "checking for suffix of object files... " >&6; }
-if test "${ac_cv_objext+set}" = set; then :
+if ${ac_cv_objext+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -2712,7 +2720,7 @@ OBJEXT=$ac_cv_objext
ac_objext=$OBJEXT
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if test "${ac_cv_c_compiler_gnu+set}" = set; then :
+if ${ac_cv_c_compiler_gnu+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -2749,7 +2757,7 @@ ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
$as_echo_n "checking whether $CC accepts -g... " >&6; }
-if test "${ac_cv_prog_cc_g+set}" = set; then :
+if ${ac_cv_prog_cc_g+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_save_c_werror_flag=$ac_c_werror_flag
@@ -2827,7 +2835,7 @@ else
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then :
+if ${ac_cv_prog_cc_c89+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_cv_prog_cc_c89=no
@@ -2925,7 +2933,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing strerror" >&5
$as_echo_n "checking for library containing strerror... " >&6; }
-if test "${ac_cv_search_strerror+set}" = set; then :
+if ${ac_cv_search_strerror+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
@@ -2959,11 +2967,11 @@ for ac_lib in '' cposix; do
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext
- if test "${ac_cv_search_strerror+set}" = set; then :
+ if ${ac_cv_search_strerror+:} false; then :
break
fi
done
-if test "${ac_cv_search_strerror+set}" = set; then :
+if ${ac_cv_search_strerror+:} false; then :
else
ac_cv_search_strerror=no
@@ -2991,7 +2999,7 @@ if test -n "$CPP" && test -d "$CPP"; then
CPP=
fi
if test -z "$CPP"; then
- if test "${ac_cv_prog_CPP+set}" = set; then :
+ if ${ac_cv_prog_CPP+:} false; then :
$as_echo_n "(cached) " >&6
else
# Double quotes because CPP needs to be expanded
@@ -3119,7 +3127,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if test "${ac_cv_path_GREP+set}" = set; then :
+if ${ac_cv_path_GREP+:} false; then :
$as_echo_n "(cached) " >&6
else
if test -z "$GREP"; then
@@ -3182,7 +3190,7 @@ $as_echo "$ac_cv_path_GREP" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
$as_echo_n "checking for egrep... " >&6; }
-if test "${ac_cv_path_EGREP+set}" = set; then :
+if ${ac_cv_path_EGREP+:} false; then :
$as_echo_n "(cached) " >&6
else
if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
@@ -3250,7 +3258,7 @@ $as_echo "$ac_cv_path_EGREP" >&6; }
if test $ac_cv_c_compiler_gnu = yes; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5
$as_echo_n "checking whether $CC needs -traditional... " >&6; }
-if test "${ac_cv_prog_gcc_traditional+set}" = set; then :
+if ${ac_cv_prog_gcc_traditional+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_pattern="Autoconf.*'x'"
@@ -3335,7 +3343,7 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
$as_echo_n "checking for a BSD-compatible install... " >&6; }
if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then :
+if ${ac_cv_path_install+:} false; then :
$as_echo_n "(cached) " >&6
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -3422,7 +3430,7 @@ if test "$enable_largefile" != no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
-if test "${ac_cv_sys_largefile_CC+set}" = set; then :
+if ${ac_cv_sys_largefile_CC+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_cv_sys_largefile_CC=no
@@ -3473,7 +3481,7 @@ $as_echo "$ac_cv_sys_largefile_CC" >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
-if test "${ac_cv_sys_file_offset_bits+set}" = set; then :
+if ${ac_cv_sys_file_offset_bits+:} false; then :
$as_echo_n "(cached) " >&6
else
while :; do
@@ -3542,7 +3550,7 @@ rm -rf conftest*
if test $ac_cv_sys_file_offset_bits = unknown; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5
$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
-if test "${ac_cv_sys_large_files+set}" = set; then :
+if ${ac_cv_sys_large_files+:} false; then :
$as_echo_n "(cached) " >&6
else
while :; do
@@ -3615,7 +3623,7 @@ fi
# Checks for general libraries.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgoto in -ltinfo" >&5
$as_echo_n "checking for tgoto in -ltinfo... " >&6; }
-if test "${ac_cv_lib_tinfo_tgoto+set}" = set; then :
+if ${ac_cv_lib_tinfo_tgoto+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -3649,7 +3657,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tinfo_tgoto" >&5
$as_echo "$ac_cv_lib_tinfo_tgoto" >&6; }
-if test "x$ac_cv_lib_tinfo_tgoto" = x""yes; then :
+if test "x$ac_cv_lib_tinfo_tgoto" = xyes; then :
have_tinfo=yes
else
have_tinfo=no
@@ -3657,7 +3665,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lxcurses" >&5
$as_echo_n "checking for initscr in -lxcurses... " >&6; }
-if test "${ac_cv_lib_xcurses_initscr+set}" = set; then :
+if ${ac_cv_lib_xcurses_initscr+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -3691,7 +3699,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_xcurses_initscr" >&5
$as_echo "$ac_cv_lib_xcurses_initscr" >&6; }
-if test "x$ac_cv_lib_xcurses_initscr" = x""yes; then :
+if test "x$ac_cv_lib_xcurses_initscr" = xyes; then :
have_xcurses=yes
else
have_xcurses=no
@@ -3699,7 +3707,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lncursesw" >&5
$as_echo_n "checking for initscr in -lncursesw... " >&6; }
-if test "${ac_cv_lib_ncursesw_initscr+set}" = set; then :
+if ${ac_cv_lib_ncursesw_initscr+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -3733,7 +3741,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncursesw_initscr" >&5
$as_echo "$ac_cv_lib_ncursesw_initscr" >&6; }
-if test "x$ac_cv_lib_ncursesw_initscr" = x""yes; then :
+if test "x$ac_cv_lib_ncursesw_initscr" = xyes; then :
have_ncursesw=yes
else
have_ncursesw=no
@@ -3741,7 +3749,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lncurses" >&5
$as_echo_n "checking for initscr in -lncurses... " >&6; }
-if test "${ac_cv_lib_ncurses_initscr+set}" = set; then :
+if ${ac_cv_lib_ncurses_initscr+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -3775,7 +3783,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncurses_initscr" >&5
$as_echo "$ac_cv_lib_ncurses_initscr" >&6; }
-if test "x$ac_cv_lib_ncurses_initscr" = x""yes; then :
+if test "x$ac_cv_lib_ncurses_initscr" = xyes; then :
have_ncurses=yes
else
have_ncurses=no
@@ -3783,7 +3791,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lcurses" >&5
$as_echo_n "checking for initscr in -lcurses... " >&6; }
-if test "${ac_cv_lib_curses_initscr+set}" = set; then :
+if ${ac_cv_lib_curses_initscr+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -3817,7 +3825,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_curses_initscr" >&5
$as_echo "$ac_cv_lib_curses_initscr" >&6; }
-if test "x$ac_cv_lib_curses_initscr" = x""yes; then :
+if test "x$ac_cv_lib_curses_initscr" = xyes; then :
have_curses=yes
else
have_curses=no
@@ -3825,7 +3833,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -ltermcap" >&5
$as_echo_n "checking for tgetent in -ltermcap... " >&6; }
-if test "${ac_cv_lib_termcap_tgetent+set}" = set; then :
+if ${ac_cv_lib_termcap_tgetent+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -3859,7 +3867,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_termcap_tgetent" >&5
$as_echo "$ac_cv_lib_termcap_tgetent" >&6; }
-if test "x$ac_cv_lib_termcap_tgetent" = x""yes; then :
+if test "x$ac_cv_lib_termcap_tgetent" = xyes; then :
have_termcap=yes
else
have_termcap=no
@@ -3867,7 +3875,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -ltermlib" >&5
$as_echo_n "checking for tgetent in -ltermlib... " >&6; }
-if test "${ac_cv_lib_termlib_tgetent+set}" = set; then :
+if ${ac_cv_lib_termlib_tgetent+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -3901,21 +3909,20 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_termlib_tgetent" >&5
$as_echo "$ac_cv_lib_termlib_tgetent" >&6; }
-if test "x$ac_cv_lib_termlib_tgetent" = x""yes; then :
+if test "x$ac_cv_lib_termlib_tgetent" = xyes; then :
have_termlib=yes
else
have_termlib=no
fi
-# Regular expressions (regcmp) are in -lgen on Solaris 2,
-# and in -lintl on SCO Unix.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for regcmp in -lgen" >&5
-$as_echo_n "checking for regcmp in -lgen... " >&6; }
-if test "${ac_cv_lib_gen_regcmp+set}" = set; then :
+# Regular expressions (regcmp) are in -lgen on Solaris 2, (but in libc
+# at least on Solaris 10 (2.10)) and in -lintl on SCO Unix.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing regcmp" >&5
+$as_echo_n "checking for library containing regcmp... " >&6; }
+if ${ac_cv_search_regcmp+:} false; then :
$as_echo_n "(cached) " >&6
else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lgen $LIBS"
+ ac_func_search_save_LIBS=$LIBS
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -3934,113 +3941,35 @@ return regcmp ();
return 0;
}
_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_gen_regcmp=yes
-else
- ac_cv_lib_gen_regcmp=no
+for ac_lib in '' gen intl PW; do
+ if test -z "$ac_lib"; then
+ ac_res="none required"
+ else
+ ac_res=-l$ac_lib
+ LIBS="-l$ac_lib $ac_func_search_save_LIBS"
+ fi
+ if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_search_regcmp=$ac_res
fi
rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gen_regcmp" >&5
-$as_echo "$ac_cv_lib_gen_regcmp" >&6; }
-if test "x$ac_cv_lib_gen_regcmp" = x""yes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBGEN 1
-_ACEOF
-
- LIBS="-lgen $LIBS"
-
+ conftest$ac_exeext
+ if ${ac_cv_search_regcmp+:} false; then :
+ break
fi
+done
+if ${ac_cv_search_regcmp+:} false; then :
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for regcmp in -lintl" >&5
-$as_echo_n "checking for regcmp in -lintl... " >&6; }
-if test "${ac_cv_lib_intl_regcmp+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lintl $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char regcmp ();
-int
-main ()
-{
-return regcmp ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_intl_regcmp=yes
else
- ac_cv_lib_intl_regcmp=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+ ac_cv_search_regcmp=no
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_regcmp" >&5
-$as_echo "$ac_cv_lib_intl_regcmp" >&6; }
-if test "x$ac_cv_lib_intl_regcmp" = x""yes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBINTL 1
-_ACEOF
-
- LIBS="-lintl $LIBS"
-
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for regcmp in -lPW" >&5
-$as_echo_n "checking for regcmp in -lPW... " >&6; }
-if test "${ac_cv_lib_PW_regcmp+set}" = set; then :
- $as_echo_n "(cached) " >&6
-else
- ac_check_lib_save_LIBS=$LIBS
-LIBS="-lPW $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char regcmp ();
-int
-main ()
-{
-return regcmp ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_lib_PW_regcmp=yes
-else
- ac_cv_lib_PW_regcmp=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-LIBS=$ac_check_lib_save_LIBS
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_PW_regcmp" >&5
-$as_echo "$ac_cv_lib_PW_regcmp" >&6; }
-if test "x$ac_cv_lib_PW_regcmp" = x""yes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_LIBPW 1
-_ACEOF
-
- LIBS="-lPW $LIBS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_regcmp" >&5
+$as_echo "$ac_cv_search_regcmp" >&6; }
+ac_res=$ac_cv_search_regcmp
+if test "$ac_res" != no; then :
+ test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
fi
@@ -4310,7 +4239,7 @@ LIBS="$LIBS $TERMLIBS"
# Checks for header files.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
$as_echo_n "checking for ANSI C header files... " >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then :
+if ${ac_cv_header_stdc+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4454,7 +4383,7 @@ done
# Checks for typedefs, structures, and compiler characteristics.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat file-mode macros are broken" >&5
$as_echo_n "checking whether stat file-mode macros are broken... " >&6; }
-if test "${ac_cv_header_stat_broken+set}" = set; then :
+if ${ac_cv_header_stat_broken+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4496,7 +4425,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
-if test "${ac_cv_c_const+set}" = set; then :
+if ${ac_cv_c_const+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4575,7 +4504,7 @@ $as_echo "#define const /**/" >>confdefs.h
fi
ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default"
-if test "x$ac_cv_type_off_t" = x""yes; then :
+if test "x$ac_cv_type_off_t" = xyes; then :
else
@@ -4586,7 +4515,7 @@ _ACEOF
fi
ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
-if test "x$ac_cv_type_size_t" = x""yes; then :
+if test "x$ac_cv_type_size_t" = xyes; then :
else
@@ -4598,7 +4527,7 @@ fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5
$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; }
-if test "${ac_cv_header_time+set}" = set; then :
+if ${ac_cv_header_time+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4661,9 +4590,10 @@ fi
+
# Checks for identifiers.
ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default"
-if test "x$ac_cv_type_off_t" = x""yes; then :
+if test "x$ac_cv_type_off_t" = xyes; then :
else
@@ -4766,7 +4696,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
# Checks for library functions.
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5
$as_echo_n "checking return type of signal handlers... " >&6; }
-if test "${ac_cv_type_signal+set}" = set; then :
+if ${ac_cv_type_signal+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -4894,7 +4824,7 @@ rm -f core conftest.err conftest.$ac_objext \
# Some systems have termios.h but not the corresponding functions.
ac_fn_c_check_func "$LINENO" "tcgetattr" "ac_cv_func_tcgetattr"
-if test "x$ac_cv_func_tcgetattr" = x""yes; then :
+if test "x$ac_cv_func_tcgetattr" = xyes; then :
$as_echo "#define HAVE_TERMIOS_FUNCS 1" >>confdefs.h
fi
@@ -4986,7 +4916,7 @@ rm -f core conftest.err conftest.$ac_objext \
ac_fn_c_check_type "$LINENO" "sigset_t" "ac_cv_type_sigset_t" "#include <signal.h>
"
-if test "x$ac_cv_type_sigset_t" = x""yes; then :
+if test "x$ac_cv_type_sigset_t" = xyes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_SIGSET_T 1
@@ -5337,10 +5267,57 @@ fi
fi
if test $have_regex = no; then
+if test $WANT_REGEX = auto -o $WANT_REGEX = gnu; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for re_compile_pattern in -lc" >&5
+$as_echo_n "checking for re_compile_pattern in -lc... " >&6; }
+if ${ac_cv_lib_c_re_compile_pattern+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lc $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char re_compile_pattern ();
+int
+main ()
+{
+return re_compile_pattern ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_c_re_compile_pattern=yes
+else
+ ac_cv_lib_c_re_compile_pattern=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_c_re_compile_pattern" >&5
+$as_echo "$ac_cv_lib_c_re_compile_pattern" >&6; }
+if test "x$ac_cv_lib_c_re_compile_pattern" = xyes; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: using gnu" >&5
+$as_echo "using gnu" >&6; }; $as_echo "#define HAVE_GNU_REGEX 1" >>confdefs.h
+ have_regex=yes
+fi
+
+fi
+fi
+
+if test $have_regex = no; then
if test $WANT_REGEX = auto -o $WANT_REGEX = pcre; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pcre_compile in -lpcre" >&5
$as_echo_n "checking for pcre_compile in -lpcre... " >&6; }
-if test "${ac_cv_lib_pcre_pcre_compile+set}" = set; then :
+if ${ac_cv_lib_pcre_pcre_compile+:} false; then :
$as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
@@ -5374,7 +5351,7 @@ LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcre_pcre_compile" >&5
$as_echo "$ac_cv_lib_pcre_pcre_compile" >&6; }
-if test "x$ac_cv_lib_pcre_pcre_compile" = x""yes; then :
+if test "x$ac_cv_lib_pcre_pcre_compile" = xyes; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: using pcre" >&5
$as_echo "using pcre" >&6; }; $as_echo "#define HAVE_PCRE 1" >>confdefs.h
LIBS="$LIBS -lpcre" have_regex=yes
@@ -5386,7 +5363,7 @@ fi
if test $have_regex = no; then
if test $WANT_REGEX = auto -o $WANT_REGEX = regcmp; then
ac_fn_c_check_func "$LINENO" "regcmp" "ac_cv_func_regcmp"
-if test "x$ac_cv_func_regcmp" = x""yes; then :
+if test "x$ac_cv_func_regcmp" = xyes; then :
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: using regcmp" >&5
$as_echo "using regcmp" >&6; }; $as_echo "#define HAVE_REGCMP 1" >>confdefs.h
have_regex=yes
@@ -5432,7 +5409,7 @@ if test $have_regex = no; then
if test $WANT_REGEX = auto -o $WANT_REGEX = re_comp; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: using re_comp" >&5
$as_echo "using re_comp" >&6; }; ac_fn_c_check_func "$LINENO" "re_comp" "ac_cv_func_re_comp"
-if test "x$ac_cv_func_re_comp" = x""yes; then :
+if test "x$ac_cv_func_re_comp" = xyes; then :
$as_echo "#define HAVE_RE_COMP 1" >>confdefs.h
have_regex=yes
fi
@@ -5441,6 +5418,13 @@ fi
fi
if test $have_regex = no; then
+if test $WANT_REGEX = auto -o $WANT_REGEX = none; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: using no regex" >&5
+$as_echo "using no regex" >&6; }; have_regex=yes;
+fi
+fi
+
+if test $have_regex = no; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot find regular expression library" >&5
$as_echo "cannot find regular expression library" >&6; }; $as_echo "#define NO_REGEX 1" >>confdefs.h
@@ -5527,10 +5511,21 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
:end' >>confcache
if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
if test -w "$cache_file"; then
- test "x$cache_file" != "x/dev/null" &&
+ if test "x$cache_file" != "x/dev/null"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
$as_echo "$as_me: updating cache $cache_file" >&6;}
- cat confcache >$cache_file
+ if test ! -f "$cache_file" || test -h "$cache_file"; then
+ cat confcache >"$cache_file"
+ else
+ case $cache_file in #(
+ */* | ?:*)
+ mv -f confcache "$cache_file"$$ &&
+ mv -f "$cache_file"$$ "$cache_file" ;; #(
+ *)
+ mv -f confcache "$cache_file" ;;
+ esac
+ fi
+ fi
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
@@ -5562,7 +5557,7 @@ LTLIBOBJS=$ac_ltlibobjs
-: ${CONFIG_STATUS=./config.status}
+: "${CONFIG_STATUS=./config.status}"
ac_write_fail=0
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files $CONFIG_STATUS"
@@ -5663,6 +5658,7 @@ fi
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
case $0 in #((
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -5970,7 +5966,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# values after options handling.
ac_log="
This file was extended by less $as_me 1, which was
-generated by GNU Autoconf 2.67. Invocation command line was
+generated by GNU Autoconf 2.68. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@@ -6032,7 +6028,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
less config.status 1
-configured by $0, generated by GNU Autoconf 2.67,
+configured by $0, generated by GNU Autoconf 2.68,
with options \\"\$ac_cs_config\\"
Copyright (C) 2010 Free Software Foundation, Inc.
@@ -6178,9 +6174,10 @@ fi
# after its creation but before its name has been assigned to `$tmp'.
$debug ||
{
- tmp=
+ tmp= ac_tmp=
trap 'exit_status=$?
- { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
+ : "${ac_tmp:=$tmp}"
+ { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
' 0
trap 'as_fn_exit 1' 1 2 13 15
}
@@ -6188,12 +6185,13 @@ $debug ||
{
tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
- test -n "$tmp" && test -d "$tmp"
+ test -d "$tmp"
} ||
{
tmp=./conf$$-$RANDOM
(umask 077 && mkdir "$tmp")
} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
# Set up the scripts for CONFIG_FILES section.
# No need to generate them if there are no CONFIG_FILES.
@@ -6215,7 +6213,7 @@ else
ac_cs_awk_cr=$ac_cr
fi
-echo 'BEGIN {' >"$tmp/subs1.awk" &&
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
_ACEOF
@@ -6243,7 +6241,7 @@ done
rm -f conf$$subs.sh
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
_ACEOF
sed -n '
h
@@ -6291,7 +6289,7 @@ t delim
rm -f conf$$subs.awk
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
_ACAWK
-cat >>"\$tmp/subs1.awk" <<_ACAWK &&
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
for (key in S) S_is_set[key] = 1
FS = ""
@@ -6323,7 +6321,7 @@ if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
else
cat
-fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
|| as_fn_error $? "could not setup config files machinery" "$LINENO" 5
_ACEOF
@@ -6357,7 +6355,7 @@ fi # test -n "$CONFIG_FILES"
# No need to generate them if there are no CONFIG_HEADERS.
# This happens for instance with `./config.status Makefile'.
if test -n "$CONFIG_HEADERS"; then
-cat >"$tmp/defines.awk" <<\_ACAWK ||
+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
BEGIN {
_ACEOF
@@ -6369,8 +6367,8 @@ _ACEOF
# handling of long lines.
ac_delim='%!_!# '
for ac_last_try in false false :; do
- ac_t=`sed -n "/$ac_delim/p" confdefs.h`
- if test -z "$ac_t"; then
+ ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
+ if test -z "$ac_tt"; then
break
elif $ac_last_try; then
as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
@@ -6490,7 +6488,7 @@ do
for ac_f
do
case $ac_f in
- -) ac_f="$tmp/stdin";;
+ -) ac_f="$ac_tmp/stdin";;
*) # Look for the file first in the build tree, then in the source tree
# (if the path is not absolute). The absolute path cannot be DOS-style,
# because $ac_f cannot contain `:'.
@@ -6525,7 +6523,7 @@ $as_echo "$as_me: creating $ac_file" >&6;}
esac
case $ac_tag in
- *:-:* | *:-) cat >"$tmp/stdin" \
+ *:-:* | *:-) cat >"$ac_tmp/stdin" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
esac
;;
@@ -6656,21 +6654,22 @@ s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
s&@INSTALL@&$ac_INSTALL&;t t
$ac_datarootdir_hack
"
-eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
- || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
- { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
- { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
+ "$ac_tmp/out"`; test -z "$ac_out"; } &&
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
which seems to be undefined. Please make sure it is defined" >&5
$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
which seems to be undefined. Please make sure it is defined" >&2;}
- rm -f "$tmp/stdin"
+ rm -f "$ac_tmp/stdin"
case $ac_file in
- -) cat "$tmp/out" && rm -f "$tmp/out";;
- *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
+ -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+ *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
esac \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
;;
@@ -6681,20 +6680,20 @@ which seems to be undefined. Please make sure it is defined" >&2;}
if test x"$ac_file" != x-; then
{
$as_echo "/* $configure_input */" \
- && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
- } >"$tmp/config.h" \
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
+ } >"$ac_tmp/config.h" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
- if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
+ if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
$as_echo "$as_me: $ac_file is unchanged" >&6;}
else
rm -f "$ac_file"
- mv "$tmp/config.h" "$ac_file" \
+ mv "$ac_tmp/config.h" "$ac_file" \
|| as_fn_error $? "could not create $ac_file" "$LINENO" 5
fi
else
$as_echo "/* $configure_input */" \
- && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
|| as_fn_error $? "could not create -" "$LINENO" 5
fi
;;
diff --git a/configure.ac b/configure.ac
index 0b386b075724..167f8ba623c5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -30,11 +30,9 @@ AC_CHECK_LIB(ncurses, initscr, [have_ncurses=yes], [have_ncurses=no])
AC_CHECK_LIB(curses, initscr, [have_curses=yes], [have_curses=no])
AC_CHECK_LIB(termcap, tgetent, [have_termcap=yes], [have_termcap=no])
AC_CHECK_LIB(termlib, tgetent, [have_termlib=yes], [have_termlib=no])
-# Regular expressions (regcmp) are in -lgen on Solaris 2,
-# and in -lintl on SCO Unix.
-AC_CHECK_LIB(gen, regcmp)
-AC_CHECK_LIB(intl, regcmp)
-AC_CHECK_LIB(PW, regcmp)
+# Regular expressions (regcmp) are in -lgen on Solaris 2, (but in libc
+# at least on Solaris 10 (2.10)) and in -lintl on SCO Unix.
+AC_SEARCH_LIBS([regcmp], [gen intl PW])
# Checks for terminal libraries
AC_MSG_CHECKING([for working terminal libraries])
@@ -179,6 +177,8 @@ AC_TYPE_SIZE_T
AC_HEADER_TIME
# Autoheader templates for symbols defined later by AC_DEFINE.
+AH_TEMPLATE([HAVE_GNU_REGEX],
+ [GNU regex library])
AH_TEMPLATE([HAVE_POSIX_REGCOMP],
[POSIX regcomp() and regex.h])
AH_TEMPLATE([HAVE_PCRE],
@@ -388,7 +388,7 @@ AC_MSG_CHECKING(for regcomp)
# Select a regular expression library.
WANT_REGEX=auto
AC_ARG_WITH(regex,
- [ --with-regex={auto,pcre,posix,regcmp,re_comp,regcomp,regcomp-local} Select a regular expression library [auto]],
+ [ --with-regex={auto,gnu,pcre,posix,regcmp,re_comp,regcomp,regcomp-local,none} Select a regular expression library [auto]],
WANT_REGEX="$withval")
if test $have_regex = no; then
@@ -426,6 +426,13 @@ fi
fi
if test $have_regex = no; then
+if test $WANT_REGEX = auto -o $WANT_REGEX = gnu; then
+AC_CHECK_LIB(c, re_compile_pattern,
+[AC_MSG_RESULT(using gnu); AC_DEFINE(HAVE_GNU_REGEX) have_regex=yes], [])
+fi
+fi
+
+if test $have_regex = no; then
if test $WANT_REGEX = auto -o $WANT_REGEX = pcre; then
AC_CHECK_LIB(pcre, pcre_compile,
[AC_MSG_RESULT(using pcre); AC_DEFINE(HAVE_PCRE) LIBS="$LIBS -lpcre" have_regex=yes], [])
@@ -460,6 +467,12 @@ fi
fi
if test $have_regex = no; then
+if test $WANT_REGEX = auto -o $WANT_REGEX = none; then
+AC_MSG_RESULT(using no regex); have_regex=yes;
+fi
+fi
+
+if test $have_regex = no; then
AC_MSG_RESULT(cannot find regular expression library); AC_DEFINE(NO_REGEX)
fi
diff --git a/cvt.c b/cvt.c
index 74439847e013..85838c48ee76 100644
--- a/cvt.c
+++ b/cvt.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
* Routines to convert text in various ways. Used by search.
@@ -64,6 +63,7 @@ cvt_text(odst, osrc, chpos, lenp, ops)
int ops;
{
char *dst;
+ char *edst = odst;
char *src;
register char *src_end;
LWCHAR ch;
@@ -98,23 +98,17 @@ cvt_text(odst, osrc, chpos, lenp, ops)
if ((ops & CVT_TO_LC) && IS_UPPER(ch))
ch = TO_LOWER(ch);
put_wchar(&dst, ch);
- /*
- * Record the original position of the char.
- * But if we've already recorded a position
- * for this char (due to a backspace), leave
- * it alone; if multiple source chars map to
- * one destination char, we want the position
- * of the first one.
- */
- if (chpos != NULL && chpos[dst_pos] < 0)
+ /* Record the original position of the char. */
+ if (chpos != NULL)
chpos[dst_pos] = src_pos;
}
+ if (dst > edst)
+ edst = dst;
}
- if ((ops & CVT_CRLF) && dst > odst && dst[-1] == '\r')
- dst--;
- *dst = '\0';
+ if ((ops & CVT_CRLF) && edst > odst && edst[-1] == '\r')
+ edst--;
+ *edst = '\0';
if (lenp != NULL)
- *lenp = dst - odst;
- if (chpos != NULL)
- chpos[dst - odst] = src - osrc;
+ *lenp = edst - odst;
+ /* FIXME: why was this here? if (chpos != NULL) chpos[dst - odst] = src - osrc; */
}
diff --git a/decode.c b/decode.c
index 65d65bb65624..f83a3b638790 100644
--- a/decode.c
+++ b/decode.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
@@ -79,6 +78,7 @@ static unsigned char cmdtable[] =
'w',0, A_B_WINDOW,
ESC,' ',0, A_FF_SCREEN,
'F',0, A_F_FOREVER,
+ ESC,'F',0, A_F_UNTIL_HILITE,
'R',0, A_FREPAINT,
'r',0, A_REPAINT,
CONTROL('R'),0, A_REPAINT,
diff --git a/defines.ds b/defines.ds
index 4dbbd6518a18..f344a76816e4 100644
--- a/defines.ds
+++ b/defines.ds
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/* DOS definition file for less. */
diff --git a/defines.h.in b/defines.h.in
index 8d4506383f75..a5e8b69d6406 100644
--- a/defines.h.in
+++ b/defines.h.in
@@ -225,18 +225,12 @@
/* Define to 1 if you have the `fsync' function. */
#undef HAVE_FSYNC
+/* GNU regex library */
+#undef HAVE_GNU_REGEX
+
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
-/* Define to 1 if you have the `gen' library (-lgen). */
-#undef HAVE_LIBGEN
-
-/* Define to 1 if you have the `intl' library (-lintl). */
-#undef HAVE_LIBINTL
-
-/* Define to 1 if you have the `PW' library (-lPW). */
-#undef HAVE_LIBPW
-
/* Define to 1 if you have the <limits.h> header file. */
#undef HAVE_LIMITS_H
diff --git a/defines.o2 b/defines.o2
index 0fd8cc735036..4ffa45fcdb4d 100644
--- a/defines.o2
+++ b/defines.o2
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/* OS/2 definition file for less. */
diff --git a/defines.o9 b/defines.o9
index 3bb1d2cb8caa..278db64024cc 100644
--- a/defines.o9
+++ b/defines.o9
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/* OS/9 definition file for less. */
diff --git a/defines.wn b/defines.wn
index 416a548e745c..07a71eb85029 100644
--- a/defines.wn
+++ b/defines.wn
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/* Windows definition file for less. */
diff --git a/edit.c b/edit.c
index 4781d95988e4..96236b07664a 100644
--- a/edit.c
+++ b/edit.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
#include "less.h"
@@ -310,6 +309,10 @@ edit_ifile(ifile)
*/
__djgpp_set_ctrl_c(1);
#endif
+ } else if (strcmp(open_filename, FAKE_EMPTYFILE) == 0)
+ {
+ f = -1;
+ chflags |= CH_NODATA;
} else if (strcmp(open_filename, FAKE_HELPFILE) == 0)
{
f = -1;
diff --git a/filename.c b/filename.c
index 0bbe82ab21cd..e99f81a099b5 100644
--- a/filename.c
+++ b/filename.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
@@ -807,6 +806,27 @@ lglob(filename)
}
/*
+ * Return number of %s escapes in a string.
+ * Return a large number if there are any other % escapes besides %s.
+ */
+ static int
+num_pct_s(lessopen)
+ char *lessopen;
+{
+ int num;
+
+ for (num = 0;; num++)
+ {
+ lessopen = strchr(lessopen, '%');
+ if (lessopen == NULL)
+ break;
+ if (*++lessopen != 's')
+ return (999);
+ }
+ return (num);
+}
+
+/*
* See if we should open a "replacement file"
* instead of the file we're about to open.
*/
@@ -832,7 +852,7 @@ open_altfile(filename, pf, pfd)
ch_ungetchar(-1);
if ((lessopen = lgetenv("LESSOPEN")) == NULL)
return (NULL);
- if (*lessopen == '|')
+ while (*lessopen == '|')
{
/*
* If LESSOPEN starts with a |, it indicates
@@ -843,7 +863,7 @@ open_altfile(filename, pf, pfd)
return (NULL);
#else
lessopen++;
- returnfd = 1;
+ returnfd++;
#endif
}
if (*lessopen == '-') {
@@ -855,6 +875,11 @@ open_altfile(filename, pf, pfd)
if (strcmp(filename, "-") == 0)
return (NULL);
}
+ if (num_pct_s(lessopen) > 1)
+ {
+ error("Invalid LESSOPEN variable", NULL_PARG);
+ return (NULL);
+ }
len = strlen(lessopen) + strlen(filename) + 2;
cmd = (char *) ecalloc(len, sizeof(char));
@@ -883,9 +908,18 @@ open_altfile(filename, pf, pfd)
if (read(f, &c, 1) != 1)
{
/*
- * Pipe is empty. This means there is no alt file.
+ * Pipe is empty.
+ * If more than 1 pipe char was specified,
+ * the exit status tells whether the file itself
+ * is empty, or if there is no alt file.
+ * If only one pipe char, just assume no alt file.
*/
- pclose(fd);
+ int status = pclose(fd);
+ if (returnfd > 1 && status == 0) {
+ *pfd = NULL;
+ *pf = -1;
+ return (save(FAKE_EMPTYFILE));
+ }
return (NULL);
}
ch_ungetchar(c);
@@ -935,6 +969,11 @@ close_altfile(altfilename, filename, pipefd)
}
if ((lessclose = lgetenv("LESSCLOSE")) == NULL)
return;
+ if (num_pct_s(lessclose) > 2)
+ {
+ error("Invalid LESSCLOSE variable");
+ return;
+ }
len = strlen(lessclose) + strlen(filename) + strlen(altfilename) + 2;
cmd = (char *) ecalloc(len, sizeof(char));
SNPRINTF2(cmd, len, lessclose, filename, altfilename);
diff --git a/forwback.c b/forwback.c
index ebe422d9446d..ec744484e927 100644
--- a/forwback.c
+++ b/forwback.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
diff --git a/help.c b/help.c
index 85b0a4adf946..07d62985b68d 100644
--- a/help.c
+++ b/help.c
@@ -6,6 +6,7 @@ constant char helpdata[] = {
'\n',
' ',' ',' ',' ',' ',' ','C','o','m','m','a','n','d','s',' ','m','a','r','k','e','d',' ','w','i','t','h',' ','*',' ','m','a','y',' ','b','e',' ','p','r','e','c','e','d','e','d',' ','b','y',' ','a',' ','n','u','m','b','e','r',',',' ','_','\b','N','.','\n',
' ',' ',' ',' ',' ',' ','N','o','t','e','s',' ','i','n',' ','p','a','r','e','n','t','h','e','s','e','s',' ','i','n','d','i','c','a','t','e',' ','t','h','e',' ','b','e','h','a','v','i','o','r',' ','i','f',' ','_','\b','N',' ','i','s',' ','g','i','v','e','n','.','\n',
+' ',' ',' ',' ',' ',' ','A',' ','k','e','y',' ','p','r','e','c','e','d','e','d',' ','b','y',' ','a',' ','c','a','r','a','t',' ','i','n','d','i','c','a','t','e','s',' ','t','h','e',' ','C','t','r','l',' ','k','e','y',';',' ','t','h','u','s',' ','^','K',' ','i','s',' ','c','t','r','l','-','K','.','\n',
'\n',
' ',' ','h',' ',' ','H',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','i','s','p','l','a','y',' ','t','h','i','s',' ','h','e','l','p','.','\n',
' ',' ','q',' ',' ',':','q',' ',' ','Q',' ',' ',':','Q',' ',' ','Z','Z',' ',' ',' ',' ',' ','E','x','i','t','.','\n',
@@ -43,7 +44,7 @@ constant char helpdata[] = {
' ',' ','E','S','C','-','u',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','U','n','d','o',' ','(','t','o','g','g','l','e',')',' ','s','e','a','r','c','h',' ','h','i','g','h','l','i','g','h','t','i','n','g','.','\n',
' ',' ','&','_','\b','p','_','\b','a','_','\b','t','_','\b','t','_','\b','e','_','\b','r','_','\b','n',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','D','i','s','p','l','a','y',' ','o','n','l','y',' ','m','a','t','c','h','i','n','g',' ','l','i','n','e','s','\n',
' ',' ',' ',' ',' ',' ',' ',' ','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\n',
-' ',' ',' ',' ',' ',' ',' ',' ','S','e','a','r','c','h',' ','p','a','t','t','e','r','n','s',' ','m','a','y',' ','b','e',' ','m','o','d','i','f','i','e','d',' ','b','y',' ','o','n','e',' ','o','r',' ','m','o','r','e',' ','o','f',':','\n',
+' ',' ',' ',' ',' ',' ',' ',' ','A',' ','s','e','a','r','c','h',' ','p','a','t','t','e','r','n',' ','m','a','y',' ','b','e',' ','p','r','e','c','e','d','e','d',' ','b','y',' ','o','n','e',' ','o','r',' ','m','o','r','e',' ','o','f',':','\n',
' ',' ',' ',' ',' ',' ',' ',' ','^','N',' ','o','r',' ','!',' ',' ','S','e','a','r','c','h',' ','f','o','r',' ','N','O','N','-','m','a','t','c','h','i','n','g',' ','l','i','n','e','s','.','\n',
' ',' ',' ',' ',' ',' ',' ',' ','^','E',' ','o','r',' ','*',' ',' ','S','e','a','r','c','h',' ','m','u','l','t','i','p','l','e',' ','f','i','l','e','s',' ','(','p','a','s','s',' ','t','h','r','u',' ','E','N','D',' ','O','F',' ','F','I','L','E',')','.','\n',
' ',' ',' ',' ',' ',' ',' ',' ','^','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',
@@ -114,9 +115,9 @@ constant char helpdata[] = {
' ',' ','-','?',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','h','e','l','p','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','i','s','p','l','a','y',' ','h','e','l','p',' ','(','f','r','o','m',' ','c','o','m','m','a','n','d',' ','l','i','n','e',')','.','\n',
' ',' ','-','a',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','s','e','a','r','c','h','-','s','k','i','p','-','s','c','r','e','e','n','\n',
-' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','F','o','r','w','a','r','d',' ','s','e','a','r','c','h',' ','s','k','i','p','s',' ','c','u','r','r','e','n','t',' ','s','c','r','e','e','n','.','\n',
+' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','S','e','a','r','c','h',' ','s','k','i','p','s',' ','c','u','r','r','e','n','t',' ','s','c','r','e','e','n','.','\n',
' ',' ','-','A',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','S','E','A','R','C','H','-','S','K','I','P','-','S','C','R','E','E','N','\n',
-' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','F','o','r','w','a','r','d',' ','s','e','a','r','c','h',' ','a','l','w','a','y','s',' ','s','k','i','p','s',' ','t','a','r','g','e','t',' ','l','i','n','e','.','\n',
+' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','S','e','a','r','c','h',' ','s','t','a','r','t','s',' ','j','u','s','t',' ','a','f','t','e','r',' ','t','a','r','g','e','t',' ','l','i','n','e','.','\n',
' ',' ','-','b',' ','[','_','\b','N',']',' ',' ','.','.','.','.',' ',' ','-','-','b','u','f','f','e','r','s','=','[','_','\b','N',']','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','N','u','m','b','e','r',' ','o','f',' ','b','u','f','f','e','r','s','.','\n',
' ',' ','-','B',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','a','u','t','o','-','b','u','f','f','e','r','s','\n',
@@ -172,7 +173,7 @@ constant char helpdata[] = {
' ',' ','-','s',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','s','q','u','e','e','z','e','-','b','l','a','n','k','-','l','i','n','e','s','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','S','q','u','e','e','z','e',' ','m','u','l','t','i','p','l','e',' ','b','l','a','n','k',' ','l','i','n','e','s','.','\n',
' ',' ','-','S',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','c','h','o','p','-','l','o','n','g','-','l','i','n','e','s','\n',
-' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','C','h','o','p',' ','l','o','n','g',' ','l','i','n','e','s','.','\n',
+' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','C','h','o','p',' ','(','t','r','u','n','c','a','t','e',')',' ','l','o','n','g',' ','l','i','n','e','s',' ','r','a','t','h','e','r',' ','t','h','a','n',' ','w','r','a','p','p','i','n','g','.','\n',
' ',' ','-','t',' ','[','_','\b','t','_','\b','a','_','\b','g',']',' ',' ','.','.',' ',' ','-','-','t','a','g','=','[','_','\b','t','_','\b','a','_','\b','g',']','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','F','i','n','d',' ','a',' ','t','a','g','.','\n',
' ',' ','-','T',' ','[','_','\b','t','_','\b','a','_','\b','g','_','\b','s','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']',' ','-','-','t','a','g','-','f','i','l','e','=','[','_','\b','t','_','\b','a','_','\b','g','_','\b','s','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']','\n',
@@ -189,8 +190,6 @@ constant char helpdata[] = {
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','S','e','t',' ','t','a','b',' ','s','t','o','p','s','.','\n',
' ',' ','-','X',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','n','o','-','i','n','i','t','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','u','s','e',' ','t','e','r','m','c','a','p',' ','i','n','i','t','/','d','e','i','n','i','t',' ','s','t','r','i','n','g','s','.','\n',
-' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','-','-','n','o','-','k','e','y','p','a','d','\n',
-' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','u','s','e',' ','t','e','r','m','c','a','p',' ','k','e','y','p','a','d',' ','i','n','i','t','/','d','e','i','n','i','t',' ','s','t','r','i','n','g','s','.','\n',
' ',' ','-','y',' ','[','_','\b','N',']',' ',' ','.','.','.','.',' ',' ','-','-','m','a','x','-','f','o','r','w','-','s','c','r','o','l','l','=','[','_','\b','N',']','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','F','o','r','w','a','r','d',' ','s','c','r','o','l','l',' ','l','i','m','i','t','.','\n',
' ',' ','-','z',' ','[','_','\b','N',']',' ',' ','.','.','.','.',' ',' ','-','-','w','i','n','d','o','w','=','[','_','\b','N',']','\n',
@@ -202,7 +201,7 @@ constant char helpdata[] = {
' ',' ','-','#',' ','[','_','\b','N',']',' ',' ','.','.','.','.',' ',' ','-','-','s','h','i','f','t','=','[','_','\b','N',']','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','H','o','r','i','z','o','n','t','a','l',' ','s','c','r','o','l','l',' ','a','m','o','u','n','t',' ','(','0',' ','=',' ','o','n','e',' ','h','a','l','f',' ','s','c','r','e','e','n',' ','w','i','d','t','h',')','\n',
' ',' ',' ',' ',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','n','o','-','k','e','y','p','a','d','\n',
-' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','s','e','n','d',' ','k','e','y','p','a','d',' ','i','n','i','t','/','d','e','i','n','i','t',' ','s','e','q','u','e','n','c','e','.','\n',
+' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','s','e','n','d',' ','t','e','r','m','c','a','p',' ','k','e','y','p','a','d',' ','i','n','i','t','/','d','e','i','n','i','t',' ','s','t','r','i','n','g','s','.','\n',
' ',' ',' ',' ',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','f','o','l','l','o','w','-','n','a','m','e','\n',
' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','T','h','e',' ','F',' ','c','o','m','m','a','n','d',' ','c','h','a','n','g','e','s',' ','f','i','l','e','s',' ','i','f',' ','t','h','e',' ','i','n','p','u','t',' ','f','i','l','e',' ','i','s',' ','r','e','n','a','m','e','d','.','\n',
'\n',
@@ -216,20 +215,20 @@ constant char helpdata[] = {
'\n',
' ','R','i','g','h','t','A','r','r','o','w',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','S','C','-','l',' ',' ',' ',' ',' ','M','o','v','e',' ','c','u','r','s','o','r',' ','r','i','g','h','t',' ','o','n','e',' ','c','h','a','r','a','c','t','e','r','.','\n',
' ','L','e','f','t','A','r','r','o','w',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','S','C','-','h',' ',' ',' ',' ',' ','M','o','v','e',' ','c','u','r','s','o','r',' ','l','e','f','t',' ','o','n','e',' ','c','h','a','r','a','c','t','e','r','.','\n',
-' ','C','N','T','L','-','R','i','g','h','t','A','r','r','o','w',' ',' ','E','S','C','-','R','i','g','h','t','A','r','r','o','w',' ',' ','E','S','C','-','w',' ',' ',' ',' ',' ','M','o','v','e',' ','c','u','r','s','o','r',' ','r','i','g','h','t',' ','o','n','e',' ','w','o','r','d','.','\n',
-' ','C','N','T','L','-','L','e','f','t','A','r','r','o','w',' ',' ',' ','E','S','C','-','L','e','f','t','A','r','r','o','w',' ',' ',' ','E','S','C','-','b',' ',' ',' ',' ',' ','M','o','v','e',' ','c','u','r','s','o','r',' ','l','e','f','t',' ','o','n','e',' ','w','o','r','d','.','\n',
+' ','c','t','r','l','-','R','i','g','h','t','A','r','r','o','w',' ',' ','E','S','C','-','R','i','g','h','t','A','r','r','o','w',' ',' ','E','S','C','-','w',' ',' ',' ',' ',' ','M','o','v','e',' ','c','u','r','s','o','r',' ','r','i','g','h','t',' ','o','n','e',' ','w','o','r','d','.','\n',
+' ','c','t','r','l','-','L','e','f','t','A','r','r','o','w',' ',' ',' ','E','S','C','-','L','e','f','t','A','r','r','o','w',' ',' ',' ','E','S','C','-','b',' ',' ',' ',' ',' ','M','o','v','e',' ','c','u','r','s','o','r',' ','l','e','f','t',' ','o','n','e',' ','w','o','r','d','.','\n',
' ','H','O','M','E',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','S','C','-','0',' ',' ',' ',' ',' ','M','o','v','e',' ','c','u','r','s','o','r',' ','t','o',' ','s','t','a','r','t',' ','o','f',' ','l','i','n','e','.','\n',
' ','E','N','D',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','S','C','-','$',' ',' ',' ',' ',' ','M','o','v','e',' ','c','u','r','s','o','r',' ','t','o',' ','e','n','d',' ','o','f',' ','l','i','n','e','.','\n',
' ','B','A','C','K','S','P','A','C','E',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','e','l','e','t','e',' ','c','h','a','r',' ','t','o',' ','l','e','f','t',' ','o','f',' ','c','u','r','s','o','r','.','\n',
' ','D','E','L','E','T','E',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','S','C','-','x',' ',' ',' ',' ',' ','D','e','l','e','t','e',' ','c','h','a','r',' ','u','n','d','e','r',' ','c','u','r','s','o','r','.','\n',
-' ','C','N','T','L','-','B','A','C','K','S','P','A','C','E',' ',' ',' ','E','S','C','-','B','A','C','K','S','P','A','C','E',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','e','l','e','t','e',' ','w','o','r','d',' ','t','o',' ','l','e','f','t',' ','o','f',' ','c','u','r','s','o','r','.','\n',
-' ','C','N','T','L','-','D','E','L','E','T','E',' ',' ',' ',' ',' ',' ','E','S','C','-','D','E','L','E','T','E',' ',' ',' ',' ',' ',' ','E','S','C','-','X',' ',' ',' ',' ',' ','D','e','l','e','t','e',' ','w','o','r','d',' ','u','n','d','e','r',' ','c','u','r','s','o','r','.','\n',
-' ','C','N','T','L','-','U',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','S','C',' ','(','M','S','-','D','O','S',' ','o','n','l','y',')',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','e','l','e','t','e',' ','e','n','t','i','r','e',' ','l','i','n','e','.','\n',
+' ','c','t','r','l','-','B','A','C','K','S','P','A','C','E',' ',' ',' ','E','S','C','-','B','A','C','K','S','P','A','C','E',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','e','l','e','t','e',' ','w','o','r','d',' ','t','o',' ','l','e','f','t',' ','o','f',' ','c','u','r','s','o','r','.','\n',
+' ','c','t','r','l','-','D','E','L','E','T','E',' ',' ',' ',' ',' ',' ','E','S','C','-','D','E','L','E','T','E',' ',' ',' ',' ',' ',' ','E','S','C','-','X',' ',' ',' ',' ',' ','D','e','l','e','t','e',' ','w','o','r','d',' ','u','n','d','e','r',' ','c','u','r','s','o','r','.','\n',
+' ','c','t','r','l','-','U',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','S','C',' ','(','M','S','-','D','O','S',' ','o','n','l','y',')',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','e','l','e','t','e',' ','e','n','t','i','r','e',' ','l','i','n','e','.','\n',
' ','U','p','A','r','r','o','w',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','S','C','-','k',' ',' ',' ',' ',' ','R','e','t','r','i','e','v','e',' ','p','r','e','v','i','o','u','s',' ','c','o','m','m','a','n','d',' ','l','i','n','e','.','\n',
' ','D','o','w','n','A','r','r','o','w',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','S','C','-','j',' ',' ',' ',' ',' ','R','e','t','r','i','e','v','e',' ','n','e','x','t',' ','c','o','m','m','a','n','d',' ','l','i','n','e','.','\n',
' ','T','A','B',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','C','o','m','p','l','e','t','e',' ','f','i','l','e','n','a','m','e',' ','&',' ','c','y','c','l','e','.','\n',
' ','S','H','I','F','T','-','T','A','B',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','S','C','-','T','A','B',' ',' ',' ','C','o','m','p','l','e','t','e',' ','f','i','l','e','n','a','m','e',' ','&',' ','r','e','v','e','r','s','e',' ','c','y','c','l','e','.','\n',
-' ','C','N','T','L','-','L',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','C','o','m','p','l','e','t','e',' ','f','i','l','e','n','a','m','e',',',' ','l','i','s','t',' ','a','l','l','.','\n',
+' ','c','t','r','l','-','L',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','C','o','m','p','l','e','t','e',' ','f','i','l','e','n','a','m','e',',',' ','l','i','s','t',' ','a','l','l','.','\n',
'\n',
'\n',
0 };
diff --git a/ifile.c b/ifile.c
index 971e3b5e25e0..68bea9295710 100644
--- a/ifile.c
+++ b/ifile.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
diff --git a/input.c b/input.c
index b82868bca4d2..9e3cf036e5b3 100644
--- a/input.c
+++ b/input.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
@@ -416,7 +415,7 @@ get_back_line:
goto get_back_line;
}
- if (status_col && is_hilited(base_pos, ch_tell()-1, 1, NULL))
+ if (status_col && curr_pos > 0 && is_hilited(base_pos, curr_pos-1, 1, NULL))
set_status_col('*');
#endif
diff --git a/jump.c b/jump.c
index d7ec77046f80..90ab4b18e941 100644
--- a/jump.c
+++ b/jump.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
diff --git a/less.h b/less.h
index d0133452222a..3ef89b1d47d8 100644
--- a/less.h
+++ b/less.h
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
#define NEWBOT 1
@@ -485,10 +484,13 @@ struct textlist
#define CH_KEEPOPEN 002
#define CH_POPENED 004
#define CH_HELPFILE 010
+#define CH_NODATA 020 /* Special case for zero length files */
+
#define ch_zero() ((POSITION)0)
#define FAKE_HELPFILE "@/\\less/\\help/\\file/\\@"
+#define FAKE_EMPTYFILE "@/\\less/\\empty/\\file/\\@"
/* Flags for cvt_text */
#define CVT_TO_LC 01 /* Convert upper-case to lower-case */
diff --git a/less.hlp b/less.hlp
index 84d951f0d53f..1194a6339ba6 100644
--- a/less.hlp
+++ b/less.hlp
@@ -3,6 +3,7 @@
Commands marked with * may be preceded by a number, _N.
Notes in parentheses indicate the behavior if _N is given.
+ A key preceded by a carat indicates the Ctrl key; thus ^K is ctrl-K.
h H Display this help.
q :q Q :Q ZZ Exit.
@@ -40,7 +41,7 @@
ESC-u Undo (toggle) search highlighting.
&_p_a_t_t_e_r_n * Display only matching lines
---------------------------------------------------
- Search patterns may be modified by one or more of:
+ A search pattern may be preceded by one or more of:
^N or ! Search for NON-matching lines.
^E or * Search multiple files (pass thru END OF FILE).
^F or @ Start search at FIRST file (for /) or last file (for ?).
@@ -111,9 +112,9 @@
-? ........ --help
Display help (from command line).
-a ........ --search-skip-screen
- Forward search skips current screen.
+ Search skips current screen.
-A ........ --SEARCH-SKIP-SCREEN
- Forward search always skips target line.
+ Search starts just after target line.
-b [_N] .... --buffers=[_N]
Number of buffers.
-B ........ --auto-buffers
@@ -169,7 +170,7 @@
-s ........ --squeeze-blank-lines
Squeeze multiple blank lines.
-S ........ --chop-long-lines
- Chop long lines.
+ Chop (truncate) long lines rather than wrapping.
-t [_t_a_g] .. --tag=[_t_a_g]
Find a tag.
-T [_t_a_g_s_f_i_l_e] --tag-file=[_t_a_g_s_f_i_l_e]
@@ -186,8 +187,6 @@
Set tab stops.
-X ........ --no-init
Don't use termcap init/deinit strings.
- --no-keypad
- Don't use termcap keypad init/deinit strings.
-y [_N] .... --max-forw-scroll=[_N]
Forward scroll limit.
-z [_N] .... --window=[_N]
@@ -199,7 +198,7 @@
-# [_N] .... --shift=[_N]
Horizontal scroll amount (0 = one half screen width)
........ --no-keypad
- Don't send keypad init/deinit sequence.
+ Don't send termcap keypad init/deinit strings.
........ --follow-name
The F command changes files if the input file is renamed.
@@ -213,19 +212,19 @@
RightArrow ESC-l Move cursor right one character.
LeftArrow ESC-h Move cursor left one character.
- CNTL-RightArrow ESC-RightArrow ESC-w Move cursor right one word.
- CNTL-LeftArrow ESC-LeftArrow ESC-b Move cursor left one word.
+ ctrl-RightArrow ESC-RightArrow ESC-w Move cursor right one word.
+ ctrl-LeftArrow ESC-LeftArrow ESC-b Move cursor left one word.
HOME ESC-0 Move cursor to start of line.
END ESC-$ Move cursor to end of line.
BACKSPACE Delete char to left of cursor.
DELETE ESC-x Delete char under cursor.
- CNTL-BACKSPACE ESC-BACKSPACE Delete word to left of cursor.
- CNTL-DELETE ESC-DELETE ESC-X Delete word under cursor.
- CNTL-U ESC (MS-DOS only) Delete entire line.
+ ctrl-BACKSPACE ESC-BACKSPACE Delete word to left of cursor.
+ ctrl-DELETE ESC-DELETE ESC-X Delete word under cursor.
+ ctrl-U ESC (MS-DOS only) Delete entire line.
UpArrow ESC-k Retrieve previous command line.
DownArrow ESC-j Retrieve next command line.
TAB Complete filename & cycle.
SHIFT-TAB ESC-TAB Complete filename & reverse cycle.
- CNTL-L Complete filename, list all.
+ ctrl-L Complete filename, list all.
diff --git a/less.man b/less.man
index a54609d953eb..913f38c45ea0 100644
--- a/less.man
+++ b/less.man
@@ -107,6 +107,10 @@ LESS(1) LESS(1)
which is growing while it is being viewed. (The behavior is
similar to the "tail -f" command.)
+ ESC-F Like F, but as soon as a line is found which matches the last
+ search pattern, the terminal bell is rung and forward scrolling
+ stops.
+
g or < or ESC-<
Go to line N in the file, default 1 (beginning of file). (Warn-
ing: this may be slow if N is large.)
@@ -709,59 +713,60 @@ LESS(1) LESS(1)
blank line. This is useful when viewing nroff output.
-S or --chop-long-lines
- Causes lines longer than the screen width to be chopped rather
- than folded. That is, the portion of a long line that does not
- fit in the screen width is not shown. The default is to fold
- long lines; that is, display the remainder on the next line.
+ Causes lines longer than the screen width to be chopped (trun-
+ cated) rather than wrapped. That is, the portion of a long line
+ that does not fit in the screen width is not shown. The default
+ is to wrap long lines; that is, display the remainder on the
+ next line.
-ttag or --tag=tag
The -t option, followed immediately by a TAG, will edit the file
- containing that tag. For this to work, tag information must be
- available; for example, there may be a file in the current
+ containing that tag. For this to work, tag information must be
+ available; for example, there may be a file in the current
directory called "tags", which was previously built by ctags (1)
or an equivalent command. If the environment variable LESSGLOB-
- ALTAGS is set, it is taken to be the name of a command compati-
- ble with global (1), and that command is executed to find the
+ ALTAGS is set, it is taken to be the name of a command compati-
+ ble with global (1), and that command is executed to find the
tag. (See http://www.gnu.org/software/global/global.html). The
- -t option may also be specified from within less (using the -
- command) as a way of examining a new file. The command ":t" is
+ -t option may also be specified from within less (using the -
+ command) as a way of examining a new file. The command ":t" is
equivalent to specifying -t from within less.
-Ttagsfile or --tag-file=tagsfile
Specifies a tags file to be used instead of "tags".
-u or --underline-special
- Causes backspaces and carriage returns to be treated as print-
- able characters; that is, they are sent to the terminal when
+ Causes backspaces and carriage returns to be treated as print-
+ able characters; that is, they are sent to the terminal when
they appear in the input.
-U or --UNDERLINE-SPECIAL
- Causes backspaces, tabs and carriage returns to be treated as
- control characters; that is, they are handled as specified by
+ Causes backspaces, tabs and carriage returns to be treated as
+ control characters; that is, they are handled as specified by
the -r option.
- By default, if neither -u nor -U is given, backspaces which
- appear adjacent to an underscore character are treated spe-
- cially: the underlined text is displayed using the terminal's
- hardware underlining capability. Also, backspaces which appear
- between two identical characters are treated specially: the
- overstruck text is printed using the terminal's hardware bold-
- face capability. Other backspaces are deleted, along with the
+ By default, if neither -u nor -U is given, backspaces which
+ appear adjacent to an underscore character are treated spe-
+ cially: the underlined text is displayed using the terminal's
+ hardware underlining capability. Also, backspaces which appear
+ between two identical characters are treated specially: the
+ overstruck text is printed using the terminal's hardware bold-
+ face capability. Other backspaces are deleted, along with the
preceding character. Carriage returns immediately followed by a
- newline are deleted. other carriage returns are handled as
- specified by the -r option. Text which is overstruck or under-
+ newline are deleted. Other carriage returns are handled as
+ specified by the -r option. Text which is overstruck or under-
lined can be searched for if neither -u nor -U is in effect.
-V or --version
Displays the version number of less.
-w or --hilite-unread
- Temporarily highlights the first "new" line after a forward
+ Temporarily highlights the first "new" line after a forward
movement of a full page. The first "new" line is the line imme-
- diately following the line previously at the bottom of the
+ diately following the line previously at the bottom of the
screen. Also highlights the target line after a g or p command.
- The highlight is removed at the next command which causes move-
- ment. The entire line is highlighted, unless the -J option is
+ The highlight is removed at the next command which causes move-
+ ment. The entire line is highlighted, unless the -J option is
in effect, in which case only the status column is highlighted.
-W or --HILITE-UNREAD
@@ -769,48 +774,48 @@ LESS(1) LESS(1)
forward movement command larger than one line.
-xn,... or --tabs=n,...
- Sets tab stops. If only one n is specified, tab stops are set
- at multiples of n. If multiple values separated by commas are
- specified, tab stops are set at those positions, and then con-
- tinue with the same spacing as the last two. For example,
- -x9,17 will set tabs at positions 9, 17, 25, 33, etc. The
+ Sets tab stops. If only one n is specified, tab stops are set
+ at multiples of n. If multiple values separated by commas are
+ specified, tab stops are set at those positions, and then con-
+ tinue with the same spacing as the last two. For example,
+ -x9,17 will set tabs at positions 9, 17, 25, 33, etc. The
default for n is 8.
-X or --no-init
Disables sending the termcap initialization and deinitialization
- strings to the terminal. This is sometimes desirable if the
- deinitialization string does something unnecessary, like clear-
+ strings to the terminal. This is sometimes desirable if the
+ deinitialization string does something unnecessary, like clear-
ing the screen.
-yn or --max-forw-scroll=n
Specifies a maximum number of lines to scroll forward. If it is
- necessary to scroll forward more than n lines, the screen is
- repainted instead. The -c or -C option may be used to repaint
- from the top of the screen if desired. By default, any forward
+ necessary to scroll forward more than n lines, the screen is
+ repainted instead. The -c or -C option may be used to repaint
+ from the top of the screen if desired. By default, any forward
movement causes scrolling.
-[z]n or --window=n
- Changes the default scrolling window size to n lines. The
+ Changes the default scrolling window size to n lines. The
default is one screenful. The z and w commands can also be used
- to change the window size. The "z" may be omitted for compati-
+ to change the window size. The "z" may be omitted for compati-
bility with some versions of more. If the number n is negative,
- it indicates n lines less than the current screen size. For
+ it indicates n lines less than the current screen size. For
example, if the screen is 24 lines, -z-4 sets the scrolling win-
- dow to 20 lines. If the screen is resized to 40 lines, the
+ dow to 20 lines. If the screen is resized to 40 lines, the
scrolling window automatically changes to 36 lines.
-"cc or --quotes=cc
- Changes the filename quoting character. This may be necessary
- if you are trying to name a file which contains both spaces and
- quote characters. Followed by a single character, this changes
- the quote character to that character. Filenames containing a
+ Changes the filename quoting character. This may be necessary
+ if you are trying to name a file which contains both spaces and
+ quote characters. Followed by a single character, this changes
+ the quote character to that character. Filenames containing a
space should then be surrounded by that character rather than by
- double quotes. Followed by two characters, changes the open
- quote to the first character, and the close quote to the second
+ double quotes. Followed by two characters, changes the open
+ quote to the first character, and the close quote to the second
character. Filenames containing a space should then be preceded
- by the open quote character and followed by the close quote
- character. Note that even after the quote characters are
- changed, this option remains -" (a dash followed by a double
+ by the open quote character and followed by the close quote
+ character. Note that even after the quote characters are
+ changed, this option remains -" (a dash followed by a double
quote).
-~ or --tilde
@@ -820,60 +825,60 @@ LESS(1) LESS(1)
-# or --shift
Specifies the default number of positions to scroll horizontally
- in the RIGHTARROW and LEFTARROW commands. If the number speci-
- fied is zero, it sets the default number of positions to one
+ in the RIGHTARROW and LEFTARROW commands. If the number speci-
+ fied is zero, it sets the default number of positions to one
half of the screen width. Alternately, the number may be speci-
- fied as a fraction of the width of the screen, starting with a
- decimal point: .5 is half of the screen width, .3 is three
- tenths of the screen width, and so on. If the number is speci-
- fied as a fraction, the actual number of scroll positions is
- recalculated if the terminal window is resized, so that the
- actual scroll remains at the specified fraction of the screen
+ fied as a fraction of the width of the screen, starting with a
+ decimal point: .5 is half of the screen width, .3 is three
+ tenths of the screen width, and so on. If the number is speci-
+ fied as a fraction, the actual number of scroll positions is
+ recalculated if the terminal window is resized, so that the
+ actual scroll remains at the specified fraction of the screen
width.
--no-keypad
- Disables sending the keypad initialization and deinitialization
+ Disables sending the keypad initialization and deinitialization
strings to the terminal. This is sometimes useful if the keypad
strings make the numeric keypad behave in an undesirable manner.
--follow-name
- Normally, if the input file is renamed while an F command is
- executing, less will continue to display the contents of the
- original file despite its name change. If --follow-name is
+ Normally, if the input file is renamed while an F command is
+ executing, less will continue to display the contents of the
+ original file despite its name change. If --follow-name is
specified, during an F command less will periodically attempt to
reopen the file by name. If the reopen succeeds and the file is
- a different file from the original (which means that a new file
- has been created with the same name as the original (now
+ a different file from the original (which means that a new file
+ has been created with the same name as the original (now
renamed) file), less will display the contents of that new file.
- -- A command line argument of "--" marks the end of option argu-
- ments. Any arguments following this are interpreted as file-
+ -- A command line argument of "--" marks the end of option argu-
+ ments. Any arguments following this are interpreted as file-
names. This can be useful when viewing a file whose name begins
with a "-" or "+".
- + If a command line option begins with +, the remainder of that
- option is taken to be an initial command to less. For example,
- +G tells less to start at the end of the file rather than the
- beginning, and +/xyz tells it to start at the first occurrence
- of "xyz" in the file. As a special case, +<number> acts like
+ + If a command line option begins with +, the remainder of that
+ option is taken to be an initial command to less. For example,
+ +G tells less to start at the end of the file rather than the
+ beginning, and +/xyz tells it to start at the first occurrence
+ of "xyz" in the file. As a special case, +<number> acts like
+<number>g; that is, it starts the display at the specified line
- number (however, see the caveat under the "g" command above).
- If the option starts with ++, the initial command applies to
- every file being viewed, not just the first one. The + command
+ number (however, see the caveat under the "g" command above).
+ If the option starts with ++, the initial command applies to
+ every file being viewed, not just the first one. The + command
described previously may also be used to set (or change) an ini-
tial command for every file.
LINE EDITING
- When entering command line at the bottom of the screen (for example, a
+ When entering command line at the bottom of the screen (for example, a
filename for the :e command, or the pattern for a search command), cer-
- tain keys can be used to manipulate the command line. Most commands
- have an alternate form in [ brackets ] which can be used if a key does
- not exist on a particular keyboard. (Note that the forms beginning
- with ESC do not work in some MS-DOS and Windows systems because ESC is
- the line erase character.) Any of these special keys may be entered
- literally by preceding it with the "literal" character, either ^V or
- ^A. A backslash itself may also be entered literally by entering two
+ tain keys can be used to manipulate the command line. Most commands
+ have an alternate form in [ brackets ] which can be used if a key does
+ not exist on a particular keyboard. (Note that the forms beginning
+ with ESC do not work in some MS-DOS and Windows systems because ESC is
+ the line erase character.) Any of these special keys may be entered
+ literally by preceding it with the "literal" character, either ^V or
+ ^A. A backslash itself may also be entered literally by entering two
backslashes.
LEFTARROW [ ESC-h ]
@@ -883,7 +888,7 @@ LESS(1) LESS(1)
Move the cursor one space to the right.
^LEFTARROW [ ESC-b or ESC-LEFTARROW ]
- (That is, CONTROL and LEFTARROW simultaneously.) Move the cur-
+ (That is, CONTROL and LEFTARROW simultaneously.) Move the cur-
sor one word to the left.
^RIGHTARROW [ ESC-w or ESC-RIGHTARROW ]
@@ -897,44 +902,48 @@ LESS(1) LESS(1)
Move the cursor to the end of the line.
BACKSPACE
- Delete the character to the left of the cursor, or cancel the
+ Delete the character to the left of the cursor, or cancel the
command if the command line is empty.
DELETE or [ ESC-x ]
Delete the character under the cursor.
^BACKSPACE [ ESC-BACKSPACE ]
- (That is, CONTROL and BACKSPACE simultaneously.) Delete the
+ (That is, CONTROL and BACKSPACE simultaneously.) Delete the
word to the left of the cursor.
^DELETE [ ESC-X or ESC-DELETE ]
- (That is, CONTROL and DELETE simultaneously.) Delete the word
+ (That is, CONTROL and DELETE simultaneously.) Delete the word
under the cursor.
UPARROW [ ESC-k ]
- Retrieve the previous command line.
+ Retrieve the previous command line. If you first enter some
+ text and then press UPARROW, it will retrieve the previous com-
+ mand which begins with that text.
DOWNARROW [ ESC-j ]
- Retrieve the next command line.
+ Retrieve the next command line. If you first enter some text
+ and then press DOWNARROW, it will retrieve the next command
+ which begins with that text.
- TAB Complete the partial filename to the left of the cursor. If it
- matches more than one filename, the first match is entered into
- the command line. Repeated TABs will cycle thru the other
+ TAB Complete the partial filename to the left of the cursor. If it
+ matches more than one filename, the first match is entered into
+ the command line. Repeated TABs will cycle thru the other
matching filenames. If the completed filename is a directory, a
- "/" is appended to the filename. (On MS-DOS systems, a "\" is
- appended.) The environment variable LESSSEPARATOR can be used
+ "/" is appended to the filename. (On MS-DOS systems, a "\" is
+ appended.) The environment variable LESSSEPARATOR can be used
to specify a different character to append to a directory name.
BACKTAB [ ESC-TAB ]
Like, TAB, but cycles in the reverse direction thru the matching
filenames.
- ^L Complete the partial filename to the left of the cursor. If it
+ ^L Complete the partial filename to the left of the cursor. If it
matches more than one filename, all matches are entered into the
command line (if they fit).
^U (Unix and OS/2) or ESC (MS-DOS)
- Delete the entire command line, or cancel the command if the
+ Delete the entire command line, or cancel the command if the
command line is empty. If you have changed your line-kill char-
acter in Unix to something other than ^U, that character is used
instead of ^U.
@@ -943,72 +952,72 @@ LESS(1) LESS(1)
KEY BINDINGS
- You may define your own less commands by using the program lesskey (1)
- to create a lesskey file. This file specifies a set of command keys
- and an action associated with each key. You may also use lesskey to
+ You may define your own less commands by using the program lesskey (1)
+ to create a lesskey file. This file specifies a set of command keys
+ and an action associated with each key. You may also use lesskey to
change the line-editing keys (see LINE EDITING), and to set environment
- variables. If the environment variable LESSKEY is set, less uses that
- as the name of the lesskey file. Otherwise, less looks in a standard
- place for the lesskey file: On Unix systems, less looks for a lesskey
- file called "$HOME/.less". On MS-DOS and Windows systems, less looks
- for a lesskey file called "$HOME/_less", and if it is not found there,
+ variables. If the environment variable LESSKEY is set, less uses that
+ as the name of the lesskey file. Otherwise, less looks in a standard
+ place for the lesskey file: On Unix systems, less looks for a lesskey
+ file called "$HOME/.less". On MS-DOS and Windows systems, less looks
+ for a lesskey file called "$HOME/_less", and if it is not found there,
then looks for a lesskey file called "_less" in any directory specified
- in the PATH environment variable. On OS/2 systems, less looks for a
- lesskey file called "$HOME/less.ini", and if it is not found, then
- looks for a lesskey file called "less.ini" in any directory specified
+ in the PATH environment variable. On OS/2 systems, less looks for a
+ lesskey file called "$HOME/less.ini", and if it is not found, then
+ looks for a lesskey file called "less.ini" in any directory specified
in the INIT environment variable, and if it not found there, then looks
- for a lesskey file called "less.ini" in any directory specified in the
- PATH environment variable. See the lesskey manual page for more
+ for a lesskey file called "less.ini" in any directory specified in the
+ PATH environment variable. See the lesskey manual page for more
details.
- A system-wide lesskey file may also be set up to provide key bindings.
+ A system-wide lesskey file may also be set up to provide key bindings.
If a key is defined in both a local lesskey file and in the system-wide
- file, key bindings in the local file take precedence over those in the
- system-wide file. If the environment variable LESSKEY_SYSTEM is set,
+ file, key bindings in the local file take precedence over those in the
+ system-wide file. If the environment variable LESSKEY_SYSTEM is set,
less uses that as the name of the system-wide lesskey file. Otherwise,
- less looks in a standard place for the system-wide lesskey file: On
- Unix systems, the system-wide lesskey file is /usr/local/etc/sysless.
- (However, if less was built with a different sysconf directory than
+ less looks in a standard place for the system-wide lesskey file: On
+ Unix systems, the system-wide lesskey file is /usr/local/etc/sysless.
+ (However, if less was built with a different sysconf directory than
/usr/local/etc, that directory is where the sysless file is found.) On
- MS-DOS and Windows systems, the system-wide lesskey file is c:\_sys-
+ MS-DOS and Windows systems, the system-wide lesskey file is c:\_sys-
less. On OS/2 systems, the system-wide lesskey file is c:\sysless.ini.
INPUT PREPROCESSOR
- You may define an "input preprocessor" for less. Before less opens a
+ You may define an "input preprocessor" for less. Before less opens a
file, it first gives your input preprocessor a chance to modify the way
- the contents of the file are displayed. An input preprocessor is sim-
- ply an executable program (or shell script), which writes the contents
+ the contents of the file are displayed. An input preprocessor is sim-
+ ply an executable program (or shell script), which writes the contents
of the file to a different file, called the replacement file. The con-
- tents of the replacement file are then displayed in place of the con-
- tents of the original file. However, it will appear to the user as if
- the original file is opened; that is, less will display the original
+ tents of the replacement file are then displayed in place of the con-
+ tents of the original file. However, it will appear to the user as if
+ the original file is opened; that is, less will display the original
filename as the name of the current file.
- An input preprocessor receives one command line argument, the original
- filename, as entered by the user. It should create the replacement
- file, and when finished, print the name of the replacement file to its
- standard output. If the input preprocessor does not output a replace-
- ment filename, less uses the original file, as normal. The input pre-
- processor is not called when viewing standard input. To set up an
- input preprocessor, set the LESSOPEN environment variable to a command
- line which will invoke your input preprocessor. This command line
- should include one occurrence of the string "%s", which will be
- replaced by the filename when the input preprocessor command is
+ An input preprocessor receives one command line argument, the original
+ filename, as entered by the user. It should create the replacement
+ file, and when finished, print the name of the replacement file to its
+ standard output. If the input preprocessor does not output a replace-
+ ment filename, less uses the original file, as normal. The input pre-
+ processor is not called when viewing standard input. To set up an
+ input preprocessor, set the LESSOPEN environment variable to a command
+ line which will invoke your input preprocessor. This command line
+ should include one occurrence of the string "%s", which will be
+ replaced by the filename when the input preprocessor command is
invoked.
When less closes a file opened in such a way, it will call another pro-
- gram, called the input postprocessor, which may perform any desired
- clean-up action (such as deleting the replacement file created by
+ gram, called the input postprocessor, which may perform any desired
+ clean-up action (such as deleting the replacement file created by
LESSOPEN). This program receives two command line arguments, the orig-
- inal filename as entered by the user, and the name of the replacement
- file. To set up an input postprocessor, set the LESSCLOSE environment
- variable to a command line which will invoke your input postprocessor.
- It may include two occurrences of the string "%s"; the first is
- replaced with the original name of the file and the second with the
+ inal filename as entered by the user, and the name of the replacement
+ file. To set up an input postprocessor, set the LESSCLOSE environment
+ variable to a command line which will invoke your input postprocessor.
+ It may include two occurrences of the string "%s"; the first is
+ replaced with the original name of the file and the second with the
name of the replacement file, which was output by LESSOPEN.
- For example, on many Unix systems, these two scripts will allow you to
+ For example, on many Unix systems, these two scripts will allow you to
keep files in compressed format, but still let less view them directly:
lessopen.sh:
@@ -1027,50 +1036,65 @@ LESS(1) LESS(1)
#! /bin/sh
rm $2
- To use these scripts, put them both where they can be executed and set
+ To use these scripts, put them both where they can be executed and set
LESSOPEN="lessopen.sh %s", and LESSCLOSE="lessclose.sh %s %s". More
- complex LESSOPEN and LESSCLOSE scripts may be written to accept other
+ complex LESSOPEN and LESSCLOSE scripts may be written to accept other
types of compressed files, and so on.
- It is also possible to set up an input preprocessor to pipe the file
- data directly to less, rather than putting the data into a replacement
+ It is also possible to set up an input preprocessor to pipe the file
+ data directly to less, rather than putting the data into a replacement
file. This avoids the need to decompress the entire file before start-
ing to view it. An input preprocessor that works this way is called an
- input pipe. An input pipe, instead of writing the name of a replace-
- ment file on its standard output, writes the entire contents of the
- replacement file on its standard output. If the input pipe does not
- write any characters on its standard output, then there is no replace-
- ment file and less uses the original file, as normal. To use an input
- pipe, make the first character in the LESSOPEN environment variable a
- vertical bar (|) to signify that the input preprocessor is an input
+ input pipe. An input pipe, instead of writing the name of a replace-
+ ment file on its standard output, writes the entire contents of the
+ replacement file on its standard output. If the input pipe does not
+ write any characters on its standard output, then there is no replace-
+ ment file and less uses the original file, as normal. To use an input
+ pipe, make the first character in the LESSOPEN environment variable a
+ vertical bar (|) to signify that the input preprocessor is an input
pipe.
- For example, on many Unix systems, this script will work like the pre-
+ For example, on many Unix systems, this script will work like the pre-
vious example scripts:
lesspipe.sh:
#! /bin/sh
case "$1" in
*.Z) uncompress -c $1 2>/dev/null
+ *) exit 1
;;
esac
+ exit $?
To use this script, put it where it can be executed and set
- LESSOPEN="|lesspipe.sh %s". When an input pipe is used, a LESSCLOSE
- postprocessor can be used, but it is usually not necessary since there
- is no replacement file to clean up. In this case, the replacement file
- name passed to the LESSCLOSE postprocessor is "-".
-
- For compatibility with previous versions of less, the input preproces-
+ LESSOPEN="|lesspipe.sh %s".
+
+ Note that a preprocessor cannot output an empty file, since that is
+ interpreted as meaning there is no replacement, and the original file
+ is used. To avoid this, if LESSOPEN starts with two vertical bars, the
+ exit status of the script becomes meaningful. If the exit status is
+ zero, the output is considered to be replacement text, even if it
+ empty. If the exit status is nonzero, any output is ignored and the
+ original file is used. For compatibility with previous versions of
+ less, if LESSOPEN starts with only one vertical bar, the exit status of
+ the preprocessor is ignored.
+
+ When an input pipe is used, a LESSCLOSE postprocessor can be used, but
+ it is usually not necessary since there is no replacement file to clean
+ up. In this case, the replacement file name passed to the LESSCLOSE
+ postprocessor is "-".
+
+ For compatibility with previous versions of less, the input preproces-
sor or pipe is not used if less is viewing standard input. However, if
- the first character of LESSOPEN is a dash (-), the input preprocessor
- is used on standard input as well as other files. In this case, the
- dash is not considered to be part of the preprocessor command. If
+ the first character of LESSOPEN is a dash (-), the input preprocessor
+ is used on standard input as well as other files. In this case, the
+ dash is not considered to be part of the preprocessor command. If
standard input is being viewed, the input preprocessor is passed a file
- name consisting of a single dash. Similarly, if the first two charac-
- ters of LESSOPEN are vertical bar and dash (|-), the input pipe is used
- on standard input as well as other files. Again, in this case the dash
- is not considered to be part of the input pipe command.
+ name consisting of a single dash. Similarly, if the first two charac-
+ ters of LESSOPEN are vertical bar and dash (|-) or two vertical bars
+ and a dash (||-), the input pipe is used on standard input as well as
+ other files. Again, in this case the dash is not considered to be part
+ of the input pipe command.
NATIONAL CHARACTER SETS
@@ -1535,10 +1559,13 @@ LESS(1) LESS(1)
the window system's idea of the screen size takes precedence
over the LINES and COLUMNS environment variables.)
- PATH User's search path (used to find a lesskey file on MS-DOS and
+ MORE Options which are passed to less automatically when running in
+ more compatible mode.
+
+ PATH User's search path (used to find a lesskey file on MS-DOS and
OS/2 systems).
- SHELL The shell used to execute the ! command, as well as to expand
+ SHELL The shell used to execute the ! command, as well as to expand
filenames.
TERM The type of terminal on which less is being run.
@@ -1551,28 +1578,27 @@ LESS(1) LESS(1)
COPYRIGHT
- Copyright (C) 1984-2011 Mark Nudelman
+ Copyright (C) 1984-2012 Mark Nudelman
- less is part of the GNU project and is free software. You can redis-
- tribute it and/or modify it under the terms of either (1) the GNU Gen-
- eral Public License as published by the Free Software Foundation; or
+ less is part of the GNU project and is free software. You can redis-
+ tribute it and/or modify it under the terms of either (1) the GNU Gen-
+ eral Public License as published by the Free Software Foundation; or
(2) the Less License. See the file README in the less distribution for
more details regarding redistribution. You should have received a copy
- of the GNU General Public License along with the source for less; see
- the file COPYING. If not, write to the Free Software Foundation, 59
- Temple Place, Suite 330, Boston, MA 02111-1307, USA. You should also
+ of the GNU General Public License along with the source for less; see
+ the file COPYING. If not, write to the Free Software Foundation, 59
+ Temple Place, Suite 330, Boston, MA 02111-1307, USA. You should also
have received a copy of the Less License; see the file LICENSE.
less is distributed in the hope that it will be useful, but WITHOUT ANY
- WARRANTY; without even the implied warranty of MERCHANTABILITY or FIT-
- NESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
+ WARRANTY; without even the implied warranty of MERCHANTABILITY or FIT-
+ NESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
more details.
AUTHOR
- Mark Nudelman <markn@greenwoodsoftware.com>
- Send bug reports or comments to the above address or to bug-
- less@gnu.org.
+ Mark Nudelman <bug-less@gnu.org>
+ Send bug reports or comments to bug-less@gnu.org.
See http://www.greenwoodsoftware.com/less/bugs.html for the latest list
of known bugs in less.
For more information, see the less homepage at
@@ -1580,4 +1606,4 @@ LESS(1) LESS(1)
- Version 444: 09 Jun 2011 LESS(1)
+ Version 449: 26 Jun 2012 LESS(1)
diff --git a/less.nro b/less.nro
index 0bc21b505cd5..0ee74418fd45 100644
--- a/less.nro
+++ b/less.nro
@@ -1,4 +1,4 @@
-.TH LESS 1 "Version 444: 09 Jun 2011"
+.TH LESS 1 "Version 449: 26 Jun 2012"
.SH NAME
less \- opposite of more
.SH SYNOPSIS
@@ -109,6 +109,10 @@ Normally this command would be used when already at the end of the file.
It is a way to monitor the tail of a file which is growing
while it is being viewed.
(The behavior is similar to the "tail \-f" command.)
+.IP "ESC-F"
+Like F, but as soon as a line is found which matches
+the last search pattern, the terminal bell is rung
+and forward scrolling stops.
.IP "g or < or ESC-<"
Go to line N in the file, default 1 (beginning of file).
(Warning: this may be slow if N is large.)
@@ -761,10 +765,10 @@ This is useful when viewing
output.
.IP "\-S or \-\-chop-long-lines"
Causes lines longer than the screen width to be
-chopped rather than folded.
+chopped (truncated) rather than wrapped.
That is, the portion of a long line that does not fit in
the screen width is not shown.
-The default is to fold long lines; that is, display the remainder
+The default is to wrap long lines; that is, display the remainder
on the next line.
.IP "\-t\fItag\fP or \-\-tag=\fItag\fP"
The \-t option, followed immediately by a TAG,
@@ -805,7 +809,7 @@ the overstruck text is printed
using the terminal's hardware boldface capability.
Other backspaces are deleted, along with the preceding character.
Carriage returns immediately followed by a newline are deleted.
-other carriage returns are handled as specified by the \-r option.
+Other carriage returns are handled as specified by the \-r option.
Text which is overstruck or underlined can be searched for
if neither \-u nor \-U is in effect.
.IP "\-V or \-\-version"
@@ -963,8 +967,12 @@ Delete the word to the left of the cursor.
Delete the word under the cursor.
.IP "UPARROW [ ESC-k ]"
Retrieve the previous command line.
+If you first enter some text and then press UPARROW,
+it will retrieve the previous command which begins with that text.
.IP "DOWNARROW [ ESC-j ]"
Retrieve the next command line.
+If you first enter some text and then press DOWNARROW,
+it will retrieve the next command which begins with that text.
.IP "TAB"
Complete the partial filename to the left of the cursor.
If it matches more than one filename, the first match
@@ -1158,13 +1166,32 @@ lesspipe.sh:
.br
*.Z) uncompress \-c $1 2>/dev/null
.br
+ *) exit 1
+.br
;;
.br
esac
.br
+ exit $?
+.br
.PP
To use this script, put it where it can be executed and set
LESSOPEN="|lesspipe.sh %s".
+.PP
+Note that a preprocessor cannot output an empty file, since that
+is interpreted as meaning there is no replacement, and
+the original file is used.
+To avoid this, if LESSOPEN starts with two vertical bars,
+the exit status of the script becomes meaningful.
+If the exit status is zero, the output is considered to be
+replacement text, even if it empty.
+If the exit status is nonzero, any output is ignored and the
+original file is used.
+For compatibility with previous versions of
+.I less,
+if LESSOPEN starts with only one vertical bar, the exit status
+of the preprocessor is ignored.
+.PP
When an input pipe is used, a LESSCLOSE postprocessor can be used,
but it is usually not necessary since there is no replacement file
to clean up.
@@ -1183,7 +1210,8 @@ the preprocessor command.
If standard input is being viewed, the input preprocessor is passed
a file name consisting of a single dash.
Similarly, if the first two characters of LESSOPEN are vertical bar and dash
-(|\-), the input pipe is used on standard input as well as other files.
+(|\-) or two vertical bars and a dash (||\-),
+the input pipe is used on standard input as well as other files.
Again, in this case the dash is not considered to be part of
the input pipe command.
@@ -1666,6 +1694,12 @@ Takes precedence over the number of lines specified by the TERM variable.
(But if you have a windowing system which supports TIOCGWINSZ or WIOCGETD,
the window system's idea of the screen size takes precedence over the
LINES and COLUMNS environment variables.)
+.IP MORE
+Options which are passed to
+.I less
+automatically when running in
+.I more
+compatible mode.
.IP PATH
User's search path (used to find a lesskey file
on MS-DOS and OS/2 systems).
@@ -1682,7 +1716,7 @@ The name of the editor (used for the v command).
lesskey(1)
.SH COPYRIGHT
-Copyright (C) 1984-2011 Mark Nudelman
+Copyright (C) 1984-2012 Mark Nudelman
.PP
less is part of the GNU project and is free software.
You can redistribute it and/or modify it
@@ -1705,9 +1739,9 @@ See the GNU General Public License for more details.
.SH AUTHOR
.PP
-Mark Nudelman <markn@greenwoodsoftware.com>
+Mark Nudelman <bug-less@gnu.org>
.br
-Send bug reports or comments to the above address or to bug-less@gnu.org.
+Send bug reports or comments to bug-less@gnu.org.
.br
See http://www.greenwoodsoftware.com/less/bugs.html for the latest list of known bugs in less.
.br
diff --git a/lessecho.c b/lessecho.c
index 6dcaf6c820b9..cdadd7249eda 100644
--- a/lessecho.c
+++ b/lessecho.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
@@ -28,7 +27,7 @@
#include "less.h"
-static char *version = "$Revision: 1.14 $";
+static char *version = "$Revision: 1.15 $";
static int quote_all = 0;
static char openquote = '"';
diff --git a/lessecho.man b/lessecho.man
index 682b0bd835ed..e28f3c1f05b0 100644
--- a/lessecho.man
+++ b/lessecho.man
@@ -10,12 +10,18 @@ LESSECHO(1) LESSECHO(1)
DESCRIPTION
lessecho is a program that simply echos its arguments on standard out-
- put. But any argument containing spaces is enclosed in quotes.
+ put. But any metacharacter in the output is preceded by an "escape"
+ character, which by default is a backslash.
OPTIONS
A summary of options is included below.
- -ox Specifies "x" to be the open quote character.
+ -ex Specifies "x", rather than backslash, to be the escape char for
+ metachars. If x is "-", no escape char is used and arguments
+ containing metachars are surrounded by quotes instead.
+
+ -ox Specifies "x", rather than double-quote, to be the open quote
+ character, which is used if the -e- option is specified.
-cx Specifies "x" to be the close quote character.
@@ -23,27 +29,26 @@ LESSECHO(1) LESSECHO(1)
-dn Specifies "n" to be the close quote character, as an integer.
- -mx Specifies "x" to be a metachar.
+ -mx Specifies "x" to be a metachar. By default, no characters are
+ considered metachars.
-nn Specifies "n" to be a metachar, as an integer.
- -ex Specifies "x" to be the escape char for metachars.
-
- -fn Specifies "n" to be the escape char for metachars, as an inte-
+ -fn Specifies "n" to be the escape char for metachars, as an inte-
ger.
- -a Specifies that all arguments are to be quoted. The default is
- that only arguments containing spaces are quoted.
+ -a Specifies that all arguments are to be quoted. The default is
+ that only arguments containing metacharacters are quoted
SEE ALSO
less(1)
AUTHOR
- This manual page was written by Thomas Schoepf <schoepf@debian.org>,
+ This manual page was written by Thomas Schoepf <schoepf@debian.org>,
for the Debian GNU/Linux system (but may be used by others).
Send bug reports or comments to bug-less@gnu.org.
- Version 444: 09 Jun 2011 LESSECHO(1)
+ Version 449: 26 Jun 2012 LESSECHO(1)
diff --git a/lessecho.nro b/lessecho.nro
index 46540e8bccad..a2030c77c0f9 100644
--- a/lessecho.nro
+++ b/lessecho.nro
@@ -1,4 +1,4 @@
-.TH LESSECHO 1 "Version 444: 09 Jun 2011"
+.TH LESSECHO 1 "Version 449: 26 Jun 2012"
.SH NAME
lessecho \- expand metacharacters
.SH SYNOPSIS
@@ -7,12 +7,19 @@ lessecho \- expand metacharacters
.SH "DESCRIPTION"
.I lessecho
is a program that simply echos its arguments on standard output.
-But any argument containing spaces is enclosed in quotes.
+But any metacharacter in the output is preceded by an "escape"
+character, which by default is a backslash.
.SH OPTIONS
A summary of options is included below.
.TP
+.B \-ex
+Specifies "x", rather than backslash, to be the escape char for metachars.
+If x is "-", no escape char is used and arguments containing metachars
+are surrounded by quotes instead.
+.TP
.B \-ox
-Specifies "x" to be the open quote character.
+Specifies "x", rather than double-quote, to be the open quote character,
+which is used if the -e- option is specified.
.TP
.B \-cx
Specifies "x" to be the close quote character.
@@ -25,19 +32,17 @@ Specifies "n" to be the close quote character, as an integer.
.TP
.B \-mx
Specifies "x" to be a metachar.
+By default, no characters are considered metachars.
.TP
.B \-nn
Specifies "n" to be a metachar, as an integer.
.TP
-.B \-ex
-Specifies "x" to be the escape char for metachars.
-.TP
.B \-fn
Specifies "n" to be the escape char for metachars, as an integer.
.TP
.B \-a
Specifies that all arguments are to be quoted.
-The default is that only arguments containing spaces are quoted.
+The default is that only arguments containing metacharacters are quoted
.SH "SEE ALSO"
less(1)
.SH AUTHOR
diff --git a/lesskey.c b/lesskey.c
index 1ee2c4040209..e01d28980d43 100644
--- a/lesskey.c
+++ b/lesskey.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
@@ -112,6 +111,7 @@ struct cmdname cmdnames[] =
{ "flush-repaint", A_FREPAINT },
{ "forw-bracket", A_F_BRACKET },
{ "forw-forever", A_F_FOREVER },
+ { "forw-until-hilite", A_F_UNTIL_HILITE },
{ "forw-line", A_F_LINE },
{ "forw-line-force", A_FF_LINE },
{ "forw-screen", A_F_SCREEN },
diff --git a/lesskey.h b/lesskey.h
index 9a457a924fbe..cb44d2c42f5b 100644
--- a/lesskey.h
+++ b/lesskey.h
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
diff --git a/lesskey.man b/lesskey.man
index 5e0a99914baf..ea0562ff1a4f 100644
--- a/lesskey.man
+++ b/lesskey.man
@@ -145,6 +145,7 @@ LESSKEY(1) LESSKEY(1)
w back-window
\e\40 forw-screen-force
F forw-forever
+ \eF forw-until-hilite
R repaint-flush
r repaint
^R repaint
@@ -329,7 +330,7 @@ LESSKEY(1) LESSKEY(1)
COPYRIGHT
- Copyright (C) 2000-2011 Mark Nudelman
+ Copyright (C) 2000-2012 Mark Nudelman
lesskey is part of the GNU project and is free software; you can redis-
tribute it and/or modify it under the terms of the GNU General Public
@@ -347,11 +348,11 @@ LESSKEY(1) LESSKEY(1)
AUTHOR
- Mark Nudelman <markn@greenwoodsoftware.com>
+ Mark Nudelman <bug-less@gnu.org>
Send bug reports or comments to the above address or to bug-
less@gnu.org.
- Version 444: 09 Jun 2011 LESSKEY(1)
+ Version 449: 26 Jun 2012 LESSKEY(1)
diff --git a/lesskey.nro b/lesskey.nro
index d305b957ce1f..1a066b96d77d 100644
--- a/lesskey.nro
+++ b/lesskey.nro
@@ -1,4 +1,4 @@
-.TH LESSKEY 1 "Version 444: 09 Jun 2011"
+.TH LESSKEY 1 "Version 449: 26 Jun 2012"
.SH NAME
lesskey \- specify key bindings for less
.SH SYNOPSIS
@@ -162,6 +162,7 @@ default command keys used by less:
w back-window
\ee\e40 forw-screen-force
F forw-forever
+ \eeF forw-until-hilite
R repaint-flush
r repaint
^R repaint
@@ -355,7 +356,7 @@ which start with a NUL character (0).
This NUL character should be represented as \e340 in a lesskey file.
.SH COPYRIGHT
-Copyright (C) 2000-2011 Mark Nudelman
+Copyright (C) 2000-2012 Mark Nudelman
.PP
lesskey is part of the GNU project and is free software;
you can redistribute it and/or modify it
@@ -375,7 +376,7 @@ Suite 330, Boston, MA 02111-1307, USA.
.SH AUTHOR
.PP
-Mark Nudelman <markn@greenwoodsoftware.com>
+Mark Nudelman <bug-less@gnu.org>
.br
Send bug reports or comments to the above address or to bug-less@gnu.org.
diff --git a/lglob.h b/lglob.h
index e2427e3abb40..4e0a41f77925 100644
--- a/lglob.h
+++ b/lglob.h
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
diff --git a/line.c b/line.c
index 798d4f26707e..4384b19d2e35 100644
--- a/line.c
+++ b/line.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
@@ -27,6 +26,7 @@ public int hshift; /* Desired left-shift of output line buffer */
public int tabstops[TABSTOP_MAX] = { 0 }; /* Custom tabstops */
public int ntabstops = 1; /* Number of tabstops */
public int tabdefault = 8; /* Default repeated tabstops */
+public POSITION highest_hilite; /* Pos of last hilite in file found so far */
static int curr; /* Index into linebuf */
static int column; /* Printable length, accounting for
@@ -585,7 +585,12 @@ store_char(ch, a, rep, pos)
* Override the attribute passed in.
*/
if (a != AT_ANSI)
+ {
+ if (highest_hilite != NULL_POSITION &&
+ pos > highest_hilite)
+ highest_hilite = pos;
a |= AT_HILITE;
+ }
}
}
#endif
diff --git a/linenum.c b/linenum.c
index 4369f87b266d..807eb30ac153 100644
--- a/linenum.c
+++ b/linenum.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
diff --git a/lsystem.c b/lsystem.c
index 0a8ca52ea5a8..1b3fa04e2f42 100644
--- a/lsystem.c
+++ b/lsystem.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
diff --git a/main.c b/main.c
index 0af176299f63..9fe463ada1bd 100644
--- a/main.c
+++ b/main.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
@@ -211,6 +210,7 @@ main(argc, argv)
argv++;
(void) get_ifile(filename, ifile);
ifile = prev_ifile(NULL_IFILE);
+ free(filename);
#endif
}
/*
diff --git a/mark.c b/mark.c
index 585b412b49d2..f95866c91e9a 100644
--- a/mark.c
+++ b/mark.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
#include "less.h"
diff --git a/mkhelp.c b/mkhelp.c
index 4aa8cbda6aa2..94d189482b7d 100644
--- a/mkhelp.c
+++ b/mkhelp.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
diff --git a/optfunc.c b/optfunc.c
index a0aa10a81cd3..b4288d78bb5b 100644
--- a/optfunc.c
+++ b/optfunc.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
@@ -481,7 +480,30 @@ opt__V(type, s)
any_display = 1;
putstr("less ");
putstr(version);
- putstr("\nCopyright (C) 1984-2009 Mark Nudelman\n\n");
+ putstr(" (");
+#if HAVE_GNU_REGEX
+ putstr("GNU ");
+#endif
+#if HAVE_POSIX_REGCOMP
+ putstr("POSIX ");
+#endif
+#if HAVE_PCRE
+ putstr("PCRE ");
+#endif
+#if HAVE_RE_COMP
+ putstr("BSD ");
+#endif
+#if HAVE_REGCMP
+ putstr("V8 ");
+#endif
+#if HAVE_V8_REGCOMP
+ putstr("Spencer V8 ");
+#endif
+#if !HAVE_GNU_REGEX && !HAVE_POSIX_REGCOMP && !HAVE_PCRE && !HAVE_RE_COMP && !HAVE_REGCMP && !HAVE_V8_REGCOMP
+ putstr("no ");
+#endif
+ putstr("regular expressions)\n");
+ putstr("Copyright (C) 1984-2012 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");
diff --git a/option.c b/option.c
index acb8962527ec..cf5ed36a72c5 100644
--- a/option.c
+++ b/option.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
diff --git a/option.h b/option.h
index a32139eea66a..00b4b7d1fd62 100644
--- a/option.h
+++ b/option.h
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
#define END_OPTION_STRING ('$')
diff --git a/opttbl.c b/opttbl.c
index 63f6889955bd..615fb2785c46 100644
--- a/opttbl.c
+++ b/opttbl.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
diff --git a/os.c b/os.c
index dbb52fe3b85f..f59c0d4f3f99 100644
--- a/os.c
+++ b/os.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
diff --git a/output.c b/output.c
index a4fdada1ba7c..ba0742130248 100644
--- a/output.c
+++ b/output.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
@@ -174,6 +173,7 @@ flush()
*/
p++;
anchor = p_next = p;
+ at = 0;
WIN32setcolors(nm_fg_color, nm_bg_color);
continue;
}
@@ -272,20 +272,25 @@ flush()
break;
if (at & 1)
{
- fg = bo_fg_color;
- bg = bo_bg_color;
+#if MSDOS_COMPILER==WIN32C
+ fg |= FOREGROUND_INTENSITY;
+ bg |= BACKGROUND_INTENSITY;
+#else
+ fg = bo_fg_color;
+ bg = bo_bg_color;
+#endif
} else if (at & 2)
{
- fg = so_fg_color;
- bg = so_bg_color;
+ fg = so_fg_color;
+ bg = so_bg_color;
} else if (at & 4)
{
- fg = ul_fg_color;
- bg = ul_bg_color;
+ fg = ul_fg_color;
+ bg = ul_bg_color;
} else if (at & 8)
{
- fg = bl_fg_color;
- bg = bl_bg_color;
+ fg = bl_fg_color;
+ bg = bl_bg_color;
}
fg &= 0xf;
bg &= 0xf;
diff --git a/pattern.c b/pattern.c
index ca349b6c1928..606f28cb67e3 100644
--- a/pattern.c
+++ b/pattern.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
* Routines to do pattern matching.
@@ -26,75 +25,92 @@ compile_pattern2(pattern, search_type, comp_pattern)
int search_type;
void **comp_pattern;
{
- if ((search_type & SRCH_NO_REGEX) == 0)
+ if (search_type & SRCH_NO_REGEX)
+ return (0);
+ {
+#if HAVE_GNU_REGEX
+ struct re_pattern_buffer *comp = (struct re_pattern_buffer *)
+ ecalloc(1, sizeof(struct re_pattern_buffer));
+ struct re_pattern_buffer **pcomp =
+ (struct re_pattern_buffer **) comp_pattern;
+ re_set_syntax(RE_SYNTAX_POSIX_EXTENDED);
+ if (re_compile_pattern(pattern, strlen(pattern), comp))
{
+ free(comp);
+ error("Invalid pattern", NULL_PARG);
+ return (-1);
+ }
+ if (*pcomp != NULL)
+ regfree(*pcomp);
+ *pcomp = comp;
+#endif
#if HAVE_POSIX_REGCOMP
- regex_t *comp = (regex_t *) ecalloc(1, sizeof(regex_t));
- regex_t **pcomp = (regex_t **) comp_pattern;
- if (regcomp(comp, pattern, REGCOMP_FLAG))
- {
- free(comp);
- error("Invalid pattern", NULL_PARG);
- return (-1);
- }
- if (*pcomp != NULL)
- regfree(*pcomp);
- *pcomp = comp;
+ regex_t *comp = (regex_t *) ecalloc(1, sizeof(regex_t));
+ regex_t **pcomp = (regex_t **) comp_pattern;
+ if (regcomp(comp, pattern, REGCOMP_FLAG))
+ {
+ free(comp);
+ error("Invalid pattern", NULL_PARG);
+ return (-1);
+ }
+ if (*pcomp != NULL)
+ regfree(*pcomp);
+ *pcomp = comp;
#endif
#if HAVE_PCRE
- pcre *comp;
- pcre **pcomp = (pcre **) comp_pattern;
- const char *errstring;
- int erroffset;
- PARG parg;
- comp = pcre_compile(pattern, 0,
- &errstring, &erroffset, NULL);
- if (comp == NULL)
- {
- parg.p_string = (char *) errstring;
- error("%s", &parg);
- return (-1);
- }
- *pcomp = comp;
+ pcre *comp;
+ pcre **pcomp = (pcre **) comp_pattern;
+ constant char *errstring;
+ int erroffset;
+ PARG parg;
+ comp = pcre_compile(pattern, 0,
+ &errstring, &erroffset, NULL);
+ if (comp == NULL)
+ {
+ parg.p_string = (char *) errstring;
+ error("%s", &parg);
+ return (-1);
+ }
+ *pcomp = comp;
#endif
#if HAVE_RE_COMP
- PARG parg;
- int *pcomp = (int *) comp_pattern;
- if ((parg.p_string = re_comp(pattern)) != NULL)
- {
- error("%s", &parg);
- return (-1);
- }
- *pcomp = 1;
+ PARG parg;
+ int *pcomp = (int *) comp_pattern;
+ if ((parg.p_string = re_comp(pattern)) != NULL)
+ {
+ error("%s", &parg);
+ return (-1);
+ }
+ *pcomp = 1;
#endif
#if HAVE_REGCMP
- char *comp;
- char **pcomp = (char **) comp_pattern;
- if ((comp = regcmp(pattern, 0)) == NULL)
- {
- error("Invalid pattern", NULL_PARG);
- return (-1);
- }
- if (pcomp != NULL)
- free(*pcomp);
- *pcomp = comp;
+ char *comp;
+ char **pcomp = (char **) comp_pattern;
+ if ((comp = regcmp(pattern, 0)) == NULL)
+ {
+ error("Invalid pattern", NULL_PARG);
+ return (-1);
+ }
+ if (pcomp != NULL)
+ free(*pcomp);
+ *pcomp = comp;
#endif
#if HAVE_V8_REGCOMP
- struct regexp *comp;
- struct regexp **pcomp = (struct regexp **) comp_pattern;
- if ((comp = regcomp(pattern)) == NULL)
- {
- /*
- * regcomp has already printed an error message
- * via regerror().
- */
- return (-1);
- }
- if (*pcomp != NULL)
- free(*pcomp);
- *pcomp = comp;
-#endif
+ struct regexp *comp;
+ struct regexp **pcomp = (struct regexp **) comp_pattern;
+ if ((comp = regcomp(pattern)) == NULL)
+ {
+ /*
+ * regcomp has already printed an error message
+ * via regerror().
+ */
+ return (-1);
}
+ if (*pcomp != NULL)
+ free(*pcomp);
+ *pcomp = comp;
+#endif
+ }
return (0);
}
@@ -130,6 +146,12 @@ compile_pattern(pattern, search_type, comp_pattern)
uncompile_pattern(pattern)
void **pattern;
{
+#if HAVE_GNU_REGEX
+ struct re_pattern_buffer **pcomp = (struct re_pattern_buffer **) pattern;
+ if (*pcomp != NULL)
+ regfree(*pcomp);
+ *pcomp = NULL;
+#endif
#if HAVE_POSIX_REGCOMP
regex_t **pcomp = (regex_t **) pattern;
if (*pcomp != NULL)
@@ -167,6 +189,9 @@ uncompile_pattern(pattern)
is_null_pattern(pattern)
void *pattern;
{
+#if HAVE_GNU_REGEX
+ return (pattern == NULL);
+#endif
#if HAVE_POSIX_REGCOMP
return (pattern == NULL);
#endif
@@ -182,9 +207,6 @@ is_null_pattern(pattern)
#if HAVE_V8_REGCOMP
return (pattern == NULL);
#endif
-#if NO_REGEX
- return (search_pattern != NULL);
-#endif
}
/*
@@ -236,6 +258,9 @@ match_pattern(pattern, tpattern, line, line_len, sp, ep, notbol, search_type)
int search_type;
{
int matched;
+#if HAVE_GNU_REGEX
+ struct re_pattern_buffer *spattern = (struct re_pattern_buffer *) pattern;
+#endif
#if HAVE_POSIX_REGCOMP
regex_t *spattern = (regex_t *) pattern;
#endif
@@ -252,10 +277,30 @@ match_pattern(pattern, tpattern, line, line_len, sp, ep, notbol, search_type)
struct regexp *spattern = (struct regexp *) pattern;
#endif
+#if NO_REGEX
+ search_type |= SRCH_NO_REGEX;
+#endif
if (search_type & SRCH_NO_REGEX)
matched = match(tpattern, strlen(tpattern), line, line_len, sp, ep);
else
{
+#if HAVE_GNU_REGEX
+ {
+ struct re_registers search_regs;
+ regoff_t *starts = (regoff_t *) ecalloc(1, sizeof (regoff_t));
+ regoff_t *ends = (regoff_t *) ecalloc(1, sizeof (regoff_t));
+ spattern->not_bol = notbol;
+ re_set_registers(spattern, &search_regs, 1, starts, ends);
+ matched = re_search(spattern, line, line_len, 0, line_len, &search_regs) >= 0;
+ if (matched)
+ {
+ *sp = line + search_regs.start[0];
+ *ep = line + search_regs.end[0];
+ }
+ free(starts);
+ free(ends);
+ }
+#endif
#if HAVE_POSIX_REGCOMP
{
regmatch_t rm;
@@ -311,9 +356,6 @@ match_pattern(pattern, tpattern, line, line_len, sp, ep, notbol, search_type)
*ep = spattern->endp[0];
}
#endif
-#if NO_REGEX
- matched = match(tpattern, strlen(tpattern), line, line_len, sp, ep);
-#endif
}
matched = (!(search_type & SRCH_NO_MATCH) && matched) ||
((search_type & SRCH_NO_MATCH) && !matched);
diff --git a/pattern.h b/pattern.h
index 3b44e2ddedbb..c91a2cc9c441 100644
--- a/pattern.h
+++ b/pattern.h
@@ -1,12 +1,18 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
+
+#if HAVE_GNU_REGEX
+#define __USE_GNU 1
+#include <regex.h>
+#define DEFINE_PATTERN(name) struct re_pattern_buffer *name
+#define CLEAR_PATTERN(name) name = NULL
+#endif
#if HAVE_POSIX_REGCOMP
#include <regex.h>
@@ -46,3 +52,7 @@ extern char *__loc1;
#define CLEAR_PATTERN(name) name = NULL
#endif
+#if NO_REGEX
+#define DEFINE_PATTERN(name)
+#define CLEAR_PATTERN(name)
+#endif
diff --git a/pckeys.h b/pckeys.h
index 3708d85f43df..306ffde8992f 100644
--- a/pckeys.h
+++ b/pckeys.h
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
diff --git a/position.c b/position.c
index 8c05c5dd1299..234dc94e3b5d 100644
--- a/position.c
+++ b/position.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
diff --git a/position.h b/position.h
index 146972ca79f2..e0ab36059dc4 100644
--- a/position.h
+++ b/position.h
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
diff --git a/prompt.c b/prompt.c
index dce34f3272d4..49361fa0c927 100644
--- a/prompt.c
+++ b/prompt.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
@@ -393,9 +392,9 @@ protochar(c, where, iseditproto)
* where to resume parsing the string.
* We must keep track of nested IFs and skip them properly.
*/
- static char *
+ static constant char *
skipcond(p)
- register char *p;
+ register constant char *p;
{
register int iflevel;
@@ -451,9 +450,9 @@ skipcond(p)
/*
* Decode a char that represents a position on the screen.
*/
- static char *
+ static constant char *
wherechar(p, wp)
- char *p;
+ char constant *p;
int *wp;
{
switch (*p)
@@ -477,10 +476,10 @@ wherechar(p, wp)
*/
public char *
pr_expand(proto, maxwidth)
- char *proto;
+ constant char *proto;
int maxwidth;
{
- register char *p;
+ register constant char *p;
register int c;
int where;
diff --git a/screen.c b/screen.c
index b8bc66671b11..132b3d7f9c99 100644
--- a/screen.c
+++ b/screen.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
diff --git a/scrsize.c b/scrsize.c
index 05d041ee5fba..b9c7a492ba6e 100644
--- a/scrsize.c
+++ b/scrsize.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
* This program is used to determine the screen dimensions on OS/2 systems.
diff --git a/search.c b/search.c
index 143779ee06fc..f09c068a5591 100644
--- a/search.c
+++ b/search.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
@@ -66,6 +65,12 @@ struct pattern_info {
char* text;
int search_type;
};
+
+#if NO_REGEX
+#define info_compiled(info) ((void*)0)
+#else
+#define info_compiled(info) ((info)->compiled)
+#endif
static struct pattern_info search_info;
static struct pattern_info filter_info;
@@ -98,10 +103,12 @@ set_pattern(info, pattern, search_type)
char *pattern;
int search_type;
{
+#if !NO_REGEX
if (pattern == NULL)
- CLEAR_PATTERN(search_info.compiled);
+ CLEAR_PATTERN(info->compiled);
else if (compile_pattern(pattern, search_type, &info->compiled) < 0)
return -1;
+#endif
/* Pattern compiled successfully; save the text too. */
if (info->text != NULL)
free(info->text);
@@ -135,7 +142,9 @@ clear_pattern(info)
if (info->text != NULL)
free(info->text);
info->text = NULL;
+#if !NO_REGEX
uncompile_pattern(&info->compiled);
+#endif
}
/*
@@ -191,9 +200,11 @@ get_cvt_ops()
prev_pattern(info)
struct pattern_info *info;
{
- if (info->search_type & SRCH_NO_REGEX)
- return (info->text != NULL);
- return (!is_null_pattern(info->compiled));
+#if !NO_REGEX
+ if ((info->search_type & SRCH_NO_REGEX) == 0)
+ return (!is_null_pattern(info->compiled));
+#endif
+ return (info->text != NULL);
}
#if HILITE_SEARCH
@@ -476,6 +487,47 @@ add_hilite(anchor, hl)
}
/*
+ * Hilight every character in a range of displayed characters.
+ */
+ static void
+create_hilites(linepos, start_index, end_index, chpos)
+ POSITION linepos;
+ int start_index;
+ int end_index;
+ int *chpos;
+{
+ struct hilite *hl;
+ int i;
+
+ /* Start the first hilite. */
+ hl = (struct hilite *) ecalloc(1, sizeof(struct hilite));
+ hl->hl_startpos = linepos + chpos[start_index];
+
+ /*
+ * Step through the displayed chars.
+ * If the source position (before cvt) of the char is one more
+ * than the source pos of the previous char (the usual case),
+ * just increase the size of the current hilite by one.
+ * Otherwise (there are backspaces or something involved),
+ * finish the current hilite and start a new one.
+ */
+ for (i = start_index+1; i <= end_index; i++)
+ {
+ if (chpos[i] != chpos[i-1] + 1 || i == end_index)
+ {
+ hl->hl_endpos = linepos + chpos[i-1] + 1;
+ add_hilite(&hilite_anchor, hl);
+ /* Start new hilite unless this is the last char. */
+ if (i < end_index)
+ {
+ hl = (struct hilite *) ecalloc(1, sizeof(struct hilite));
+ hl->hl_startpos = linepos + chpos[i];
+ }
+ }
+ }
+}
+
+/*
* Make a hilite for each string in a physical line which matches
* the current pattern.
* sp,ep delimit the first match already found.
@@ -492,7 +544,6 @@ hilite_line(linepos, line, line_len, chpos, sp, ep, cvt_ops)
{
char *searchp;
char *line_end = line + line_len;
- struct hilite *hl;
if (sp == NULL || ep == NULL)
return;
@@ -508,13 +559,7 @@ hilite_line(linepos, line, line_len, chpos, sp, ep, cvt_ops)
*/
searchp = line;
do {
- if (ep > sp)
- {
- hl = (struct hilite *) ecalloc(1, sizeof(struct hilite));
- hl->hl_startpos = linepos + chpos[sp-line];
- hl->hl_endpos = linepos + chpos[ep-line];
- add_hilite(&hilite_anchor, hl);
- }
+ create_hilites(linepos, sp-line, ep-line, chpos);
/*
* If we matched more than zero characters,
* move to the first char after the string we matched.
@@ -526,7 +571,7 @@ hilite_line(linepos, line, line_len, chpos, sp, ep, cvt_ops)
searchp++;
else /* end of line */
break;
- } while (match_pattern(search_info.compiled, search_info.text,
+ } while (match_pattern(info_compiled(&search_info), search_info.text,
searchp, line_end - searchp, &sp, &ep, 1, search_info.search_type));
}
#endif
@@ -798,7 +843,7 @@ search_range(pos, endpos, search_type, matches, maxlines, plinepos, pendpos)
* If so, add an entry to the filter list.
*/
if ((search_type & SRCH_FIND_ALL) && prev_pattern(&filter_info)) {
- int line_filter = match_pattern(filter_info.compiled, filter_info.text,
+ int line_filter = match_pattern(info_compiled(&filter_info), filter_info.text,
cline, line_len, &sp, &ep, 0, filter_info.search_type);
if (line_filter)
{
@@ -818,7 +863,7 @@ search_range(pos, endpos, search_type, matches, maxlines, plinepos, pendpos)
*/
if (prev_pattern(&search_info))
{
- line_match = match_pattern(search_info.compiled, search_info.text,
+ line_match = match_pattern(info_compiled(&search_info), search_info.text,
cline, line_len, &sp, &ep, 0, search_type);
if (line_match)
{
diff --git a/signal.c b/signal.c
index 0fbaf7e6fdd0..83dc76446462 100644
--- a/signal.c
+++ b/signal.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
diff --git a/tags.c b/tags.c
index c00f9d488dd5..8fd36b555c69 100644
--- a/tags.c
+++ b/tags.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
#include "less.h"
diff --git a/ttyin.c b/ttyin.c
index 00f2c9e4ad58..b2f5262fd3b8 100644
--- a/ttyin.c
+++ b/ttyin.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
diff --git a/version.c b/version.c
index dc5bb0c4f2fe..096ae2066728 100644
--- a/version.c
+++ b/version.c
@@ -1,12 +1,11 @@
-/*
- * Copyright (C) 1984-2011 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.
- *
- * For more information about less, or for information on how to
- * contact the author, see the README file.
- */
+/*
+ * Copyright (C) 1984-2012 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.
+ *
+ * For more information, see the README file.
+ */
/*
@@ -343,7 +342,7 @@ v201 7/27/94 Check for no memcpy; add casts to calloc;
look for regcmp in libgen.a.
(thanks to Kaveh Ghazi).
v202 7/28/94 Fix bug in edit_next/edit_prev with
- non-existant files.
+ non-existent files.
v203 8/2/94 Fix a variety of configuration bugs on
various systems. (thanks to Sakai
Kiyotaka, Harald Koenig, Bjorn Brox,
@@ -743,6 +742,15 @@ v442 3/2/11 Fix search bug.
Add ctrl-G line edit command.
v443 4/9/11 Fix Windows build.
v444 6/8/11 Fix ungetc bug; remove vestiges of obsolete -l option.
+-----------------------------------------------------------------
+v445 10/19/11 Fix hilite bug in backwards scroll with -J.
+ Fix hilite bug with backspaces.
+ Fix bugs handling SGR sequences in Win32 (thanks to Eric Lee).
+ Add support for GNU regex (thanks to Reuben Thomas).
+v446 5/15/12 Up/down arrows in cmd editing search for matching cmd.
+v447 5/21/12 Add ESC-F command, two-pipe LESSOPEN syntax.
+v448 6/15/12 Print name of regex library in version message.
+v449 6/23/12 Allow config option --with-regex=none.
*/
-char version[] = "444";
+char version[] = "449";