Imported Upstream version 458 upstream/458
authorJacek Bukarewicz <j.bukarewicz@samsung.com>
Wed, 15 Jan 2014 16:18:43 +0000 (17:18 +0100)
committerJacek Bukarewicz <j.bukarewicz@samsung.com>
Wed, 15 Jan 2014 16:18:43 +0000 (17:18 +0100)
24 files changed:
NEWS
README
cmdbuf.c
configure
configure.ac
defines.ds
defines.h.in
defines.o2
defines.o9
defines.wn
help.c
less.hlp
less.man
less.nro
lessecho.man
lessecho.nro
lesskey.man
lesskey.nro
option.c
opttbl.c
output.c
position.c
screen.c
version.c

diff --git a/NEWS b/NEWS
index e0979cf..e03f35a 100644 (file)
--- a/NEWS
+++ b/NEWS
 
 ======================================================================
 
+       Major changes between "less" versions 451 and 458
+
+* Allow backslash escaping of metacharacters in LESS environment variable
+  after the --use-backslash option.
+
+* Don't quit if syntax errors are found in command line options.
+
+* Increase sizes of some internal buffers.
+
+* Fix configure bug with --with-regex=none.
+
+* Fix crash with "stty rows 0".
+
+* Fix Win32 attribute display bug.
+
+* Fix display bug when using up/down arrow on the command line.
+
+======================================================================
+
        Major changes between "less" versions 444 and 451
 
 * Add ESC-F command to keep reading data until a pattern is found.
diff --git a/README b/README
index 521856b..a7bdba4 100644 (file)
--- a/README
+++ b/README
@@ -1,7 +1,7 @@
 
-                            Less, version 451
+                            Less, version 458
 
-    This is the distribution of less, version 451, released 21 Jul 2012.
+    This is the distribution of less, version 458, released 04 Apr 2013.
     This program is part of the GNU project (http://www.gnu.org).
 
     This program is free software.  You may redistribute it and/or
index ec25096..e387ccc 100755 (executable)
--- a/cmdbuf.c
+++ b/cmdbuf.c
@@ -727,9 +727,9 @@ cmd_updown(action)
                        s = ml->string;
                        if (s == NULL)
                                s = "";
-                       strcpy(cmdbuf, s);
                        cmd_home();
                        clear_eol();
+                       strcpy(cmdbuf, s);
                        for (cp = cmdbuf;  *cp != '\0';  )
                                cmd_right();
                        return (CC_OK);
index de16061..e401d58 100755 (executable)
--- a/configure
+++ b/configure
@@ -5188,8 +5188,7 @@ fi
 # Checks for regular expression functions.
 have_regex=no
 have_posix_regex=unknown
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for regcomp" >&5
-$as_echo_n "checking for regcomp... " >&6; }
+supported_regex=""
 
 # Select a regular expression library.
 WANT_REGEX=auto
@@ -5204,6 +5203,8 @@ if test $have_regex = no; then
 if test $WANT_REGEX = auto -o $WANT_REGEX = posix; then
 # Some versions of Solaris have a regcomp() function, but it doesn't work!
 # So we run a test program.  If we're cross-compiling, do it the old way.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for POSIX regcomp" >&5
+$as_echo_n "checking for POSIX regcomp... " >&6; }
 if test "$cross_compiling" = yes; then :
   have_posix_regex=unknown
 else
@@ -5232,10 +5233,10 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
 fi
 
 if test $have_posix_regex = yes; then
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: using POSIX regcomp" >&5
-$as_echo "using POSIX regcomp" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
   $as_echo "#define HAVE_POSIX_REGCOMP 1" >>confdefs.h
-
+ supported_regex="$supported_regex posix"
   have_regex=yes
 elif test $have_posix_regex = unknown; then
   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
@@ -5252,10 +5253,10 @@ regex_t *r; regfree(r);
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: using POSIX regcomp" >&5
-$as_echo "using POSIX regcomp" >&6; }
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
   $as_echo "#define HAVE_POSIX_REGCOMP 1" >>confdefs.h
- have_regex=yes
+ have_regex=yes; supported_regex="$supported_regex posix"
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
@@ -5267,14 +5268,14 @@ 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 :
+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 ${ac_cv_lib_pcre_pcre_compile+:} false; then :
   $as_echo_n "(cached) " >&6
 else
   ac_check_lib_save_LIBS=$LIBS
