Author: delphij
Date: Mon May  9 21:51:59 2011
New Revision: 221715
URL: http://svn.freebsd.org/changeset/base/221715

Log:
  MFV: Update to less v443.
  
  MFC after:    1 month

Modified:
  head/contrib/less/LICENSE
  head/contrib/less/Makefile.aut
  head/contrib/less/Makefile.wnm
  head/contrib/less/NEWS
  head/contrib/less/README
  head/contrib/less/brac.c
  head/contrib/less/ch.c
  head/contrib/less/charset.c
  head/contrib/less/charset.h
  head/contrib/less/cmd.h
  head/contrib/less/cmdbuf.c
  head/contrib/less/command.c
  head/contrib/less/configure
  head/contrib/less/configure.ac
  head/contrib/less/cvt.c
  head/contrib/less/decode.c
  head/contrib/less/defines.ds
  head/contrib/less/defines.h.in
  head/contrib/less/defines.o2
  head/contrib/less/defines.o9
  head/contrib/less/defines.wn
  head/contrib/less/edit.c
  head/contrib/less/filename.c
  head/contrib/less/forwback.c
  head/contrib/less/funcs.h
  head/contrib/less/help.c
  head/contrib/less/ifile.c
  head/contrib/less/input.c
  head/contrib/less/jump.c
  head/contrib/less/less.h
  head/contrib/less/less.hlp
  head/contrib/less/less.man
  head/contrib/less/less.nro
  head/contrib/less/lessecho.c
  head/contrib/less/lessecho.man
  head/contrib/less/lessecho.nro
  head/contrib/less/lesskey.c
  head/contrib/less/lesskey.h
  head/contrib/less/lesskey.man
  head/contrib/less/lesskey.nro
  head/contrib/less/lglob.h
  head/contrib/less/line.c
  head/contrib/less/linenum.c
  head/contrib/less/lsystem.c
  head/contrib/less/main.c
  head/contrib/less/mark.c
  head/contrib/less/mkhelp.c
  head/contrib/less/optfunc.c
  head/contrib/less/option.c
  head/contrib/less/option.h
  head/contrib/less/opttbl.c
  head/contrib/less/os.c
  head/contrib/less/output.c
  head/contrib/less/pattern.c
  head/contrib/less/pattern.h
  head/contrib/less/pckeys.h
  head/contrib/less/position.c
  head/contrib/less/position.h
  head/contrib/less/prompt.c
  head/contrib/less/screen.c
  head/contrib/less/scrsize.c
  head/contrib/less/search.c
  head/contrib/less/signal.c
  head/contrib/less/tags.c
  head/contrib/less/ttyin.c
  head/contrib/less/version.c
Directory Properties:
  head/contrib/less/   (props changed)

Modified: head/contrib/less/LICENSE
==============================================================================
--- head/contrib/less/LICENSE   Mon May  9 20:27:49 2011        (r221714)
+++ head/contrib/less/LICENSE   Mon May  9 21:51:59 2011        (r221715)
@@ -2,7 +2,7 @@
                           ------------
 
 Less
-Copyright (C) 1984-2009  Mark Nudelman
+Copyright (C) 1984-2011  Mark Nudelman
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions

Modified: head/contrib/less/Makefile.aut
==============================================================================
--- head/contrib/less/Makefile.aut      Mon May  9 20:27:49 2011        
(r221714)
+++ head/contrib/less/Makefile.aut      Mon May  9 21:51:59 2011        
(r221715)
@@ -34,6 +34,14 @@ DISTFILES = \
 
 all: help.c funcs.h ${srcdir}/configure 
 
+release: .FORCE
+       ${MAKE} -f Makefile.aut tagall 
+       ${MAKE} -f Makefile.aut all 
+       ${MAKE} -f Makefile.aut clean 
+       ${MAKE} -f Makefile.aut dist
+
+.FORCE:
+
 help.c: less.hlp mkhelp
        -mv -f ${srcdir}/help.c ${srcdir}/help.c.old
        rm -rf help.c

