svn commit: r221717 - in projects/largeSMP: contrib/less
contrib/top share/mk sys/dev/bge sys/dev/mii sys/vm
Attilio Rao
attilio at FreeBSD.org
Mon May 9 22:29:54 UTC 2011
Author: attilio
Date: Mon May 9 22:29:54 2011
New Revision: 221717
URL: http://svn.freebsd.org/changeset/base/221717
Log:
MFC
Modified:
projects/largeSMP/contrib/less/LICENSE
projects/largeSMP/contrib/less/Makefile.aut
projects/largeSMP/contrib/less/Makefile.wnm
projects/largeSMP/contrib/less/NEWS
projects/largeSMP/contrib/less/README
projects/largeSMP/contrib/less/brac.c
projects/largeSMP/contrib/less/ch.c
projects/largeSMP/contrib/less/charset.c
projects/largeSMP/contrib/less/charset.h
projects/largeSMP/contrib/less/cmd.h
projects/largeSMP/contrib/less/cmdbuf.c
projects/largeSMP/contrib/less/command.c
projects/largeSMP/contrib/less/configure
projects/largeSMP/contrib/less/configure.ac
projects/largeSMP/contrib/less/cvt.c
projects/largeSMP/contrib/less/decode.c
projects/largeSMP/contrib/less/defines.ds
projects/largeSMP/contrib/less/defines.h.in
projects/largeSMP/contrib/less/defines.o2
projects/largeSMP/contrib/less/defines.o9
projects/largeSMP/contrib/less/defines.wn
projects/largeSMP/contrib/less/edit.c
projects/largeSMP/contrib/less/filename.c
projects/largeSMP/contrib/less/forwback.c
projects/largeSMP/contrib/less/funcs.h
projects/largeSMP/contrib/less/help.c
projects/largeSMP/contrib/less/ifile.c
projects/largeSMP/contrib/less/input.c
projects/largeSMP/contrib/less/jump.c
projects/largeSMP/contrib/less/less.h
projects/largeSMP/contrib/less/less.hlp
projects/largeSMP/contrib/less/less.man
projects/largeSMP/contrib/less/less.nro
projects/largeSMP/contrib/less/lessecho.c
projects/largeSMP/contrib/less/lessecho.man
projects/largeSMP/contrib/less/lessecho.nro
projects/largeSMP/contrib/less/lesskey.c
projects/largeSMP/contrib/less/lesskey.h
projects/largeSMP/contrib/less/lesskey.man
projects/largeSMP/contrib/less/lesskey.nro
projects/largeSMP/contrib/less/lglob.h
projects/largeSMP/contrib/less/line.c
projects/largeSMP/contrib/less/linenum.c
projects/largeSMP/contrib/less/lsystem.c
projects/largeSMP/contrib/less/main.c
projects/largeSMP/contrib/less/mark.c
projects/largeSMP/contrib/less/mkhelp.c
projects/largeSMP/contrib/less/optfunc.c
projects/largeSMP/contrib/less/option.c
projects/largeSMP/contrib/less/option.h
projects/largeSMP/contrib/less/opttbl.c
projects/largeSMP/contrib/less/os.c
projects/largeSMP/contrib/less/output.c
projects/largeSMP/contrib/less/pattern.c
projects/largeSMP/contrib/less/pattern.h
projects/largeSMP/contrib/less/pckeys.h
projects/largeSMP/contrib/less/position.c
projects/largeSMP/contrib/less/position.h
projects/largeSMP/contrib/less/prompt.c
projects/largeSMP/contrib/less/screen.c
projects/largeSMP/contrib/less/scrsize.c
projects/largeSMP/contrib/less/search.c
projects/largeSMP/contrib/less/signal.c
projects/largeSMP/contrib/less/tags.c
projects/largeSMP/contrib/less/ttyin.c
projects/largeSMP/contrib/less/version.c
projects/largeSMP/sys/dev/bge/if_bge.c
projects/largeSMP/sys/dev/mii/brgphy.c
projects/largeSMP/sys/dev/mii/miidevs
projects/largeSMP/sys/vm/vm_object.c
Directory Properties:
projects/largeSMP/ (props changed)
projects/largeSMP/cddl/contrib/opensolaris/ (props changed)
projects/largeSMP/contrib/bind9/ (props changed)
projects/largeSMP/contrib/binutils/ (props changed)
projects/largeSMP/contrib/bzip2/ (props changed)
projects/largeSMP/contrib/dialog/ (props changed)
projects/largeSMP/contrib/ee/ (props changed)
projects/largeSMP/contrib/expat/ (props changed)
projects/largeSMP/contrib/file/ (props changed)
projects/largeSMP/contrib/gcc/ (props changed)
projects/largeSMP/contrib/gdb/ (props changed)
projects/largeSMP/contrib/gdtoa/ (props changed)
projects/largeSMP/contrib/gnu-sort/ (props changed)
projects/largeSMP/contrib/groff/ (props changed)
projects/largeSMP/contrib/less/ (props changed)
projects/largeSMP/contrib/libpcap/ (props changed)
projects/largeSMP/contrib/libstdc++/ (props changed)
projects/largeSMP/contrib/llvm/ (props changed)
projects/largeSMP/contrib/llvm/tools/clang/ (props changed)
projects/largeSMP/contrib/ncurses/ (props changed)
projects/largeSMP/contrib/netcat/ (props changed)
projects/largeSMP/contrib/ntp/ (props changed)
projects/largeSMP/contrib/one-true-awk/ (props changed)
projects/largeSMP/contrib/openbsm/ (props changed)
projects/largeSMP/contrib/openpam/ (props changed)
projects/largeSMP/contrib/pf/ (props changed)
projects/largeSMP/contrib/sendmail/ (props changed)
projects/largeSMP/contrib/tcpdump/ (props changed)
projects/largeSMP/contrib/tcsh/ (props changed)
projects/largeSMP/contrib/top/ (props changed)
projects/largeSMP/contrib/top/install-sh (props changed)
projects/largeSMP/contrib/tzcode/stdtime/ (props changed)
projects/largeSMP/contrib/tzcode/zic/ (props changed)
projects/largeSMP/contrib/tzdata/ (props changed)
projects/largeSMP/contrib/wpa/ (props changed)
projects/largeSMP/contrib/xz/ (props changed)
projects/largeSMP/crypto/openssh/ (props changed)
projects/largeSMP/crypto/openssl/ (props changed)
projects/largeSMP/gnu/lib/ (props changed)
projects/largeSMP/gnu/usr.bin/binutils/ (props changed)
projects/largeSMP/gnu/usr.bin/cc/cc_tools/ (props changed)
projects/largeSMP/gnu/usr.bin/gdb/ (props changed)
projects/largeSMP/lib/libc/ (props changed)
projects/largeSMP/lib/libc/stdtime/ (props changed)
projects/largeSMP/lib/libutil/ (props changed)
projects/largeSMP/lib/libz/ (props changed)
projects/largeSMP/sbin/ (props changed)
projects/largeSMP/sbin/ipfw/ (props changed)
projects/largeSMP/share/mk/bsd.arch.inc.mk (props changed)
projects/largeSMP/share/zoneinfo/ (props changed)
projects/largeSMP/sys/ (props changed)
projects/largeSMP/sys/amd64/include/xen/ (props changed)
projects/largeSMP/sys/boot/ (props changed)
projects/largeSMP/sys/boot/i386/efi/ (props changed)
projects/largeSMP/sys/boot/ia64/efi/ (props changed)
projects/largeSMP/sys/boot/ia64/ski/ (props changed)
projects/largeSMP/sys/boot/powerpc/boot1.chrp/ (props changed)
projects/largeSMP/sys/boot/powerpc/ofw/ (props changed)
projects/largeSMP/sys/cddl/contrib/opensolaris/ (props changed)
projects/largeSMP/sys/conf/ (props changed)
projects/largeSMP/sys/contrib/dev/acpica/ (props changed)
projects/largeSMP/sys/contrib/octeon-sdk/ (props changed)
projects/largeSMP/sys/contrib/pf/ (props changed)
projects/largeSMP/sys/contrib/x86emu/ (props changed)
projects/largeSMP/usr.bin/calendar/ (props changed)
projects/largeSMP/usr.bin/csup/ (props changed)
projects/largeSMP/usr.bin/procstat/ (props changed)
projects/largeSMP/usr.sbin/ndiscvt/ (props changed)
projects/largeSMP/usr.sbin/zic/ (props changed)
Modified: projects/largeSMP/contrib/less/LICENSE
==============================================================================
--- projects/largeSMP/contrib/less/LICENSE Mon May 9 22:13:07 2011 (r221716)
+++ projects/largeSMP/contrib/less/LICENSE Mon May 9 22:29:54 2011 (r221717)
@@ -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: projects/largeSMP/contrib/less/Makefile.aut
==============================================================================
--- projects/largeSMP/contrib/less/Makefile.aut Mon May 9 22:13:07 2011 (r221716)
+++ projects/largeSMP/contrib/less/Makefile.aut Mon May 9 22:29:54 2011 (r221717)
@@ -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: projects/largeSMP/contrib/less/Makefile.wnm
==============================================================================
--- projects/largeSMP/contrib/less/Makefile.wnm Mon May 9 22:13:07 2011 (r221716)
+++ projects/largeSMP/contrib/less/Makefile.wnm Mon May 9 22:29:54 2011 (r221717)
@@ -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: projects/largeSMP/contrib/less/NEWS
==============================================================================
--- projects/largeSMP/contrib/less/NEWS Mon May 9 22:13:07 2011 (r221716)
+++ projects/largeSMP/contrib/less/NEWS Mon May 9 22:29:54 2011 (r221717)
@@ -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: projects/largeSMP/contrib/less/README
==============================================================================
--- projects/largeSMP/contrib/less/README Mon May 9 22:13:07 2011 (r221716)
+++ projects/largeSMP/contrib/less/README Mon May 9 22:29:54 2011 (r221717)
@@ -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: projects/largeSMP/contrib/less/brac.c
==============================================================================
--- projects/largeSMP/contrib/less/brac.c Mon May 9 22:13:07 2011 (r221716)
+++ projects/largeSMP/contrib/less/brac.c Mon May 9 22:29:54 2011 (r221717)
@@ -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: projects/largeSMP/contrib/less/ch.c
==============================================================================
--- projects/largeSMP/contrib/less/ch.c Mon May 9 22:13:07 2011 (r221716)
+++ projects/largeSMP/contrib/less/ch.c Mon May 9 22:29:54 2011 (r221717)
@@ -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: projects/largeSMP/contrib/less/charset.c
==============================================================================
--- projects/largeSMP/contrib/less/charset.c Mon May 9 22:13:07 2011 (r221716)
+++ projects/largeSMP/contrib/less/charset.c Mon May 9 22:29:54 2011 (r221717)
@@ -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: projects/largeSMP/contrib/less/charset.h
==============================================================================
--- projects/largeSMP/contrib/less/charset.h Mon May 9 22:13:07 2011 (r221716)
+++ projects/largeSMP/contrib/less/charset.h Mon May 9 22:29:54 2011 (r221717)
@@ -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: projects/largeSMP/contrib/less/cmd.h
==============================================================================
--- projects/largeSMP/contrib/less/cmd.h Mon May 9 22:13:07 2011 (r221716)
+++ projects/largeSMP/contrib/less/cmd.h Mon May 9 22:29:54 2011 (r221717)
@@ -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: projects/largeSMP/contrib/less/cmdbuf.c
==============================================================================
--- projects/largeSMP/contrib/less/cmdbuf.c Mon May 9 22:13:07 2011 (r221716)
+++ projects/largeSMP/contrib/less/cmdbuf.c Mon May 9 22:29:54 2011 (r221717)
@@ -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: projects/largeSMP/contrib/less/command.c
==============================================================================
--- projects/largeSMP/contrib/less/command.c Mon May 9 22:13:07 2011 (r221716)
+++ projects/largeSMP/contrib/less/command.c Mon May 9 22:29:54 2011 (r221717)
@@ -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: projects/largeSMP/contrib/less/configure
==============================================================================
--- projects/largeSMP/contrib/less/configure Mon May 9 22:13:07 2011 (r221716)
+++ projects/largeSMP/contrib/less/configure Mon May 9 22:29:54 2011 (r221717)
@@ -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 ***
More information about the svn-src-projects
mailing list