-LIBS="-lc  $LIBS"
+LIBS="-lpcre  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -5284,44 +5285,43 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char re_compile_pattern ();
+char pcre_compile ();
 int
 main ()
 {
-return re_compile_pattern ();
+return pcre_compile ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_c_re_compile_pattern=yes
+  ac_cv_lib_pcre_pcre_compile=yes
 else
-  ac_cv_lib_c_re_compile_pattern=no
+  ac_cv_lib_pcre_pcre_compile=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
+{ $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" = xyes; then :
+  $as_echo "#define HAVE_PCRE 1" >>confdefs.h
+ LIBS="$LIBS -lpcre" have_regex=yes; supported_regex="$supported_regex pcre"
 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 ${ac_cv_lib_pcre_pcre_compile+:} false; 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="-lpcre  $LIBS"
+LIBS="-lc  $LIBS"
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -5331,30 +5331,29 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 #ifdef __cplusplus
 extern "C"
 #endif
-char pcre_compile ();
+char re_compile_pattern ();
 int
 main ()
 {
-return pcre_compile ();
+return re_compile_pattern ();
   ;
   return 0;
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  ac_cv_lib_pcre_pcre_compile=yes
+  ac_cv_lib_c_re_compile_pattern=yes
 else
-  ac_cv_lib_pcre_pcre_compile=no
+  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_pcre_pcre_compile" >&5
-$as_echo "$ac_cv_lib_pcre_pcre_compile" >&6; }
-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
+{ $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 "#define HAVE_GNU_REGEX 1" >>confdefs.h
+ have_regex=yes; supported_regex="$supported_regex gnu"
 fi
 
 fi
@@ -5364,9 +5363,8 @@ 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" = 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
+  $as_echo "#define HAVE_REGCMP 1" >>confdefs.h
+ have_regex=yes; supported_regex="$supported_regex regcmp"
 fi
 
 fi
@@ -5374,6 +5372,8 @@ fi
 
 if test $have_regex = no; then
 if test $WANT_REGEX = auto -o $WANT_REGEX = regcomp; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for V8 regcomp" >&5
+$as_echo_n "checking for V8 regcomp... " >&6; }
 cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 
@@ -5387,9 +5387,12 @@ regcomp("");
 }
 _ACEOF
 if ac_fn_c_try_link "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: using V8 regcomp" >&5
-$as_echo "using V8 regcomp" >&6; }; $as_echo "#define HAVE_V8_REGCOMP 1" >>confdefs.h
- have_regex=yes
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }; $as_echo "#define HAVE_V8_REGCOMP 1" >>confdefs.h
+ have_regex=yes; supported_regex="$supported_regex regcomp"
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
 fi
 rm -f core conftest.err conftest.$ac_objext \
     conftest$ac_exeext conftest.$ac_ext
@@ -5400,18 +5403,21 @@ if test $have_regex = no && test -f ${srcdir}/regexp.c; then
 if test $WANT_REGEX = auto -o $WANT_REGEX = regcomp-local; then
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: using V8 regcomp -- local source" >&5
 $as_echo "using V8 regcomp -- local source" >&6; }; $as_echo "#define HAVE_V8_REGCOMP 1" >>confdefs.h
- $as_echo "#define HAVE_REGEXEC2 1" >>confdefs.h
+
+supported_regex="$supported_regex regcomp-local"
+$as_echo "#define HAVE_REGEXEC2 1" >>confdefs.h
  REGEX_O='regexp.$(O)'  have_regex=yes
 fi
 fi
 
 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"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for re_comp" >&5
+$as_echo_n "checking for re_comp... " >&6; }
+ac_fn_c_check_func "$LINENO" "re_comp" "ac_cv_func_re_comp"
 if test "x$ac_cv_func_re_comp" = xyes; then :
   $as_echo "#define HAVE_RE_COMP 1" >>confdefs.h
- have_regex=yes
+ have_regex=yes; supported_regex="$supported_regex re_comp"
 fi
 
 fi
@@ -5420,15 +5426,17 @@ 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;
+$as_echo "using no regex" >&6; }
+else
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot find regular expression library" >&5
+$as_echo "$as_me: WARNING: cannot find regular expression library" >&2;}
 fi
+$as_echo "#define NO_REGEX 1" >>confdefs.h
+ supported_regex="$supported_regex none"
 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
-
-fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: regular expression library: $supported_regex" >&5
+$as_echo "regular expression library: $supported_regex" >&6; }
 
 
 # Check whether --with-editor was given.
index 167f8ba..4ac9a35 100755 (executable)
@@ -383,7 +383,7 @@ fi
 # Checks for regular expression functions.
 have_regex=no
 have_posix_regex=unknown
-AC_MSG_CHECKING(for regcomp)
+supported_regex=""
 
 # Select a regular expression library.
 WANT_REGEX=auto
@@ -395,6 +395,7 @@ if test $have_regex = no; then
 if test $WANT_REGEX = auto -o $WANT_REGEX = posix; then
 # Some versions of Solaris have a regcomp() function, but it doesn't work!
 # So we run a test program.  If we're cross-compiling, do it the old way.
+AC_MSG_CHECKING(for POSIX regcomp)
 AC_TRY_RUN([
 #include <sys/types.h>
 #include <regex.h>
@@ -409,16 +410,16 @@ if (rm.rm_sp != text + 1) exit(1); /* check for correct offset */
 exit(0); }],
   have_posix_regex=yes, have_posix_regex=no, have_posix_regex=unknown)
 if test $have_posix_regex = yes; then