Modified: head/contrib/less/Makefile.wnm
==============================================================================
--- head/contrib/less/Makefile.wnm      Mon May  9 20:27:49 2011        
(r221714)
+++ head/contrib/less/Makefile.wnm      Mon May  9 21:51:59 2011        
(r221715)
@@ -7,11 +7,11 @@ CC = cl
 
 # Normal flags
 CFLAGS = /nologo /ML /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c
-LDFLAGS = /subsystem:console /incremental:no /machine:I386
+LDFLAGS = /nologo /subsystem:console /incremental:no /machine:I386
 
 # Debugging flags
 #CFLAGS = /nologo /MDd /W3 /GX /Od /Gm /Zi /I "." /D "WIN32" /D "NDEBUG" /D 
"_CONSOLE" /c
-#LDFLAGS = /subsystem:console /incremental:yes /debug /machine:I386
+#LDFLAGS = /nologo /subsystem:console /incremental:yes /debug /machine:I386
 
 LD = link
 LIBS = user32.lib

Modified: head/contrib/less/NEWS
==============================================================================
--- head/contrib/less/NEWS      Mon May  9 20:27:49 2011        (r221714)
+++ head/contrib/less/NEWS      Mon May  9 21:51:59 2011        (r221715)
@@ -12,6 +12,37 @@
 
 ======================================================================
 
+       Major changes between "less" versions 436 and 443
+
+* Change search behavior such that when a search is given an explicit 
+  pattern, the entire displayed screen is included in the search and 
+  not just the portion after the target line.
+
+* Add -A option to change search behavior to the old way: only
+  the portion of the screen after the target line is searched.
+
+* Add %F formatting to prompt strings, replaced by the last component
+  of the input file.
+
+* Control-G while editing a command exits the command.
+
+* Less now exits with status 2 if control-C is pressed and -K is in effect.
+
+* Fix "ungetc overflow" when passing long commands via the -p option.
+
+* Fix bug in using line filtering via the & command 
+  in combination with -i and -I.
+
+* Fix bug in handling negative arguments to the -j option.
+
+* Fix bug in handling %t in prompt strings.
+
+* Improve handling of long option names.
+
+* Improve percentage calculation for very large files.
+
+======================================================================
+
        Major changes between "less" versions 429 and 436
 
 * Don't pass "-" to non-pipe LESSOPEN unless it starts with "-".

Modified: head/contrib/less/README
==============================================================================
--- head/contrib/less/README    Mon May  9 20:27:49 2011        (r221714)
+++ head/contrib/less/README    Mon May  9 21:51:59 2011        (r221715)
@@ -7,9 +7,9 @@
 **************************************************************************
 **************************************************************************
 
-                            Less, version 436
+                            Less, version 443
 