-  AC_MSG_RESULT(using POSIX regcomp)
-  AC_DEFINE(HAVE_POSIX_REGCOMP)
+  AC_MSG_RESULT(yes)
+  AC_DEFINE(HAVE_POSIX_REGCOMP) supported_regex="$supported_regex posix"
   have_regex=yes
 elif test $have_posix_regex = unknown; then
   AC_TRY_LINK([
 #include <sys/types.h>
 #include <regex.h>],
   [regex_t *r; regfree(r);],
-  AC_MSG_RESULT(using POSIX regcomp)
-  AC_DEFINE(HAVE_POSIX_REGCOMP) have_regex=yes)
+  AC_MSG_RESULT(yes)
+  AC_DEFINE(HAVE_POSIX_REGCOMP) have_regex=yes; supported_regex="$supported_regex posix")
 else
   AC_MSG_RESULT(no)
 fi
@@ -426,55 +427,61 @@ 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], [])
+if test $WANT_REGEX = auto -o $WANT_REGEX = pcre; then
+AC_CHECK_LIB(pcre, pcre_compile
+[AC_DEFINE(HAVE_PCRE) LIBS="$LIBS -lpcre" have_regex=yes; supported_regex="$supported_regex pcre"], [])
 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], [])
+if test $WANT_REGEX = auto -o $WANT_REGEX = gnu; then
+AC_CHECK_LIB(c, re_compile_pattern
+[AC_DEFINE(HAVE_GNU_REGEX) have_regex=yes; supported_regex="$supported_regex gnu"], [])
 fi
 fi
 
 if test $have_regex = no; then
 if test $WANT_REGEX = auto -o $WANT_REGEX = regcmp; then
 AC_CHECK_FUNC(regcmp, 
-AC_MSG_RESULT(using regcmp); AC_DEFINE(HAVE_REGCMP) have_regex=yes)
+[AC_DEFINE(HAVE_REGCMP) have_regex=yes; supported_regex="$supported_regex regcmp"],[])
 fi
 fi
 
 if test $have_regex = no; then
 if test $WANT_REGEX = auto -o $WANT_REGEX = regcomp; then
+AC_MSG_CHECKING(for V8 regcomp)
 AC_TRY_LINK([
 #include "regexp.h"], [regcomp("");],
-AC_MSG_RESULT(using V8 regcomp); AC_DEFINE(HAVE_V8_REGCOMP) have_regex=yes)
+[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_V8_REGCOMP) have_regex=yes; supported_regex="$supported_regex regcomp"],[AC_MSG_RESULT(no)])
 fi
 fi
 
 if test $have_regex = no && test -f ${srcdir}/regexp.c; then
 if test $WANT_REGEX = auto -o $WANT_REGEX = regcomp-local; then
-AC_MSG_RESULT(using V8 regcomp -- local source); AC_DEFINE(HAVE_V8_REGCOMP) AC_DEFINE(HAVE_REGEXEC2) REGEX_O='regexp.$(O)' AC_SUBST(REGEX_O) have_regex=yes
+AC_MSG_RESULT(using V8 regcomp -- local source); AC_DEFINE(HAVE_V8_REGCOMP) 
+supported_regex="$supported_regex regcomp-local"
+AC_DEFINE(HAVE_REGEXEC2) REGEX_O='regexp.$(O)' AC_SUBST(REGEX_O) have_regex=yes
 fi
 fi
 
 if test $have_regex = no; then
 if test $WANT_REGEX = auto -o $WANT_REGEX = re_comp; then
-AC_MSG_RESULT(using re_comp); AC_CHECK_FUNC(re_comp, AC_DEFINE(HAVE_RE_COMP) have_regex=yes)
+AC_MSG_CHECKING(for re_comp)
+AC_CHECK_FUNC(re_comp,
+[AC_DEFINE(HAVE_RE_COMP) have_regex=yes; supported_regex="$supported_regex re_comp"],[])
 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;
+AC_MSG_RESULT(using no regex)
+else
+AC_MSG_WARN(cannot find regular expression library)
 fi
+AC_DEFINE(NO_REGEX) supported_regex="$supported_regex none"
 fi
 