-    This is the distribution of less, version 436, released 07 Jul 2009.
+    This is the distribution of less, version 443, released 09 Apr 2011.
     This program is part of the GNU project (http://www.gnu.org).
 
     This program is free software.  You may redistribute it and/or
@@ -101,6 +101,10 @@ complaints, etc., you may mail to the au
 Note to hackers: comments noting possible improvements are enclosed
 in double curly brackets {{ like this }}.
 
+(Note that the above note was originally written at a time when 
+"hackers" most commonly meant "enthusiastic and dedicated computer 
+programmers", not "persons who attempt to circumvent computer security".)
+
 
 
 =======================================================================

Modified: head/contrib/less/brac.c
==============================================================================
--- head/contrib/less/brac.c    Mon May  9 20:27:49 2011        (r221714)
+++ head/contrib/less/brac.c    Mon May  9 21:51:59 2011        (r221715)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2009  Mark Nudelman
+ * 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.

Modified: head/contrib/less/ch.c
==============================================================================
--- head/contrib/less/ch.c      Mon May  9 20:27:49 2011        (r221714)
+++ head/contrib/less/ch.c      Mon May  9 21:51:59 2011        (r221715)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2009  Mark Nudelman
+ * 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.

Modified: head/contrib/less/charset.c
==============================================================================
--- head/contrib/less/charset.c Mon May  9 20:27:49 2011        (r221714)
+++ head/contrib/less/charset.c Mon May  9 21:51:59 2011        (r221715)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2009  Mark Nudelman
+ * 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.
@@ -395,7 +395,7 @@ init_charset()
 binary_char(c)
        LWCHAR c;
 {
-    if (utf_mode)
+       if (utf_mode)
                return (is_ubin_char(c));
        c &= 0377;
        return (chardef[c] & IS_BINARY_CHAR);
@@ -817,7 +817,7 @@ static struct wchar_range ubin_table[] =
        {  0x000B,  0x000C} /* Cc */, 
        {  0x000E,  0x001A} /* Cc */, 
        {  0x001C,  0x001F} /* Cc */, 
-    {  0x007F,  0x009F} /* Cc */,
+       {  0x007F,  0x009F} /* Cc */,
 #if 0
        {  0x00AD,  0x00AD} /* Cf */,
 #endif

Modified: head/contrib/less/charset.h
==============================================================================
--- head/contrib/less/charset.h Mon May  9 20:27:49 2011        (r221714)
+++ head/contrib/less/charset.h Mon May  9 21:51:59 2011        (r221715)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005-2009  Mark Nudelman
+ * 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.

Modified: head/contrib/less/cmd.h
==============================================================================
--- head/contrib/less/cmd.h     Mon May  9 20:27:49 2011        (r221714)
+++ head/contrib/less/cmd.h     Mon May  9 21:51:59 2011        (r221715)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2009  Mark Nudelman
+ * 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.
@@ -98,6 +98,7 @@
 #define        EC_F_COMPLETE   17
 #define        EC_B_COMPLETE   18
 #define        EC_LITERAL      19
+#define        EC_ABORT        20
 
 #define        EC_NOACTION     101
 #define        EC_UINVALID     102

Modified: head/contrib/less/cmdbuf.c
==============================================================================
--- head/contrib/less/cmdbuf.c  Mon May  9 20:27:49 2011        (r221714)
+++ head/contrib/less/cmdbuf.c  Mon May  9 21:51:59 2011        (r221715)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2009  Mark Nudelman
+ * 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.
@@ -857,6 +857,10 @@ cmd_edit(c)
        case EC_LINEKILL:
                not_in_completion();
                return (cmd_kill());
+       case EC_ABORT:
+               not_in_completion();
+               (void) cmd_kill();
+               return (CC_QUIT);
        case EC_W_BACKSPACE:
                not_in_completion();
                return (cmd_werase());

Modified: head/contrib/less/command.c
==============================================================================
--- head/contrib/less/command.c Mon May  9 20:27:49 2011        (r221714)
+++ head/contrib/less/command.c Mon May  9 21:51:59 2011        (r221715)
@@ -1,6 +1,6 @@
 /* $FreeBSD$ */
 /*
- * Copyright (C) 1984-2009  Mark Nudelman
+ * 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.
@@ -57,8 +57,6 @@ extern int shift_count;
 extern int oldbot;
 extern int forw_prompt;
 
-static char ungot[UNGOT_SIZE];
-static char *ungotp = NULL;
 #if SHELL_ESCAPE
 static char *shellcmd = NULL;  /* For holding last shell command for "!!" */
 #endif
@@ -66,7 +64,8 @@ static int mca;                       /* The multicharacter 
 static int search_type;                /* The previous type of search */
 static LINENUM number;         /* The number typed by the user */
 static long fraction;          /* The fractional part of the number */
-static char optchar;
+static struct loption *curropt;
+static int opt_lower;
 static int optflag;
 static int optgetname;
 static POSITION bottompos;
@@ -75,6 +74,13 @@ static int save_hshift;
 static char pipec;
 #endif
 
+struct ungot {
+       struct ungot *ug_next;
+       char ug_char;
+};
+static struct ungot* ungot = NULL;
+static int unget_end = 0;
+
 static void multi_search();
 
 /*
@@ -228,8 +234,8 @@ exec_mca()
                        every_first_cmd = save(cbuf);
                break;
        case A_OPT_TOGGLE:
-               toggle_option(optchar, cbuf, optflag);
-               optchar = '\0';
+               toggle_option(curropt, opt_lower, cbuf, optflag);
+               curropt = NULL;
                break;
        case A_F_BRACKET:
                match_brac(cbuf[0], cbuf[1], 1, (int) number);
@@ -282,22 +288,254 @@ exec_mca()
 }
 
 /*
- * Add a character to a multi-character command.
+ * Is a character an erase or kill char?
  */
        static int
-mca_char(c)
+is_erase_char(c)
+       int c;
+{
+       return (c == erase_char || c == erase2_char || c == kill_char);
+}
+
+/*
+ * Handle the first char of an option (after the initial dash).
+ */
+       static int
+mca_opt_first_char(c)
+       int c;
+{
+       int flag = (optflag & ~OPT_NO_PROMPT);
+       if (flag == OPT_NO_TOGGLE)
+       {
+               switch (c)
+               {
+               case '_':
+                       /* "__" = long option name. */
+                       optgetname = TRUE;
+                       mca_opt_toggle();
+                       return (MCA_MORE);
+               }
+       } else
+       {
+               switch (c)
+               {
+               case '+':
+                       /* "-+" = UNSET. */
+                       optflag = (flag == OPT_UNSET) ?
+                               OPT_TOGGLE : OPT_UNSET;
+                       mca_opt_toggle();
+                       return (MCA_MORE);
+               case '!':
+                       /* "-!" = SET */
+                       optflag = (flag == OPT_SET) ?
+                               OPT_TOGGLE : OPT_SET;
+                       mca_opt_toggle();
+                       return (MCA_MORE);
+               case CONTROL('P'):
+                       optflag ^= OPT_NO_PROMPT;
+                       mca_opt_toggle();
+                       return (MCA_MORE);
+               case '-':
+                       /* "--" = long option name. */
+                       optgetname = TRUE;
+                       mca_opt_toggle();
+                       return (MCA_MORE);
+               }
+       }
+       /* Char was not handled here. */
+       return (NO_MCA);
+}
+
+/*
+ * Add a char to a long option name.
+ * See if we've got a match for an option name yet.
+ * If so, display the complete name and stop 
+ * accepting chars until user hits RETURN.
+ */
+       static int
+mca_opt_nonfirst_char(c)
        int c;
 {
        char *p;
-       int flag;
-       char buf[3];
+       char *oname;
+
+       if (curropt != NULL)
+       {
+               /*
+                * Already have a match for the name.
+                * Don't accept anything but erase/kill.
+                */
+               if (is_erase_char(c))
+                       return (MCA_DONE);
+               return (MCA_MORE);
+       }
+       /*
+        * Add char to cmd buffer and try to match
+        * the option name.
+        */
+       if (cmd_char(c) == CC_QUIT)
+               return (MCA_DONE);
+       p = get_cmdbuf();
+       opt_lower = ASCII_IS_LOWER(p[0]);
+       curropt = findopt_name(&p, &oname, NULL);
+       if (curropt != NULL)
+       {
+               /*
+                * Got a match.
+                * Remember the option and
+                * display the full option name.
+                */
+               cmd_reset();
+               mca_opt_toggle();
+               for (p = oname;  *p != '\0';  p++)
+               {
+                       c = *p;
+                       if (!opt_lower && ASCII_IS_LOWER(c))
+                               c = ASCII_TO_UPPER(c);
+                       if (cmd_char(c) != CC_OK)
+                               return (MCA_DONE);
+               }
+       }
+       return (MCA_MORE);
+}
+
+/*
+ * Handle a char of an option toggle command.
+ */
+       static int
+mca_opt_char(c)
+       int c;
+{
        PARG parg;
 
+       /*
+        * This may be a short option (single char),
+        * or one char of a long option name,
+        * or one char of the option parameter.
+        */
+       if (curropt == NULL && len_cmdbuf() == 0)
+       {
+               int ret = mca_opt_first_char(c);
+               if (ret != NO_MCA)
+                       return (ret);
+       }
+       if (optgetname)
+       {
+               /* We're getting a long option name.  */
+               if (c != '\n' && c != '\r')
+                       return (mca_opt_nonfirst_char(c));
+               if (curropt == NULL)
+               {
+                       parg.p_string = get_cmdbuf();
+                       error("There is no --%s option", &parg);
+                       return (MCA_DONE);
+               }
+               optgetname = FALSE;
+               cmd_reset();
+       } else
+       {
+               if (is_erase_char(c))
+                       return (NO_MCA);
+               if (curropt != NULL)
+                       /* We're getting the option parameter. */
+                       return (NO_MCA);
+               curropt = findopt(c);
+               if (curropt == NULL)
+               {
+                       parg.p_string = propt(c);
+                       error("There is no %s option", &parg);
+                       return (MCA_DONE);
+               }
+       }
+       /*
+        * If the option which was entered does not take a 
+        * parameter, toggle the option immediately,
+        * so user doesn't have to hit RETURN.
+        */
+       if ((optflag & ~OPT_NO_PROMPT) != OPT_TOGGLE ||
+           !opt_has_param(curropt))
+       {
+               toggle_option(curropt, ASCII_IS_LOWER(c), "", optflag);
+               return (MCA_DONE);
+       }
+       /*
+        * Display a prompt appropriate for the option parameter.
+        */
+       start_mca(A_OPT_TOGGLE, opt_prompt(curropt), (void*)NULL, 0);
+       return (MCA_MORE);
+}
+
+/*
+ * Handle a char of a search command.
+ */
+       static int
+mca_search_char(c)
+       int c;
+{
+       int flag = 0;
+
+       /*
+        * Certain characters as the first char of 
+        * the pattern have special meaning:
+        *      !  Toggle the NO_MATCH flag
+        *      *  Toggle the PAST_EOF flag
+        *      @  Toggle the FIRST_FILE flag
+        */
+       if (len_cmdbuf() > 0)
+               return (NO_MCA);
+
+       switch (c)
+       {
+       case '*':
+               if (less_is_more)
+                       break;
+       case CONTROL('E'): /* ignore END of file */
+               if (mca != A_FILTER)
+                       flag = SRCH_PAST_EOF;
+               break;
+       case '@':
+               if (less_is_more)
+                       break;
+       case CONTROL('F'): /* FIRST file */
+               if (mca != A_FILTER)
+                       flag = SRCH_FIRST_FILE;
+               break;
+       case CONTROL('K'): /* KEEP position */
+               if (mca != A_FILTER)
+                       flag = SRCH_NO_MOVE;
+               break;
+       case CONTROL('R'): /* Don't use REGULAR EXPRESSIONS */
+               flag = SRCH_NO_REGEX;
+               break;
+       case CONTROL('N'): /* NOT match */
+       case '!':
+               flag = SRCH_NO_MATCH;
+               break;
+       }
+
+       if (flag != 0)
+       {
+               search_type ^= flag;
+               mca_search();
+               return (MCA_MORE);
+       }
+       return (NO_MCA);
+}
+
+/*
+ * Handle a character of a multi-character command.
+ */
+       static int
+mca_char(c)
+       int c;
+{
+       int ret;
+
        switch (mca)
        {
        case 0:
                /*
-                * Not in a multicharacter command.
+                * We're not in a multicharacter command.
                 */
                return (NO_MCA);
 
@@ -320,7 +558,8 @@ mca_char(c)
                {
                        /*
                         * Not part of the number.
-                        * Treat as a normal command character.
+                        * End the number and treat this char 
+                        * as a normal command character.
                         */
                        number = cmd_int(&fraction);
                        mca = 0;
@@ -330,218 +569,26 @@ mca_char(c)
                break;
 
        case A_OPT_TOGGLE:
-               /*
-                * Special case for the TOGGLE_OPTION command.
-                * If the option letter which was entered is a
-                * single-char option, execute the command immediately,
-                * so user doesn't have to hit RETURN.
-                * If the first char is + or -, this indicates
-                * OPT_UNSET or OPT_SET respectively, instead of OPT_TOGGLE.
-                * "--" begins inputting a long option name.
-                */
-               if (optchar == '\0' && len_cmdbuf() == 0)
-               {
-                       flag = (optflag & ~OPT_NO_PROMPT);
-                       if (flag == OPT_NO_TOGGLE)
-                       {
-                               switch (c)
-                               {
-                               case '_':
-                                       /* "__" = long option name. */
-                                       optgetname = TRUE;
-                                       mca_opt_toggle();
-                                       return (MCA_MORE);
-                               }
-                       } else
-                       {
-                               switch (c)
-                               {
-                               case '+':
-                                       /* "-+" = UNSET. */
-                                       optflag = (flag == OPT_UNSET) ?
-                                               OPT_TOGGLE : OPT_UNSET;
-                                       mca_opt_toggle();
-                                       return (MCA_MORE);
-                               case '!':
-                                       /* "-!" = SET */
-                                       optflag = (flag == OPT_SET) ?
-                                               OPT_TOGGLE : OPT_SET;
-                                       mca_opt_toggle();
-                                       return (MCA_MORE);
-                               case CONTROL('P'):
-                                       optflag ^= OPT_NO_PROMPT;
-                                       mca_opt_toggle();
-                                       return (MCA_MORE);
-                               case '-':
-                                       /* "--" = long option name. */
-                                       optgetname = TRUE;
-                                       mca_opt_toggle();
-                                       return (MCA_MORE);
-                               }
-                       }
-               }
-               if (optgetname)
-               {
-                       /*
-                        * We're getting a long option name.
-                        * See if we've matched an option name yet.
-                        * If so, display the complete name and stop 
-                        * accepting chars until user hits RETURN.
-                        */
-                       struct loption *o;
-                       char *oname;
-                       int lc;
-
-                       if (c == '\n' || c == '\r')
-                       {
-                               /*
-                                * When the user hits RETURN, make sure
-                                * we've matched an option name, then
-                                * pretend he just entered the equivalent
-                                * option letter.
-                                */
-                               if (optchar == '\0')
-                               {
-                                       parg.p_string = get_cmdbuf();
-                                       error("There is no --%s option", &parg);
-                                       return (MCA_DONE);
-                               }
-                               optgetname = FALSE;
-                               cmd_reset();
-                               c = optchar;
-                       } else
-                       {
-                               if (optchar != '\0')
-                               {
-                                       /*
-                                        * Already have a match for the name.
-                                        * Don't accept anything but erase/kill.
-                                        */
-                                       if (c == erase_char ||
-                                           c == erase2_char ||
-                                           c == kill_char)
-                                               return (MCA_DONE);
-                                       return (MCA_MORE);
-                               }
-                               /*
-                                * Add char to cmd buffer and try to match
-                                * the option name.
-                                */
-                               if (cmd_char(c) == CC_QUIT)
-                                       return (MCA_DONE);
-                               p = get_cmdbuf();
-                               lc = ASCII_IS_LOWER(p[0]);
-                               o = findopt_name(&p, &oname, NULL);
-                               if (o != NULL)
-                               {
-                                       /*
-                                        * Got a match.
-                                        * Remember the option letter and
-                                        * display the full option name.
-                                        */
-                                       optchar = o->oletter;
-                                       if (!lc && ASCII_IS_LOWER(optchar))
-                                               optchar = 
ASCII_TO_UPPER(optchar);
-                                       cmd_reset();
-                                       mca_opt_toggle();
-                                       for (p = oname;  *p != '\0';  p++)
-                                       {
-                                               c = *p;
-                                               if (!lc && ASCII_IS_LOWER(c))
-                                                       c = ASCII_TO_UPPER(c);
-                                               if (cmd_char(c) != CC_OK)
-                                                       return (MCA_DONE);
-                                       }
-                               }
-                               return (MCA_MORE);
-                       }
-               } else
-               {
-                       if (c == erase_char || c == erase2_char || c == 
kill_char)
-                               break;
-                       if (optchar != '\0')
-                               /* We already have the option letter. */
-                               break;
-               }
-
-               optchar = c;
-               if ((optflag & ~OPT_NO_PROMPT) != OPT_TOGGLE ||
-                   single_char_option(c))
-               {
-                       toggle_option(c, "", optflag);
-                       return (MCA_DONE);
-               }
-               /*
-                * Display a prompt appropriate for the option letter.
-                */
-               if ((p = opt_prompt(c)) == NULL)
-               {
-                       buf[0] = '-';
-                       buf[1] = c;
-                       buf[2] = '\0';
-                       p = buf;
-               }
-               start_mca(A_OPT_TOGGLE, p, (void*)NULL, 0);
-               return (MCA_MORE);
+               ret = mca_opt_char(c);
+               if (ret != NO_MCA)
+                       return (ret);
+               break;
 
        case A_F_SEARCH:
        case A_B_SEARCH:
        case A_FILTER:
-               /*
-                * Special case for search commands.
-                * Certain characters as the first char of 
-                * the pattern have special meaning:
-                *      !  Toggle the NO_MATCH flag
-                *      *  Toggle the PAST_EOF flag
-                *      @  Toggle the FIRST_FILE flag
-                */
-               if (len_cmdbuf() > 0)
-                       /*
-                        * Only works for the first char of the pattern.
-                        */
-                       break;
+               ret = mca_search_char(c);
+               if (ret != NO_MCA)
+                       return (ret);
+               break;
 
-               flag = 0;
-               switch (c)
-               {
-               case '*':
-                       if (less_is_more)
-                               break;
-               case CONTROL('E'): /* ignore END of file */
-                       if (mca != A_FILTER)
-                               flag = SRCH_PAST_EOF;
-                       break;
-               case '@':
-                       if (less_is_more)
-                               break;
-               case CONTROL('F'): /* FIRST file */
-                       if (mca != A_FILTER)
-                               flag = SRCH_FIRST_FILE;
-                       break;
-               case CONTROL('K'): /* KEEP position */
-                       if (mca != A_FILTER)
-                               flag = SRCH_NO_MOVE;
-                       break;
-               case CONTROL('R'): /* Don't use REGULAR EXPRESSIONS */
-                       flag = SRCH_NO_REGEX;
-                       break;
-               case CONTROL('N'): /* NOT match */
-               case '!':
-                       flag = SRCH_NO_MATCH;
-                       break;
-               }
-               if (flag != 0)
-               {
-                       search_type ^= flag;
-                       mca_search();
-                       return (MCA_MORE);
-               }
+       default:
+               /* Other multicharacter command. */
                break;
        }
 
        /*
-        * Any other multicharacter command
-        * is terminated by a newline.
+        * The multichar command is terminated by a newline.
         */
        if (c == '\n' || c == '\r')
        {
@@ -641,7 +688,7 @@ prompt()
 {
        register char *p;
 
-       if (ungotp != NULL && ungotp > ungot)
+       if (ungot != NULL)
        {
                /*
                 * No prompt necessary if commands are from 
@@ -731,48 +778,59 @@ dispversion()
        public int
 getcc()
 {
-       if (ungotp == NULL)
+       if (unget_end) 
+       {
                /*
-                * Normal case: no ungotten chars, so get one from the user.
+                * We have just run out of ungotten chars.
                 */
-               return (getchr());
-
-       if (ungotp > ungot)
+               unget_end = 0;
+               if (len_cmdbuf() == 0 || !empty_screen())
+                       return (getchr());
                /*
-                * Return the next ungotten char.
+                * Command is incomplete, so try to complete it.
                 */
-               return (*--ungotp);
+               switch (mca)
+               {
+               case A_DIGIT:
+                       /*
+                        * We have a number but no command.  Treat as #g.
+                        */
+                       return ('g');
 
-       /*
-        * We have just run out of ungotten chars.
-        */
-       ungotp = NULL;
-       if (len_cmdbuf() == 0 || !empty_screen())
-               return (getchr());
-       /*
-        * Command is incomplete, so try to complete it.
-        */
-       switch (mca)
-       {
-       case A_DIGIT:
-               /*
-                * We have a number but no command.  Treat as #g.
-                */
-               return ('g');
+               case A_F_SEARCH:
+               case A_B_SEARCH:
+                       /*
+                        * We have "/string" but no newline.  Add the \n.
+                        */
+                       return ('\n'); 
 
-       case A_F_SEARCH:
-       case A_B_SEARCH:
-               /*
-                * We have "/string" but no newline.  Add the \n.
-                */
-               return ('\n'); 
+               default:
+                       /*
+                        * Some other incomplete command.  Let user complete it.
+                        */
+                       return (getchr());
+               }
+       }
 
-       default:
+       if (ungot == NULL)
+       {
                /*
-                * Some other incomplete command.  Let user complete it.
+                * Normal case: no ungotten chars, so get one from the user.
                 */
                return (getchr());
        }
+
+       /*
+        * Return the next ungotten char.
+        */
+       {
+               struct ungot *ug = ungot;
+               char c = ug->ug_char;
+               ungot = ug->ug_next;
+               free(ug);
+               unget_end = (ungot == NULL);
+               return (c);
+       }
 }
 
 /*
@@ -783,14 +841,11 @@ getcc()
 ungetcc(c)
        int c;
 {
-       if (ungotp == NULL)
-               ungotp = ungot;
-       if (ungotp >= ungot + sizeof(ungot))
-       {
-               error("ungetcc overflow", NULL_PARG);
-               quit(QUIT_ERROR);
-       }
-       *ungotp++ = c;
+       struct ungot *ug = (struct ungot *) ecalloc(1, sizeof(struct ungot));
+
+       ug->ug_char = c;
+       ug->ug_next = ungot;
+       ungot = ug;
 }
 
 /*
@@ -933,7 +988,7 @@ commands()
                mca = 0;
                cmd_accept();
                number = 0;
-               optchar = '\0';
+               curropt = NULL;
 
                /*
                 * See if any signals need processing.

Modified: head/contrib/less/configure
==============================================================================
--- head/contrib/less/configure Mon May  9 20:27:49 2011        (r221714)
+++ head/contrib/less/configure Mon May  9 21:51:59 2011        (r221715)
@@ -1,18 +1,22 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.63 for less 1.
+# Generated by GNU Autoconf 2.67 for less 1.
+#
 #
 # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
+# Foundation, Inc.
+#
+#
 # This configure script is free software; the Free Software Foundation
 # gives unlimited permission to copy, distribute and modify it.
-## --------------------- ##
-## M4sh Initialization.  ##
-## --------------------- ##
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
 
 # Be more Bourne compatible
 DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
   emulate sh
   NULLCMD=:
   # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
@@ -20,23 +24,15 @@ if test -n "${ZSH_VERSION+set}" && (emul
   alias -g '${1+"$@"}'='"$@"'
   setopt NO_GLOB_SUBST
 else
-  case `(set -o) 2>/dev/null` in
-  *posix*) set -o posix ;;
+  case `(set -o) 2>/dev/null` in #(
+  *posix*) :
+    set -o posix ;; #(
+  *) :
+     ;;
 esac
-
 fi
 
 
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
 as_nl='
 '
 export as_nl
@@ -44,7 +40,13 @@ export as_nl
 
as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
 as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-if (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+    && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+  as_echo='print -r --'
+  as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
   as_echo='printf %s\n'
   as_echo_n='printf %s'
 else
@@ -55,7 +57,7 @@ else
     as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
     as_echo_n_body='eval
       arg=$1;
-      case $arg in
+      case $arg in #(
       *"$as_nl"*)
        expr "X$arg" : "X\\(.*\\)$as_nl";
        arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
@@ -78,13 +80,6 @@ if test "${PATH_SEPARATOR+set}" != set; 
   }
 fi
 
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-  as_unset=unset
-else
-  as_unset=false
-fi
-
 
 # IFS
 # We need space, tab and new line, in precisely that order.  Quoting is
@@ -94,15 +89,15 @@ fi
 IFS=" ""       $as_nl"
 
 # Find who we are.  Look in the path if we contain no directory separator.
-case $0 in
+case $0 in #((
   *[\\/]* ) as_myself=$0 ;;
   *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
 for as_dir in $PATH
 do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
-  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
+    test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+  done
 IFS=$as_save_IFS
 
      ;;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to