-if test $have_regex = no; then
-AC_MSG_RESULT(cannot find regular expression library); AC_DEFINE(NO_REGEX)
-fi
+AC_MSG_RESULT(regular expression library: $supported_regex)
 
 AC_ARG_WITH(editor,
   [  --with-editor=PROGRAM   use PROGRAM as the default editor [vi]],
@@ -662,6 +669,7 @@ AH_TOP([
 /*
  * Sizes of various buffers.
  */
+#if 0 /* old sizes for small memory machines */
 #define        CMDBUF_SIZE     512     /* Buffer for multichar commands */
 #define        UNGOT_SIZE      100     /* Max chars to unget() */
 #define        LINEBUF_SIZE    1024    /* Max size of line in input file */
@@ -671,6 +679,17 @@ AH_TOP([
 #define        TERMSBUF_SIZE   1024    /* Buffer to hold termcap strings */
 #define        TAGLINE_SIZE    512     /* Max size of line in tags file */
 #define        TABSTOP_MAX     32      /* Max number of custom tab stops */
+#else /* more reasonable sizes for modern machines */
+#define        CMDBUF_SIZE     2048    /* Buffer for multichar commands */
+#define        UNGOT_SIZE      200     /* Max chars to unget() */
+#define        LINEBUF_SIZE    1024    /* Initial max size of line in input file */
+#define        OUTBUF_SIZE     1024    /* Output buffer */
+#define        PROMPT_SIZE     2048    /* Max size of prompt string */
+#define        TERMBUF_SIZE    2048    /* Termcap buffer for tgetent */
+#define        TERMSBUF_SIZE   1024    /* Buffer to hold termcap strings */
+#define        TAGLINE_SIZE    1024    /* Max size of line in tags file */
+#define        TABSTOP_MAX     128     /* Max number of custom tab stops */
+#endif
 
 /* Settings automatically determined by configure.  */
 ])
index 74187e1..d85f479 100755 (executable)
 /*
  * Sizes of various buffers.
  */
+#if 0 /* old sizes for small memory machines
 #define        CMDBUF_SIZE     512     /* Buffer for multichar commands */
 #define        UNGOT_SIZE      100     /* Max chars to unget() */
 #define        LINEBUF_SIZE    1024    /* Max size of line in input file */
 #define        TERMSBUF_SIZE   1024    /* Buffer to hold termcap strings */
 #define        TAGLINE_SIZE    512     /* Max size of line in tags file */
 #define        TABSTOP_MAX     32      /* Max number of custom tab stops */
+#else /* more reasonable sizes for modern machines */
+#define        CMDBUF_SIZE     2048    /* Buffer for multichar commands */
+#define        UNGOT_SIZE      200     /* Max chars to unget() */
+#define        LINEBUF_SIZE    1024    /* Initial max size of line in input file */
+#define        OUTBUF_SIZE     1024    /* Output buffer */
+#define        PROMPT_SIZE     2048    /* Max size of prompt string */
+#define        TERMBUF_SIZE    2048    /* Termcap buffer for tgetent */
+#define        TERMSBUF_SIZE   1024    /* Buffer to hold termcap strings */
+#define        TAGLINE_SIZE    1024    /* Max size of line in tags file */
+#define        TABSTOP_MAX     128     /* Max number of custom tab stops */
+#endif
 
 /* Define to `long' if <sys/types.h> doesn't define.  */
 #if MSDOS_COMPILER==BORLANDC
index a5e8b69..bfd0ab7 100644 (file)
 /*
  * Sizes of various buffers.
  */
+#if 0 /* old sizes for small memory machines */
 #define        CMDBUF_SIZE     512     /* Buffer for multichar commands */
 #define        UNGOT_SIZE      100     /* Max chars to unget() */
 #define        LINEBUF_SIZE    1024    /* Max size of line in input file */
 #define        TERMSBUF_SIZE   1024    /* Buffer to hold termcap strings */
 #define        TAGLINE_SIZE    512     /* Max size of line in tags file */
 #define        TABSTOP_MAX     32      /* Max number of custom tab stops */
+#else /* more reasonable sizes for modern machines */
+#define        CMDBUF_SIZE     2048    /* Buffer for multichar commands */
+#define        UNGOT_SIZE      200     /* Max chars to unget() */
+#define        LINEBUF_SIZE    1024    /* Initial max size of line in input file */
+#define        OUTBUF_SIZE     1024    /* Output buffer */
+#define        PROMPT_SIZE     2048    /* Max size of prompt string */
+#define        TERMBUF_SIZE    2048    /* Termcap buffer for tgetent */
+#define        TERMSBUF_SIZE   1024    /* Buffer to hold termcap strings */
+#define        TAGLINE_SIZE    1024    /* Max size of line in tags file */
+#define        TABSTOP_MAX     128     /* Max number of custom tab stops */
+#endif
 
 /* Settings automatically determined by configure.  */
 
index d71cf34..578091d 100755 (executable)
 /*
  * Sizes of various buffers.
  */
+#if 0 /* old sizes for small memory machines
 #define        CMDBUF_SIZE     512     /* Buffer for multichar commands */
 #define        UNGOT_SIZE      100     /* Max chars to unget() */
 #define        LINEBUF_SIZE    1024    /* Max size of line in input file */
 #define        TERMSBUF_SIZE   1024    /* Buffer to hold termcap strings */
 #define        TAGLINE_SIZE    512     /* Max size of line in tags file */
 #define        TABSTOP_MAX     32      /* Max number of custom tab stops */
+#else /* more reasonable sizes for modern machines */
+#define        CMDBUF_SIZE     2048    /* Buffer for multichar commands */
+#define        UNGOT_SIZE      200     /* Max chars to unget() */
+#define        LINEBUF_SIZE    1024    /* Initial max size of line in input file */
+#define        OUTBUF_SIZE     1024    /* Output buffer */
+#define        PROMPT_SIZE     2048    /* Max size of prompt string */
+#define        TERMBUF_SIZE    2048    /* Termcap buffer for tgetent */
+#define        TERMSBUF_SIZE   1024    /* Buffer to hold termcap strings */
+#define        TAGLINE_SIZE    1024    /* Max size of line in tags file */
+#define        TABSTOP_MAX     128     /* Max number of custom tab stops */
+#endif
 
 /* Define to `long' if <sys/types.h> doesn't define.  */
 /* #define     off_t   long */
index 0bb570e..507ec19 100755 (executable)
 /*
  * Sizes of various buffers.
  */
+#if 0 /* old sizes for small memory machines
 #define        CMDBUF_SIZE     512     /* Buffer for multichar commands */
 #define        UNGOT_SIZE      100     /* Max chars to unget() */
 #define        LINEBUF_SIZE    1024    /* Max size of line in input file */
 #define        TERMSBUF_SIZE   1024    /* Buffer to hold termcap strings */
 #define        TAGLINE_SIZE    512     /* Max size of line in tags file */
 #define        TABSTOP_MAX     32      /* Max number of custom tab stops */
+#else /* more reasonable sizes for modern machines */
+#define        CMDBUF_SIZE     2048    /* Buffer for multichar commands */
+#define        UNGOT_SIZE      200     /* Max chars to unget() */
+#define        LINEBUF_SIZE    1024    /* Initial max size of line in input file */
+#define        OUTBUF_SIZE     1024    /* Output buffer */
+#define        PROMPT_SIZE     2048    /* Max size of prompt string */
+#define        TERMBUF_SIZE    2048    /* Termcap buffer for tgetent */
+#define        TERMSBUF_SIZE   1024    /* Buffer to hold termcap strings */
+#define        TAGLINE_SIZE    1024    /* Max size of line in tags file */
+#define        TABSTOP_MAX     128     /* Max number of custom tab stops */
+#endif
 
 /* Define to `long' if <sys/types.h> doesn't define.  */
 #define off_t long
index d9e0209..dd92261 100755 (executable)
 /*
  * Sizes of various buffers.
  */
+#if 0 /* old sizes for small memory machines
 #define        CMDBUF_SIZE     512     /* Buffer for multichar commands */
 #define        UNGOT_SIZE      100     /* Max chars to unget() */
 #define        LINEBUF_SIZE    1024    /* Max size of line in input file */
 #define        TERMSBUF_SIZE   1024    /* Buffer to hold termcap strings */
 #define        TAGLINE_SIZE    512     /* Max size of line in tags file */
 #define        TABSTOP_MAX     32      /* Max number of custom tab stops */
+#else /* more reasonable sizes for modern machines */
+#define        CMDBUF_SIZE     2048    /* Buffer for multichar commands */
+#define        UNGOT_SIZE      200     /* Max chars to unget() */
+#define        LINEBUF_SIZE    1024    /* Initial max size of line in input file */
+#define        OUTBUF_SIZE     1024    /* Output buffer */
+#define        PROMPT_SIZE     2048    /* Max size of prompt string */
+#define        TERMBUF_SIZE    2048    /* Termcap buffer for tgetent */
+#define        TERMSBUF_SIZE   1024    /* Buffer to hold termcap strings */
+#define        TAGLINE_SIZE    1024    /* Max size of line in tags file */
+#define        TABSTOP_MAX     128     /* Max number of custom tab stops */
+#endif
 
 /* Define to `long' if <sys/types.h> doesn't define.  */
 /* #define     off_t   long */
diff --git a/help.c b/help.c
index 85797f6..46b8ff1 100644 (file)
--- a/help.c
+++ b/help.c
@@ -110,7 +110,7 @@ constant char helpdata[] = {
 ' ',' ',' ',' ',' ',' ',' ',' ','M','o','s','t',' ','o','p','t','i','o','n','s',' ','m','a','y',' ','b','e',' ','c','h','a','n','g','e','d',' ','e','i','t','h','e','r',' ','o','n',' ','t','h','e',' ','c','o','m','m','a','n','d',' ','l','i','n','e',',','\n',
 ' ',' ',' ',' ',' ',' ',' ',' ','o','r',' ','f','r','o','m',' ','w','i','t','h','i','n',' ','l','e','s','s',' ','b','y',' ','u','s','i','n','g',' ','t','h','e',' ','-',' ','o','r',' ','-','-',' ','c','o','m','m','a','n','d','.','\n',
 ' ',' ',' ',' ',' ',' ',' ',' ','O','p','t','i','o','n','s',' ','m','a','y',' ','b','e',' ','g','i','v','e','n',' ','i','n',' ','o','n','e',' ','o','f',' ','t','w','o',' ','f','o','r','m','s',':',' ','e','i','t','h','e','r',' ','a',' ','s','i','n','g','l','e','\n',
-' ',' ',' ',' ',' ',' ',' ',' ','c','h','a','r','a','c','t','e','r',' ','p','r','e','c','e','d','e','d',' ','b','y',' ','a',' ','-',',',' ','o','r',' ','a',' ','n','a','m','e',' ','p','r','e','c','e','e','d','e','d',' ','b','y',' ','-','-','.','\n',
+' ',' ',' ',' ',' ',' ',' ',' ','c','h','a','r','a','c','t','e','r',' ','p','r','e','c','e','d','e','d',' ','b','y',' ','a',' ','-',',',' ','o','r',' ','a',' ','n','a','m','e',' ','p','r','e','c','e','d','e','d',' ','b','y',' ','-','-','.','\n',
 '\n',
 ' ',' ','-','?',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','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',
index a850561..45a7fe5 100755 (executable)
--- a/less.hlp
+++ b/less.hlp
         Most options may be changed either on the command line,
         or from within less by using the - or -- command.
         Options may be given in one of two forms: either a single
-        character preceded by a -, or a name preceeded by --.
+        character preceded by a -, or a name preceded by --.
 
   -?  ........  --help
                   Display help (from command line).
index 1dab1c2..7b9a666 100644 (file)
--- a/less.man
+++ b/less.man
@@ -437,13 +437,18 @@ LESS(1)                                                                LESS(1)
        appears in the LESS variable, it can be reset to its default  value  on
        the command line by beginning the command line option with "-+".
 
-       For  options like -P or -D which take a following string, a dollar sign
-       ($) must be used to signal the end of the string.  For example, to  set
-       two  -D  options  on  MS-DOS, you must have a dollar sign between them,
+       Some  options  like -k or -D require a string to follow the option let-
+       ter.  The string for that option is considered to  end  when  a  dollar
+       sign  ($)  is found.  For example, you can set two -D options on MS-DOS
        like this:
 
-       LESS="-Dn9.1$-Ds4.1"
+       LESS="Dn9.1$Ds4.1"
 
+       If the --use-backslash option appears earlier in the  options,  then  a
+       dollar  sign or backslash may be included literally in an option string
+       by preceding it with a backslash.  If the --use-backslash option is not
+       in  effect, then backslashes are not treated specially, and there is no
+       way to include a dollar sign in the option string.
 
        -? or --help
               This option displays a summary of the commands accepted by  \e[4mless\e[0m
@@ -836,11 +841,6 @@ LESS(1)                                                                LESS(1)
               actual scroll remains at the specified fraction  of  the  screen
               width.
 
-       --no-keypad
-              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, \e[4mless\e[24m will continue to display  the  contents  of  the
@@ -851,6 +851,18 @@ LESS(1)                                                                LESS(1)
               has  been  created  with  the  same  name  as  the original (now
               renamed) file), \e[4mless\e[24m will display the contents of that new file.
 
+       --no-keypad
+              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.
+
+       --use-backslash
+              This option changes the interpretations of options which  follow
+              this one.  After the --use-backslash option, any backslash in an
+              option string is removed and the following  character  is  taken
+              literally.   This  allows a dollar sign to be included in option
+              strings.
+
        --     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
@@ -1597,8 +1609,8 @@ LESS(1)                                                                LESS(1)
 
 
 \e[1mAUTHOR\e[0m
-       Mark Nudelman <bug-less@gnu.org>
-       Send bug reports or comments to bug-less@gnu.org.
+       Mark Nudelman
+       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
@@ -1606,4 +1618,4 @@ LESS(1)                                                                LESS(1)
 
 
 
-                           Version 451: 21 Jul 2012                    LESS(1)
+                           Version 458: 04 Apr 2013                    LESS(1)
index 9c00d21..eba98ee 100644 (file)
--- a/less.nro
+++ b/less.nro
@@ -1,4 +1,4 @@
-.TH LESS 1 "Version 451: 21 Jul 2012"
+.TH LESS 1 "Version 458: 04 Apr 2013"
 .SH NAME
 less \- opposite of more
 .SH SYNOPSIS
@@ -455,13 +455,18 @@ If an option appears in the LESS variable, it can be reset
 to its default value on the command line by beginning the command
 line option with "\-+".
 .sp
-For options like \-P or \-D which take a following string,
-a dollar sign ($) must be used to signal the end of the string.
-For example, to set two \-D options on MS-DOS, you must have
-a dollar sign between them, like this:
+Some options like \-k or \-D require a string to follow the option letter.
+The string for that option is considered to end when a dollar sign ($) is found.
+For example, you can set two \-D options on MS-DOS like this:
 .sp
-LESS="-Dn9.1$-Ds4.1"
+LESS="Dn9.1$Ds4.1"
 .sp
+If the --use-backslash option appears earlier in the options, then
+a dollar sign or backslash may be included literally in an option string
+by preceding it with a backslash.
+If the --use-backslash option is not in effect, then backslashes are
+not treated specially, and there is no way to include a dollar sign 
+in the option string.
 .IP "\-? or \-\-help"
 This option displays a summary of the commands accepted by
 .I less
@@ -890,11 +895,6 @@ If the number is specified 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.
-.IP "\-\-no-keypad"
-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.
 .IP "\-\-follow-name"
 Normally, if the input file is renamed while an F command is executing, 
 .I less
@@ -908,6 +908,16 @@ If the reopen succeeds and the file is a different file from the original
 with the same name as the original (now renamed) file),
 .I less
 will display the contents of that new file.
+.IP "\-\-no-keypad"
+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.
+.IP "\-\-use-backslash"
+This option changes the interpretations of options which follow this one.
+After the \-\-use-backslash option, any backslash in an option string is
+removed and the following character is taken literally.
+This allows a dollar sign to be included in option strings.
 .IP \-\-
 A command line argument of "\-\-" marks the end of option arguments.
 Any arguments following this are interpreted as filenames.
@@ -1739,9 +1749,9 @@ See the GNU General Public License for more details.
 
 .SH AUTHOR
 .PP
-Mark Nudelman <bug-less@gnu.org>
+Mark Nudelman 
 .br
-Send bug reports or comments 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
index 8dda5ab..470a00e 100644 (file)
@@ -51,4 +51,4 @@ LESSECHO(1)                                                        LESSECHO(1)
 
 
 
-                           Version 451: 21 Jul 2012                LESSECHO(1)
+                           Version 458: 04 Apr 2013                LESSECHO(1)
index 0e62698..d7fb390 100644 (file)
@@ -1,4 +1,4 @@
-.TH LESSECHO 1 "Version 451: 21 Jul 2012"
+.TH LESSECHO 1 "Version 458: 04 Apr 2013"
 .SH NAME
 lessecho \- expand metacharacters
 .SH SYNOPSIS
index 968ee1b..9864d40 100644 (file)
@@ -353,4 +353,4 @@ LESSKEY(1)                                                          LESSKEY(1)
 
 
 
-                           Version 451: 21 Jul 2012                 LESSKEY(1)
+                           Version 458: 04 Apr 2013                 LESSKEY(1)
index 4b6f2f4..2bbd887 100644 (file)
@@ -1,4 +1,4 @@
-.TH LESSKEY 1 "Version 451: 21 Jul 2012"
+.TH LESSKEY 1 "Version 458: 04 Apr 2013"
 .SH NAME
 lesskey \- specify key bindings for less
 .SH SYNOPSIS
index 22de614..2c26dc6 100755 (executable)
--- a/option.c
+++ b/option.c
@@ -30,6 +30,7 @@ extern int screen_trashed;
 extern int less_is_more;
 extern int quit_at_eof;
 extern char *every_first_cmd;
+extern int opt_use_backslash;
 
 /*
  * Return a printable description of an option.
@@ -146,10 +147,13 @@ scan_option(s)
                         */
                        plusoption = TRUE;
                        s = optstring(s, &str, propt('+'), NULL);
+                       if (s == NULL)
+                               return;
                        if (*str == '+')
-                               every_first_cmd = save(++str);
+                               every_first_cmd = save(str+1);
                        else
                                ungetsc(str);
+                       free(str);
                        continue;
                case '0':  case '1':  case '2':  case '3':  case '4':
                case '5':  case '6':  case '7':  case '8':  case '9':
@@ -202,7 +206,7 @@ scan_option(s)
                                        parg.p_string = printopt;
                                        error("The %s option should not be followed by =",
                                                &parg);
-                                       quit(QUIT_ERROR);
+                                       return;
                                }
                                s++;
                        } else
@@ -223,7 +227,7 @@ scan_option(s)
                        else
                                error("There is no %s option (\"less --help\" for help)",
                                        &parg);
-                       quit(QUIT_ERROR);
+                       return;
                }
 
                str = NULL;
@@ -260,6 +264,8 @@ scan_option(s)
                        while (*s == ' ')
                                s++;
                        s = optstring(s, &str, printopt, o->odesc[1]);
+                       if (s == NULL)
+                               return;
                        break;
                case NUMBER:
                        if (*s == '\0')
@@ -275,6 +281,8 @@ scan_option(s)
                 */
                if (o->ofunc != NULL)
                        (*o->ofunc)(INIT, str);
+               if (str != NULL)
+                       free(str);
        }
 }
 
@@ -558,35 +566,33 @@ optstring(s, p_str, printopt, validchars)
        char *validchars;
 {
        register char *p;
+       register char *out;
 
        if (*s == '\0')
        {
                nostring(printopt);
-               quit(QUIT_ERROR);
+               return (NULL);
        }
-       *p_str = s;
+       /* Alloc could be more than needed, but not worth trimming. */
+       *p_str = (char *) ecalloc(strlen(s)+1, sizeof(char));
+       out = *p_str;
+
        for (p = s;  *p != '\0';  p++)
        {
-               if (*p == END_OPTION_STRING ||
-                   (validchars != NULL && strchr(validchars, *p) == NULL))
+               if (opt_use_backslash && *p == '\\' && p[1] != '\0')
                {
-                       switch (*p)
-                       {
-                       case END_OPTION_STRING:
-                       case ' ':  case '\t':  case '-':
-                               /* Replace the char with a null to terminate string. */
-                               *p++ = '\0';
-                               break;
-                       default:
-                               /* Cannot replace char; make a copy of the string. */
-                               *p_str = (char *) ecalloc(p-s+1, sizeof(char));
-                               strncpy(*p_str, s, p-s);
-                               (*p_str)[p-s] = '\0';
+                       /* Take next char literally. */
+                       ++p;
+               } else 
+               {
+                       if (*p == END_OPTION_STRING || 
+                           (validchars != NULL && strchr(validchars, *p) == NULL))
+                               /* End of option string. */
                                break;
-                       }
-                       break;
                }
+               *out++ = *p;
        }
+       *out = '\0';
        return (p);
 }
 
@@ -609,8 +615,6 @@ num_error(printopt, errp)
                parg.p_string = printopt;
                error("Number is required after %s", &parg);
        }
-       quit(QUIT_ERROR);
-       /* NOTREACHED */
        return (-1);
 }
 
index 0146793..6f582bf 100755 (executable)
--- a/opttbl.c
+++ b/opttbl.c
@@ -52,6 +52,7 @@ public int use_lessopen;      /* Use the LESSOPEN filter */
 public int quit_on_intr;       /* Quit on interrupt */
 public int follow_mode;                /* F cmd Follows file desc or file name? */
 public int oldbot;             /* Old bottom of screen behavior {{REMOVE}} */
+public int opt_use_backslash;  /* Use backslash escaping in option parsing */
 #if HILITE_SEARCH
 public int hilite_search;      /* Highlight matched search patterns? */
 #endif
@@ -115,6 +116,7 @@ static struct optname pound_optname  = { "shift",                NULL };
 static struct optname keypad_optname = { "no-keypad",            NULL };
 static struct optname oldbot_optname = { "old-bot",              NULL };
 static struct optname follow_optname = { "follow-name",          NULL };
+static struct optname use_backslash_optname = { "use-backslash", NULL };
 
 
 /*
@@ -446,6 +448,14 @@ static struct loption option[] =
                        NULL
                }
        },
+       { OLETTER_NONE, &use_backslash_optname,
+               BOOL, OPT_OFF, &opt_use_backslash, NULL,
+               {
+                       "Use backslash escaping in command line parameters",
+                       "Don't use backslash escaping in command line parameters",
+                       NULL
+               }
+       },
        { '\0', NULL, NOVAR, 0, NULL, NULL, { NULL, NULL, NULL } }
 };
 
index bcc8471..e1f2cff 100755 (executable)
--- a/output.c
+++ b/output.c
@@ -278,8 +278,13 @@ flush()
                                                 */
                                                if (p[-2] == '[')
                                                {
+#if MSDOS_COMPILER==WIN32C
+                                                       fg |= FOREGROUND_INTENSITY;
+                                                       bg |= BACKGROUND_INTENSITY;
+#else
                                                        fg = bo_fg_color;
                                                        bg = bo_bg_color;
+#endif
                                                } else
                                                        fg |= 8;
                                        } else if (at & 2)
index 9518307..b655f07 100755 (executable)
@@ -162,7 +162,7 @@ empty_lines(s, e)
        register int i;
 
        for (i = s;  i <= e;  i++)
-               if (table[i] != NULL_POSITION)
+               if (table[i] != NULL_POSITION && table[i] != 0)
                        return (0);
        return (1);
 }
index 688ba20..a79eba2 100755 (executable)
--- a/screen.c
+++ b/screen.c
@@ -801,7 +801,7 @@ scrsize()
        else if ((n = ltgetnum("li")) > 0)
                sc_height = n;
 #endif
-       else
+       if (sc_height <= 0)
                sc_height = DEF_SC_HEIGHT;
 
        if (sys_width > 0)
@@ -812,7 +812,7 @@ scrsize()
        else if ((n = ltgetnum("co")) > 0)
                sc_width = n;
 #endif
-       else
+       if (sc_width <= 0)
                sc_width = DEF_SC_WIDTH;
 }
 
index 926e840..d3ecd14 100755 (executable)
--- a/version.c
+++ b/version.c
@@ -753,6 +753,15 @@ v448  6/15/12   Print name of regex library in version message.
 v449  6/23/12   Allow config option --with-regex=none.
 v450  7/4/12    Fix EOF bug with ESC-F.
 v451  7/20/12   Fix typo.
+-----------------------------------------------------------------
+v452  10/19/12  Fix --with-regex=none, fix "stty 0", fix Win32.
+                Don't quit if errors in cmd line options.
+v453  10/27/12  Increase buffer sizes.
+v454  11/5/12   Fix typo.
+v455  11/5/12   Fix typo.
+v456  11/8/12   Fix option string incompatibility.
+v457  12/8/12   Use new option string syntax only after --use-backslash.
+v458  4/4/13    Fix display bug in using up/down in cmd buffer.
 */
 
-char version[] = "451";
+char version[] = "458";