bin/54072: [PATCH] update contrib/less (usr.bin/less) to version 381

Lukas Ertl l.ertl at univie.ac.at
Thu Jul 3 12:40:20 PDT 2003


>Number:         54072
>Category:       bin
>Synopsis:       [PATCH] update contrib/less (usr.bin/less) to version 381
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          update
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jul 03 12:40:02 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Lukas Ertl
>Release:        FreeBSD 5.1-CURRENT i386
>Organization:
Vienna University Computer Center
>Environment:
System: FreeBSD korben 5.1-CURRENT FreeBSD 5.1-CURRENT #18: Tue Jul 1 18:08:41 CEST 2003 le at korben:/usr/obj/usr/src/sys/KORBEN i386


	
>Description:

This patch updates usr.bin/less (which is contrib/less) to version 381.

>How-To-Repeat:
	
>Fix:

	

--- less.diff begins here ---
Index: contrib/less/LICENSE
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/LICENSE,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 LICENSE
--- contrib/less/LICENSE	22 May 2000 09:53:22 -0000	1.1.1.1
+++ contrib/less/LICENSE	3 Jul 2003 19:03:04 -0000
@@ -2,7 +2,7 @@
                           ------------
 
 Less
-Copyright (C) 1984-2000  Mark Nudelman
+Copyright (C) 1984-2002  Mark Nudelman
 
 Redistribution and use in source and binary forms, with or without
 modification, are permitted provided that the following conditions
Index: contrib/less/Makefile.aut
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/Makefile.aut,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 Makefile.aut
--- contrib/less/Makefile.aut	7 Jan 2002 20:29:08 -0000	1.1.1.3
+++ contrib/less/Makefile.aut	3 Jul 2003 19:03:04 -0000
@@ -23,9 +23,9 @@
 DISTFILES = \
 	${SRC} regexp.c regexp.h \
 	COPYING INSTALL LICENSE Makefile.in Makefile.aut NEWS README \
-	configure configure.in acconfig.h lesskey.c lessecho.c scrsize.c \
+	configure configure.ac lesskey.c lessecho.c scrsize.c \
 	cmd.h funcs.h lglob.h less.h lesskey.h option.h pckeys.h position.h \
-	install.sh defines.h.in defines.h.top mkinstalldirs \
+	install.sh defines.h.in mkinstalldirs \
 	less.nro lesskey.nro less.man lesskey.man less.hlp \
 	mkfuncs.awk mkhelp.c \
 	${DISTFILES_W}
@@ -41,10 +41,8 @@
 mkhelp: mkhelp.c
 	${CC} -o mkhelp mkhelp.c
 
-${srcdir}/configure: ${srcdir}/configure.in \
-		${srcdir}/Makefile.in \
-		${srcdir}/defines.h.top \
-		${srcdir}/acconfig.h
+${srcdir}/configure: ${srcdir}/configure.ac \
+		${srcdir}/Makefile.in
 	cd ${srcdir}; autoheader; autoconf
 
 funcs.h: ${SRC:%=${srcdir}/%}
Index: contrib/less/Makefile.dsg
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/Makefile.dsg,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 Makefile.dsg
--- contrib/less/Makefile.dsg	22 May 2000 09:53:22 -0000	1.1.1.1
+++ contrib/less/Makefile.dsg	3 Jul 2003 19:03:04 -0000
@@ -6,6 +6,9 @@
 VPATH = .
 
 CC = gcc
+INSTALL = ginstall -c
+INSTALL_PROGRAM = ginstall
+INSTALL_DATA = ginstall -m 644
 AWK = gawk
 
 CFLAGS = -O2 -g
@@ -15,13 +18,20 @@
 O=o
 
 LIBS =
+prefix = /dev/env/DJDIR
+exec_prefix = ${prefix}
+
+bindir = ${exec_prefix}/bin
+sysconfdir = ${prefix}/etc
+mandir = ${prefix}/man
+manext = 1
 
 #### End of system configuration section. ####
 
 # This rule allows us to supply the necessary -D options
 # in addition to whatever the user asks for.
 .c.o:
-	${CC} -I. ${CFLAGS_COMPILE_ONLY} ${CPPFLAGS} ${CFLAGS} $<
+	${CC} -I. ${CFLAGS_COMPILE_ONLY} -DBINDIR=\"${bindir}\" -DSYSDIR=\"${sysconfdir}\" ${CPPFLAGS} ${CFLAGS} $<
 
 OBJ =	main.${O} screen.${O} brac.${O} ch.${O} charset.${O} cmdbuf.${O} \
 	command.${O} decode.${O} edit.${O} filename.${O} forwback.${O} \
@@ -44,7 +54,14 @@
 defines.h: defines.ds
 	command.com /c copy $< $@
 
-${OBJ}: less.h defines.h funcs.h
+${OBJ}: ${srcdir}/less.h defines.h ${srcdir}/funcs.h
+
+install: all ${srcdir}/less.man ${srcdir}/lesskey.man
+	${INSTALL_PROGRAM} less.exe ${bindir}/less.exe
+	${INSTALL_PROGRAM} lesskey.exe ${bindir}/lesskey.exe
+	${INSTALL_PROGRAM} lessecho.exe ${bindir}/lessecho.exe
+	${INSTALL_DATA} ${srcdir}/less.man ${mandir}/man${manext}/less.${manext}
+	${INSTALL_DATA} ${srcdir}/lesskey.man ${mandir}/man${manext}/lesskey.${manext}
 
 info:
 install-info:
Index: contrib/less/Makefile.dsm
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/Makefile.dsm,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 Makefile.dsm
--- contrib/less/Makefile.dsm	22 May 2000 09:53:22 -0000	1.1.1.1
+++ contrib/less/Makefile.dsm	3 Jul 2003 19:03:04 -0000
@@ -1,58 +0,0 @@
-# Makefile for less.
-# MS-DOS version
-
-#### Start of system configuration section. ####
-
-CC = cl
-# Change the following directories to match your installation.
-LIBDIR = c:\msvc\lib
-INCDIR = c:\msvc\include
-
-# CFLAGS are compile-time options and LDFLAGS are link-time options. They are
-# customized for MSVC 1.0 (MSC 8.0). If you have a different version of the
-# compiler, you may need to change some of the options to their equivalents.
-# -Ot     optimize for speed
-# -AL     large memory model
-# -Za     ANSI C conformance
-# -nologo suppress MSVC banners
-# -onerror:noexe   no .EXE file if link errors occur
-CFLAGS = -Ot -AL -Za -nologo
-LDFLAGS = -onerror:noexe -nologo
-LIBS = $(LIBDIR)\llibce.lib $(LIBDIR)\graphics.lib
-
-#### End of system configuration section. ####
-
-# This rule allows us to supply the necessary -D options
-# in addition to whatever the user asks for.
-.c.obj:
-	$(CC) -c -I. -I$(INCDIR) $(CPPFLAGS) $(CFLAGS) $<
-
-OBJ =	main.obj screen.obj brac.obj ch.obj charset.obj cmdbuf.obj command.obj \
-	decode.obj edit.obj filename.obj forwback.obj help.obj ifile.obj \
-	input.obj jump.obj line.obj linenum.obj lsystem.obj \
-	mark.obj optfunc.obj option.obj opttbl.obj os.obj output.obj \
-	position.obj prompt.obj search.obj signal.obj tags.obj \
-	ttyin.obj version.obj
-
-all: less lesskey
-
-# This is really horrible, but the command line is too long for 
-# MS-DOS if we try to link $(OBJ).
-less: $(OBJ)
-	-if exist lesskey.obj del lesskey.obj
-	$(CC) $(LDFLAGS) -o $@ *.obj $(LIBS)
-
-lesskey: lesskey.obj version.obj
-	$(CC) $(LDFLAGS) -o $@ lesskey.obj version.obj $(LIBS)
-
-defines.h: defines.ds
-	-del defines.h
-	-copy defines.ds defines.h
-
-$(OBJ): less.h defines.h
-
-clean:
-	-del *.obj 
-	-del less.exe
-	-del lesskey.exe
-
Index: contrib/less/Makefile.in
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/Makefile.in,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 Makefile.in
--- contrib/less/Makefile.in	7 Jan 2002 20:29:08 -0000	1.1.1.2
+++ contrib/less/Makefile.in	3 Jul 2003 19:03:04 -0000
@@ -96,7 +96,7 @@
 config.status: ${srcdir}/configure
 	./config.status --recheck
 
-${srcdir}/configure: ${srcdir}/configure.in
+${srcdir}/configure: ${srcdir}/configure.ac
 	cd ${srcdir}; autoheader; autoconf
 
 clean:
Index: contrib/less/NEWS
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/NEWS,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 NEWS
--- contrib/less/NEWS	7 Jan 2002 20:29:10 -0000	1.1.1.3
+++ contrib/less/NEWS	3 Jul 2003 19:03:04 -0000
@@ -13,7 +13,38 @@
 ======================================================================
 
 
-	Major changes between "less" versions 358 and 371
+	Major changes between "less" versions 378 and 381
+
+* New -L option to disable LESSOPEN processing.
+
+* Further support for large (64 bit) file addressing.
+  Large file support is now set up by the configure script.
+
+* Use autoconf 2.54.
+  Replace configure.in, acconfig.h, defines.h.top with configure.ac.
+
+* Overstriking underscore with underscore is now bold or underlined 
+  depending on context.
+
+* Use only 7 spaces for line numbers in -N mode, if possible.
+
+* Fix some bugs in handling overstriking in UTF-8 files.
+
+* Fix some nroff issues in the man page.
+
+======================================================================
+
+	Major changes between "less" versions 376 and 378
+
+* Bug fixes:
+  Default buffer space is now 64K as documented.
+  Search highlighting works properly when used with -R.
+  Windows version works properly when input file contains carriage returns.
+  Clean up some compiler warnings.
+
+======================================================================
+
+	Major changes between "less" versions 358 and 376
 
 * -x option can now specify multiple variable-width tab stops.
 
@@ -41,7 +72,10 @@
 
 * Default LESSCHARSET for MS-DOS versions is now "dos".
 
-* Improved performance in reading very large files.
+* Searching works better with ANSI (SGR) escape sequences.
+  ANSI color escape sequences are now supported in the MS-DOS (DJGPP) version.
+
+* Improved performance in reading very large pipes.
 
 * Eliminated some dependencies on file offets being 32 bits.
 
@@ -50,6 +84,8 @@
 * Fixed overstriking in UTF-8 mode, and overstriking tabs.
 
 * Improved horizontal shifting of text using -R option with ANSI color.
+
+* Improved handling of filenames containing shell metacharacters.
 
 * Some fixes for EBCDIC systems.
 
Index: contrib/less/README
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/README,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 README
--- contrib/less/README	7 Jan 2002 20:29:10 -0000	1.1.1.3
+++ contrib/less/README	3 Jul 2003 19:03:04 -0000
@@ -1,7 +1,7 @@
 
-                            Less, version 371
+                            Less, version 381
 
-    This is the distribution of less, version 371, released 26 Dec 2001.
+    This is the distribution of less, version 381, released 17 Jan 2003.
     This program is part of the GNU project (http://www.gnu.org).
 
     This program is free software.  You may redistribute it and/or
Index: contrib/less/acconfig.h
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/acconfig.h,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 acconfig.h
--- contrib/less/acconfig.h	14 Jul 2000 09:51:19 -0000	1.1.1.2
+++ contrib/less/acconfig.h	3 Jul 2003 19:03:04 -0000
@@ -1,76 +0,0 @@
-/*
- * Copyright (C) 1984-2000  Mark Nudelman
- *
- * You may distribute under the terms of either the GNU General Public
- * License or the Less License, as specified in the README file.
- *
- * For more information about less, or for information on how to 
- * contact the author, see the README file.
- */
-
-
-/*
- * Regular expression library.
- * Define exactly one of the following to be 1:
- * HAVE_POSIX_REGCOMP: POSIX regcomp() and regex.h
- * HAVE_PCRE: PCRE (Perl-compatible regular expression) library
- * HAVE_RE_COMP: BSD re_comp()
- * HAVE_REGCMP: System V regcmp()
- * HAVE_V8_REGCOMP: Henry Spencer V8 regcomp() and regexp.h
- * NO_REGEX: pattern matching is supported, but without metacharacters.
- */
-#undef HAVE_POSIX_REGCOMP
-#undef HAVE_PCRE
-#undef HAVE_RE_COMP
-#undef HAVE_REGCMP
-#undef HAVE_V8_REGCOMP
-#undef NO_REGEX
-#undef HAVE_REGEXEC2
-
-/* Define HAVE_VOID if your compiler supports the "void" type. */
-#undef HAVE_VOID
-
-/* Define HAVE_CONST if your compiler supports the "const" modifier. */
-#undef HAVE_CONST
-
-/* Define HAVE_TIME_T if your system supports the "time_t" type. */
-#undef HAVE_TIME_T
-
-/* Define HAVE_STRERROR if you have the strerror() function. */
-#undef HAVE_STRERROR
-
-/* Define HAVE_FILENO if you have the fileno() macro. */
-#undef HAVE_FILENO
-
-/* Define HAVE_ERRNO if you have the errno variable */
-/* Define MUST_DEFINE_ERRNO if you have errno but it is not define 
- * in errno.h */
-#undef HAVE_ERRNO
-#undef MUST_DEFINE_ERRNO
-
-/* Define HAVE_SYS_ERRLIST if you have the sys_errlist[] variable */
-#undef HAVE_SYS_ERRLIST
-
-/* Define HAVE_OSPEED if your termcap library has the ospeed variable */
-/* Define MUST_DEFINE_OSPEED if you have ospeed but it is not defined
- * in termcap.h. */
-#undef HAVE_OSPEED
-#undef MUST_DEFINE_OSPEED
-
-/* Define HAVE_LOCALE if you have locale.h and setlocale. */
-#undef HAVE_LOCALE
-
-/* Define HAVE_TERMIOS_FUNCS if you have tcgetattr/tcsetattr */
-#undef HAVE_TERMIOS_FUNCS
-
-/* Define HAVE_UPPER_LOWER if you have isupper, islower, toupper, tolower */
-#undef HAVE_UPPER_LOWER
-
-/* Define HAVE_SIGSET_T you have the sigset_t type */
-#undef HAVE_SIGSET_T
-
-/* Define HAVE_SIGEMPTYSET if you have the sigemptyset macro */
-#undef HAVE_SIGEMPTYSET
-
-/* Define EDIT_PGM to your editor. */
-#define EDIT_PGM	"vi"
Index: contrib/less/brac.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/brac.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 brac.c
--- contrib/less/brac.c	22 May 2000 09:53:21 -0000	1.1.1.1
+++ contrib/less/brac.c	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
Index: contrib/less/ch.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/ch.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 ch.c
--- contrib/less/ch.c	7 Jan 2002 20:28:37 -0000	1.1.1.2
+++ contrib/less/ch.c	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
@@ -93,10 +93,10 @@
 
 static struct filestate *thisfile;
 static int ch_ungotchar = -1;
+static int maxbufs = -1;
 
 extern int autobuf;
 extern int sigs;
-extern int cbufs;
 extern int secure;
 extern constant char helpdata[];
 extern constant int size_helpdata;
@@ -162,7 +162,7 @@
 		 * 2. We haven't allocated the max buffers for this file yet.
 		 */
 		if ((autobuf && !(ch_flags & CH_CANSEEK)) ||
-		    (cbufs == -1 || ch_nbufs < cbufs))
+		    (maxbufs < 0 || ch_nbufs < maxbufs))
 			if (ch_addbuf())
 				/*
 				 * Allocation failed: turn off autobuf.
@@ -561,32 +561,21 @@
 }
 
 /*
- * Allocate buffers.
- * Caller wants us to have a total of at least want_nbufs buffers.
+ * Set max amount of buffer space.
+ * bufspace is in units of 1024 bytes.  -1 mean no limit.
  */
-	public int
-ch_nbuf(want_nbufs)
-	int want_nbufs;
+	public void
+ch_setbufspace(bufspace)
+	int bufspace;
 {
-	PARG parg;
-
-	while (ch_nbufs < want_nbufs)
+	if (bufspace < 0)
+		maxbufs = -1;
+	else
 	{
-		if (ch_addbuf())
-		{
-			/*
-			 * Cannot allocate enough buffers.
-			 * If we don't have ANY, then quit.
-			 * Otherwise, just report the error and return.
-			 */
-			parg.p_int = want_nbufs - ch_nbufs;
-			error("Cannot allocate %d buffers", &parg);
-			if (ch_nbufs == 0)
-				quit(QUIT_ERROR);
-			break;
-		}
+		maxbufs = ((bufspace * 1024) + LBUFSIZE-1) / LBUFSIZE;
+		if (maxbufs < 1)
+			maxbufs = 1;
 	}
-	return (ch_nbufs);
 }
 
 /*
Index: contrib/less/charset.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/charset.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 charset.c
--- contrib/less/charset.c	7 Jan 2002 20:28:37 -0000	1.1.1.2
+++ contrib/less/charset.c	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
@@ -164,6 +164,7 @@
 	error("invalid charset name", NULL_PARG);
 	quit(QUIT_ERROR);
 	/*NOTREACHED*/
+	return (0);
 }
 
 #if HAVE_LOCALE
Index: contrib/less/cmd.h
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/cmd.h,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 cmd.h
--- contrib/less/cmd.h	7 Jan 2002 20:29:19 -0000	1.1.1.2
+++ contrib/less/cmd.h	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
Index: contrib/less/cmdbuf.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/cmdbuf.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 cmdbuf.c
--- contrib/less/cmdbuf.c	7 Jan 2002 20:28:39 -0000	1.1.1.2
+++ contrib/less/cmdbuf.c	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
@@ -64,25 +64,25 @@
  */
 struct mlist mlist_search =  
 	{ &mlist_search,  &mlist_search,  &mlist_search,  NULL };
-public void constant *ml_search = (void *) &mlist_search;
+public void * constant ml_search = (void *) &mlist_search;
 
 struct mlist mlist_examine = 
 	{ &mlist_examine, &mlist_examine, &mlist_examine, NULL };
-public void constant *ml_examine = (void *) &mlist_examine;
+public void * constant ml_examine = (void *) &mlist_examine;
 
 #if SHELL_ESCAPE || PIPEC
 struct mlist mlist_shell =   
 	{ &mlist_shell,   &mlist_shell,   &mlist_shell,   NULL };
-public void constant *ml_shell = (void *) &mlist_shell;
+public void * constant ml_shell = (void *) &mlist_shell;
 #endif
 
 #else /* CMD_HISTORY */
 
 /* If CMD_HISTORY is off, these are just flags. */
-public void constant *ml_search = (void *)1;
-public void constant *ml_examine = (void *)2;
+public void * constant ml_search = (void *)1;
+public void * constant ml_examine = (void *)2;
 #if SHELL_ESCAPE || PIPEC
-public void constant *ml_shell = (void *)3;
+public void * constant ml_shell = (void *)3;
 #endif
 
 #endif /* CMD_HISTORY */
@@ -730,7 +730,10 @@
 	char *word;
 #if SPACES_IN_FILENAMES
 	char *p;
-	int quoted;
+	int delim_quoted = 0;
+	int meta_quoted = 0;
+	char *esc = get_meta_escape();
+	int esclen = strlen(esc);
 #endif
 	
 	/*
@@ -751,6 +754,7 @@
 		 * We're already at the end of the word.
 		 */
 		;
+#if 0
 	} else
 	{
 		/*
@@ -758,9 +762,10 @@
 		 * Huh? There's no word here.
 		 */
 		return (NULL);
+#endif
 	}
 	/*
-	 * Search backwards for beginning of the word.
+	 * Find the beginning of the word which the cursor is in.
 	 */
 	if (cp == cmdbuf)
 		return (NULL);
@@ -770,24 +775,34 @@
 	 * without a corresponding close quote), we return everything
 	 * from the open quote, including spaces.
 	 */
-	quoted = 0;
+	for (word = cmdbuf;  word < cp;  word++)
+		if (*word != ' ')
+			break;
+	if (word >= cp)
+		return (cp);
 	for (p = cmdbuf;  p < cp;  p++)
 	{
-		if (!quoted && *p == openquote)
+		if (meta_quoted)
+		{
+			meta_quoted = 0;
+		} else if (esclen > 0 && p + esclen < cp &&
+		           strncmp(p, esc, esclen) == 0)
+		{
+			meta_quoted = 1;
+			p += esclen - 1;
+		} else if (delim_quoted)
 		{
-			quoted = 1;
-			word = p;
-		} else if (quoted && *p == closequote)
+			if (*p == closequote)
+				delim_quoted = 0;
+		} else /* (!delim_quoted) */
 		{
-			quoted = 0;
+			if (*p == openquote)
+				delim_quoted = 1;
+			else if (*p == ' ')
+				word = p+1;
 		}
 	}
-	if (quoted)
-		return (word);
 #endif
-	for (word = cp-1;  word > cmdbuf;  word--)
-		if (word[-1] == ' ')
-			break;
 	return (word);
 }
 
@@ -835,11 +850,20 @@
 	 */
 	c = *cp;
 	*cp = '\0';
-#if SPACES_IN_FILENAMES
-	if (*word == openquote)
-		word++;
-#endif
-	tk_text = fcomplete(word);
+	if (*word != openquote)
+	{
+		tk_text = fcomplete(word);
+	} else
+	{
+		char *qword = shell_quote(word+1);
+		if (qword == NULL)
+			tk_text = fcomplete(word+1);
+		else
+		{
+			tk_text = fcomplete(qword);
+			free(qword);
+		}
+	}
 	*cp = c;
 }
 
@@ -1006,10 +1030,15 @@
 /*
  * Return the number currently in the command buffer.
  */
-	public int
+	public LINENUM
 cmd_int()
 {
-	return (atoi(cmdbuf));
+	register char *p;
+	LINENUM n = 0;
+
+	for (p = cmdbuf;  *p != '\0';  p++)
+		n = (10 * n) + (*p - '0');
+	return (n);
 }
 
 /*
Index: contrib/less/command.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/command.c,v
retrieving revision 1.4
diff -u -r1.4 command.c
--- contrib/less/command.c	7 Jan 2002 20:37:09 -0000	1.4
+++ contrib/less/command.c	3 Jul 2003 19:20:13 -0000
@@ -1,6 +1,6 @@
 /* $FreeBSD: src/contrib/less/command.c,v 1.4 2002/01/07 20:37:09 ps Exp $ */
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
@@ -39,7 +39,6 @@
 extern int secure;
 extern int hshift;
 extern int show_attn;
-extern int more_mode;
 extern char *every_first_cmd;
 extern char *curr_altfilename;
 extern char version[];
@@ -64,7 +63,7 @@
 #endif
 static int mca;			/* The multicharacter command (action) */
 static int search_type;		/* The previous type of search */
-static int number;		/* The number typed by the user */
+static LINENUM number;		/* The number typed by the user */
 static char optchar;
 static int optflag;
 static int optgetname;
@@ -189,7 +188,7 @@
 	{
 	case A_F_SEARCH:
 	case A_B_SEARCH:
-		multi_search(cbuf, number);
+		multi_search(cbuf, (int) number);
 		break;
 	case A_FIRSTCMD:
 		/*
@@ -209,18 +208,20 @@
 		optchar = '\0';
 		break;
 	case A_F_BRACKET:
-		match_brac(cbuf[0], cbuf[1], 1, number);
+		match_brac(cbuf[0], cbuf[1], 1, (int) number);
 		break;
 	case A_B_BRACKET:
-		match_brac(cbuf[1], cbuf[0], 0, number);
+		match_brac(cbuf[1], cbuf[0], 0, (int) number);
 		break;
 #if EXAMINE
 	case A_EXAMINE:
 		if (secure)
 			break;
 		edit_list(cbuf);
+#if TAGS
 		/* If tag structure is loaded then clean it up. */
 		cleantags();
+#endif
 		break;
 #endif
 #if SHELL_ESCAPE
@@ -363,7 +364,7 @@
 			 * If so, display the complete name and stop 
 			 * accepting chars until user hits RETURN.
 			 */
-			struct option *o;
+			struct loption *o;
 			char *oname;
 			int lc;
 
@@ -476,16 +477,12 @@
 		flag = 0;
 		switch (c)
 		{
-		case '*':
-			if (more_mode)
-				break;
 		case CONTROL('E'): /* ignore END of file */
+		case '*':
 			flag = SRCH_PAST_EOF;
 			break;
-		case '@':
-			if (more_mode)
-				break;
 		case CONTROL('F'): /* FIRST file */
+		case '@':
 			flag = SRCH_FIRST_FILE;
 			break;
 		case CONTROL('K'): /* KEEP position */
@@ -987,7 +984,7 @@
 			 * Forward one window (and set the window size).
 			 */
 			if (number > 0)
-				swindow = number;
+				swindow = (int) number;
 			/* FALLTHRU */
 		case A_F_SCREEN:
 			/*
@@ -998,7 +995,7 @@
 			cmd_exec();
 			if (show_attn)
 				set_attnpos(bottompos);
-			forward(number, 0, 1);
+			forward((int) number, 0, 1);
 			break;
 
 		case A_B_WINDOW:
@@ -1006,7 +1003,7 @@
 			 * Backward one window (and set the window size).
 			 */
 			if (number > 0)
-				swindow = number;
+				swindow = (int) number;
 			/* FALLTHRU */
 		case A_B_SCREEN:
 			/*
@@ -1015,7 +1012,7 @@
 			if (number <= 0)
 				number = get_swindow();
 			cmd_exec();
-			backward(number, 0, 1);
+			backward((int) number, 0, 1);
 			break;
 
 		case A_F_LINE:
@@ -1027,7 +1024,7 @@
 			cmd_exec();
 			if (show_attn == OPT_ONPLUS && number > 1)
 				set_attnpos(bottompos);
-			forward(number, 0, 0);
+			forward((int) number, 0, 0);
 			break;
 
 		case A_B_LINE:
@@ -1037,7 +1034,7 @@
 			if (number <= 0)
 				number = 1;
 			cmd_exec();
-			backward(number, 0, 0);
+			backward((int) number, 0, 0);
 			break;
 
 		case A_FF_LINE:
@@ -1049,7 +1046,7 @@
 			cmd_exec();
 			if (show_attn == OPT_ONPLUS && number > 1)
 				set_attnpos(bottompos);
-			forward(number, 1, 0);
+			forward((int) number, 1, 0);
 			break;
 
 		case A_BF_LINE:
@@ -1059,7 +1056,7 @@
 			if (number <= 0)
 				number = 1;
 			cmd_exec();
-			backward(number, 1, 0);
+			backward((int) number, 1, 0);
 			break;
 		
 		case A_FF_SCREEN:
@@ -1071,7 +1068,7 @@
 			cmd_exec();
 			if (show_attn == OPT_ONPLUS)
 				set_attnpos(bottompos);
-			forward(number, 1, 0);
+			forward((int) number, 1, 0);
 			break;
 
 		case A_F_FOREVER:
@@ -1101,7 +1098,7 @@
 			 * (default same as last 'd' or 'u' command).
 			 */
 			if (number > 0)
-				wscroll = number;
+				wscroll = (int) number;
 			cmd_exec();
 			if (show_attn == OPT_ONPLUS)
 				set_attnpos(bottompos);
@@ -1114,7 +1111,7 @@
 			 * (default same as last 'd' or 'u' command).
 			 */
 			if (number > 0)
-				wscroll = number;
+				wscroll = (int) number;
 			cmd_exec();
 			backward(wscroll, 0, 0);
 			break;
@@ -1160,7 +1157,7 @@
 			if (number > 100)
 				number = 100;
 			cmd_exec();
-			jump_percent(number);
+			jump_percent((int) number);
 			break;
 
 		case A_GOEND:
@@ -1181,7 +1178,7 @@
 			cmd_exec();
 			if (number < 0)
 				number = 0;
-			jump_line_loc((POSITION)number, jump_sline);
+			jump_line_loc((POSITION) number, jump_sline);
 			break;
 
 		case A_STAT:
@@ -1229,7 +1226,7 @@
 #define	DO_SEARCH()	if (number <= 0) number = 1;	\
 			mca_search();			\
 			cmd_exec();			\
-			multi_search((char *)NULL, number);
+			multi_search((char *)NULL, (int) number);
 
 
 		case A_F_SEARCH:
@@ -1368,14 +1365,16 @@
 			/*
 			 * Examine next file.
 			 */
+#if TAGS
 			if (ntags())
 			{
 				error("No next file", NULL_PARG);
 				break;
 			}
+#endif
 			if (number <= 0)
 				number = 1;
-			if (edit_next(number))
+			if (edit_next((int) number))
 			{
 				if (quit_at_eof && hit_eof && 
 				    !(ch_getflags() & CH_HELPFILE))
@@ -1389,14 +1388,16 @@
 			/*
 			 * Examine previous file.
 			 */
+#if TAGS
 			if (ntags())
 			{
 				error("No previous file", NULL_PARG);
 				break;
 			}
+#endif
 			if (number <= 0)
 				number = 1;
-			if (edit_prev(number))
+			if (edit_prev((int) number))
 			{
 				parg.p_string = (number > 1) ? "(N-th) " : "";
 				error("No %sprevious file", &parg);
@@ -1404,9 +1405,10 @@
 			break;
 
 		case A_NEXT_TAG:
+#if TAGS
 			if (number <= 0)
 				number = 1;
-			tagfile = nexttag(number);
+			tagfile = nexttag((int) number);
 			if (tagfile == NULL)
 			{
 				error("No next tag", NULL_PARG);
@@ -1418,12 +1420,16 @@
 				if (pos != NULL_POSITION)
 					jump_loc(pos, jump_sline);
 			}
+#else
+			error("Command not available", NULL_PARG);
+#endif
 			break;
 
 		case A_PREV_TAG:
+#if TAGS
 			if (number <= 0)
 				number = 1;
-			tagfile = prevtag(number);
+			tagfile = prevtag((int) number);
 			if (tagfile == NULL)
 			{
 				error("No previous tag", NULL_PARG);
@@ -1435,6 +1441,9 @@
 				if (pos != NULL_POSITION)
 					jump_loc(pos, jump_sline);
 			}
+#else
+			error("Command not available", NULL_PARG);
+#endif
 			break;
 
 		case A_INDEX_FILE:
@@ -1443,7 +1452,7 @@
 			 */
 			if (number <= 0)
 				number = 1;
-			if (edit_index(number))
+			if (edit_index((int) number))
 				error("No such file", NULL_PARG);
 			break;
 
Index: contrib/less/configure
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/configure,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 configure
--- contrib/less/configure	7 Jan 2002 20:29:16 -0000	1.1.1.3
+++ contrib/less/configure	3 Jul 2003 19:03:04 -0000
@@ -1,30 +1,321 @@
 #! /bin/sh
-
 # Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13 
-# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
+# Generated by GNU Autoconf 2.54 for less 1.
 #
+# Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
+# 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.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+
+# Support unset when possible.
+if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in LANG LANGUAGE LC_ALL LC_COLLATE LC_CTYPE LC_NUMERIC LC_MESSAGES LC_TIME
+do
+  if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)$' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+  	  /^X\/\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\/\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# 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
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conftest.sh
+  echo  "exit 0"   >>conftest.sh
+  chmod +x conftest.sh
+  if (PATH="/nonexistent;."; conftest.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conftest.sh
+fi
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  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
+
+       ;;
+  esac
+  # We did not find ourselves, most probably we were run as `sh COMMAND'
+  # in which case we are not to be found in the path.
+  if test "x$as_myself" = x; then
+    as_myself=$0
+  fi
+  if test ! -f "$as_myself"; then
+    { echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for as_base in sh bash ksh sh5; do
+	 case $as_dir in
+	 /*)
+	   if ("$as_dir/$as_base" -c '
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+	     $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+	     $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+	     CONFIG_SHELL=$as_dir/$as_base
+	     export CONFIG_SHELL
+	     exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+	   fi;;
+	 esac
+       done
+done
+;;
+  esac
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, and appends trailing '-' during
+  # substitution so that $LINENO is not a special case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
+    sed '
+      N
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      t loop
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
+    ' >$as_me.lineno &&
+  chmod +x $as_me.lineno ||
+    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensible to this).
+  . ./$as_me.lineno
+  # Exit status is that of the last command.
+  exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='	' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conf$$.exe; then
+    # Don't use ln at all; we don't have any links
+    as_ln_s='cp -p'
+  else
+    as_ln_s='ln -s'
+  fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+
 
-# Defaults:
-ac_help=
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" 	$as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+
+# Name of the host.
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+exec 6>&1
+
+#
+# Initializations.
+#
 ac_default_prefix=/usr/local
-# Any additions from configure.in:
-ac_help="$ac_help
-  --with-regex={auto,pcre,posix,regcmp,re_comp,regcomp,regcomp-local}  Select a regular expression library  [auto]"
-ac_help="$ac_help
-  --with-editor=PROGRAM   use PROGRAM as the default editor [vi]"
+ac_config_libobj_dir=.
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+# Maximum number of lines to put in a shell here document.
+# This variable seems obsolete.  It should probably be removed, and
+# only ac_max_sed_lines should be used.
+: ${ac_max_here_lines=38}
+
+# Identity of this package.
+PACKAGE_NAME='less'
+PACKAGE_TARNAME='less'
+PACKAGE_VERSION='1'
+PACKAGE_STRING='less 1'
+PACKAGE_BUGREPORT=''
+
+ac_unique_file="forwback.c"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#if STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# if HAVE_STDLIB_H
+#  include <stdlib.h>
+# endif
+#endif
+#if HAVE_STRING_H
+# if !STDC_HEADERS && HAVE_MEMORY_H
+#  include <memory.h>
+# endif
+# include <string.h>
+#endif
+#if HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#if HAVE_INTTYPES_H
+# include <inttypes.h>
+#else
+# if HAVE_STDINT_H
+#  include <stdint.h>
+# endif
+#endif
+#if HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CPP EGREP INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA REGEX_O LIBOBJS LTLIBOBJS'
+ac_subst_files=''
 
 # Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
 # The variables have the same names as the options, with
 # dashes changed to underlines.
-build=NONE
-cache_file=./config.cache
+cache_file=/dev/null
 exec_prefix=NONE
-host=NONE
 no_create=
-nonopt=NONE
 no_recursion=
 prefix=NONE
 program_prefix=NONE
@@ -33,10 +324,15 @@
 silent=
 site=
 srcdir=
-target=NONE
 verbose=
 x_includes=NONE
 x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
 bindir='${exec_prefix}/bin'
 sbindir='${exec_prefix}/sbin'
 libexecdir='${exec_prefix}/libexec'
@@ -50,17 +346,9 @@
 infodir='${prefix}/info'
 mandir='${prefix}/man'
 
-# Initialize some other variables.
-subdirs=
-MFLAGS= MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-# Maximum number of lines to put in a shell here document.
-ac_max_here_lines=12
-
 ac_prev=
 for ac_option
 do
-
   # If the previous option needs an argument, assign it.
   if test -n "$ac_prev"; then
     eval "$ac_prev=\$ac_option"
@@ -68,59 +356,59 @@
     continue
   fi
 
-  case "$ac_option" in
-  -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
-  *) ac_optarg= ;;
-  esac
+  ac_optarg=`expr "x$ac_option" : 'x[^=]*=\(.*\)'`
 
   # Accept the important Cygnus configure options, so we can diagnose typos.
 
-  case "$ac_option" in
+  case $ac_option in
 
   -bindir | --bindir | --bindi | --bind | --bin | --bi)
     ac_prev=bindir ;;
   -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
-    bindir="$ac_optarg" ;;
+    bindir=$ac_optarg ;;
 
   -build | --build | --buil | --bui | --bu)
-    ac_prev=build ;;
+    ac_prev=build_alias ;;
   -build=* | --build=* | --buil=* | --bui=* | --bu=*)
-    build="$ac_optarg" ;;
+    build_alias=$ac_optarg ;;
 
   -cache-file | --cache-file | --cache-fil | --cache-fi \
   | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
     ac_prev=cache_file ;;
   -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
   | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
-    cache_file="$ac_optarg" ;;
+    cache_file=$ac_optarg ;;
+
+  --config-cache | -C)
+    cache_file=config.cache ;;
 
   -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
     ac_prev=datadir ;;
   -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
   | --da=*)
-    datadir="$ac_optarg" ;;
+    datadir=$ac_optarg ;;
 
   -disable-* | --disable-*)
-    ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
+    ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
     # Reject names that are not valid shell variable names.
-    if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
-      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
-    fi
-    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
-    eval "enable_${ac_feature}=no" ;;
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    eval "enable_$ac_feature=no" ;;
 
   -enable-* | --enable-*)
-    ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
+    ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
-    if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
-      { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
-    fi
-    ac_feature=`echo $ac_feature| sed 's/-/_/g'`
-    case "$ac_option" in
-      *=*) ;;
+    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+   { (exit 1); exit 1; }; }
+    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
+    case $ac_option in
+      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
       *) ac_optarg=yes ;;
     esac
-    eval "enable_${ac_feature}='$ac_optarg'" ;;
+    eval "enable_$ac_feature='$ac_optarg'" ;;
 
   -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
   | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -129,95 +417,47 @@
   -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
   | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
   | --exec=* | --exe=* | --ex=*)
-    exec_prefix="$ac_optarg" ;;
+    exec_prefix=$ac_optarg ;;
 
   -gas | --gas | --ga | --g)
     # Obsolete; use --with-gas.
     with_gas=yes ;;
 
-  -help | --help | --hel | --he)
-    # Omit some internal or obsolete options to make the list less imposing.
-    # This message is too long to be a string in the A/UX 3.1 sh.
-    cat << EOF
-Usage: configure [options] [host]
-Options: [defaults in brackets after descriptions]
-Configuration:
-  --cache-file=FILE       cache test results in FILE
-  --help                  print this message
-  --no-create             do not create output files
-  --quiet, --silent       do not print \`checking...' messages
-  --version               print the version of autoconf that created configure
-Directory and file names:
-  --prefix=PREFIX         install architecture-independent files in PREFIX
-                          [$ac_default_prefix]
-  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
-                          [same as prefix]
-  --bindir=DIR            user executables in DIR [EPREFIX/bin]
-  --sbindir=DIR           system admin executables in DIR [EPREFIX/sbin]
-  --libexecdir=DIR        program executables in DIR [EPREFIX/libexec]
-  --datadir=DIR           read-only architecture-independent data in DIR
-                          [PREFIX/share]
-  --sysconfdir=DIR        read-only single-machine data in DIR [PREFIX/etc]
-  --sharedstatedir=DIR    modifiable architecture-independent data in DIR
-                          [PREFIX/com]
-  --localstatedir=DIR     modifiable single-machine data in DIR [PREFIX/var]
-  --libdir=DIR            object code libraries in DIR [EPREFIX/lib]
-  --includedir=DIR        C header files in DIR [PREFIX/include]
-  --oldincludedir=DIR     C header files for non-gcc in DIR [/usr/include]
-  --infodir=DIR           info documentation in DIR [PREFIX/info]
-  --mandir=DIR            man documentation in DIR [PREFIX/man]
-  --srcdir=DIR            find the sources in DIR [configure dir or ..]
-  --program-prefix=PREFIX prepend PREFIX to installed program names
-  --program-suffix=SUFFIX append SUFFIX to installed program names
-  --program-transform-name=PROGRAM
-                          run sed PROGRAM on installed program names
-EOF
-    cat << EOF
-Host type:
-  --build=BUILD           configure for building on BUILD [BUILD=HOST]
-  --host=HOST             configure for HOST [guessed]
-  --target=TARGET         configure for TARGET [TARGET=HOST]
-Features and packages:
-  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
-  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
-  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
-  --x-includes=DIR        X include files are in DIR
-  --x-libraries=DIR       X library files are in DIR
-EOF
-    if test -n "$ac_help"; then
-      echo "--enable and --with options recognized:$ac_help"
-    fi
-    exit 0 ;;
+  -help | --help | --hel | --he | -h)
+    ac_init_help=long ;;
+  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+    ac_init_help=recursive ;;
+  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+    ac_init_help=short ;;
 
   -host | --host | --hos | --ho)
-    ac_prev=host ;;
+    ac_prev=host_alias ;;
   -host=* | --host=* | --hos=* | --ho=*)
-    host="$ac_optarg" ;;
+    host_alias=$ac_optarg ;;
 
   -includedir | --includedir | --includedi | --included | --include \
   | --includ | --inclu | --incl | --inc)
     ac_prev=includedir ;;
   -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
   | --includ=* | --inclu=* | --incl=* | --inc=*)
-    includedir="$ac_optarg" ;;
+    includedir=$ac_optarg ;;
 
   -infodir | --infodir | --infodi | --infod | --info | --inf)
     ac_prev=infodir ;;
   -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
-    infodir="$ac_optarg" ;;
+    infodir=$ac_optarg ;;
 
   -libdir | --libdir | --libdi | --libd)
     ac_prev=libdir ;;
   -libdir=* | --libdir=* | --libdi=* | --libd=*)
-    libdir="$ac_optarg" ;;
+    libdir=$ac_optarg ;;
 
   -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
   | --libexe | --libex | --libe)
     ac_prev=libexecdir ;;
   -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
   | --libexe=* | --libex=* | --libe=*)
-    libexecdir="$ac_optarg" ;;
+    libexecdir=$ac_optarg ;;
 
   -localstatedir | --localstatedir | --localstatedi | --localstated \
   | --localstate | --localstat | --localsta | --localst \
@@ -226,19 +466,19 @@
   -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
   | --localstate=* | --localstat=* | --localsta=* | --localst=* \
   | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
-    localstatedir="$ac_optarg" ;;
+    localstatedir=$ac_optarg ;;
 
   -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
     ac_prev=mandir ;;
   -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
-    mandir="$ac_optarg" ;;
+    mandir=$ac_optarg ;;
 
   -nfp | --nfp | --nf)
     # Obsolete; use --without-fp.
     with_fp=no ;;
 
   -no-create | --no-create | --no-creat | --no-crea | --no-cre \
-  | --no-cr | --no-c)
+  | --no-cr | --no-c | -n)
     no_create=yes ;;
 
   -no-recursion | --no-recursion | --no-recursio | --no-recursi \
@@ -252,26 +492,26 @@
   -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
   | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
   | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
-    oldincludedir="$ac_optarg" ;;
+    oldincludedir=$ac_optarg ;;
 
   -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
     ac_prev=prefix ;;
   -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
-    prefix="$ac_optarg" ;;
+    prefix=$ac_optarg ;;
 
   -program-prefix | --program-prefix | --program-prefi | --program-pref \
   | --program-pre | --program-pr | --program-p)
     ac_prev=program_prefix ;;
   -program-prefix=* | --program-prefix=* | --program-prefi=* \
   | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
-    program_prefix="$ac_optarg" ;;
+    program_prefix=$ac_optarg ;;
 
   -program-suffix | --program-suffix | --program-suffi | --program-suff \
   | --program-suf | --program-su | --program-s)
     ac_prev=program_suffix ;;
   -program-suffix=* | --program-suffix=* | --program-suffi=* \
   | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
-    program_suffix="$ac_optarg" ;;
+    program_suffix=$ac_optarg ;;
 
   -program-transform-name | --program-transform-name \
   | --program-transform-nam | --program-transform-na \
@@ -288,7 +528,7 @@
   | --program-transfo=* | --program-transf=* \
   | --program-trans=* | --program-tran=* \
   | --progr-tra=* | --program-tr=* | --program-t=*)
-    program_transform_name="$ac_optarg" ;;
+    program_transform_name=$ac_optarg ;;
 
   -q | -quiet | --quiet | --quie | --qui | --qu | --q \
   | -silent | --silent | --silen | --sile | --sil)
@@ -298,7 +538,7 @@
     ac_prev=sbindir ;;
   -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
   | --sbi=* | --sb=*)
-    sbindir="$ac_optarg" ;;
+    sbindir=$ac_optarg ;;
 
   -sharedstatedir | --sharedstatedir | --sharedstatedi \
   | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
@@ -309,58 +549,57 @@
   | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
   | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
   | --sha=* | --sh=*)
-    sharedstatedir="$ac_optarg" ;;
+    sharedstatedir=$ac_optarg ;;
 
   -site | --site | --sit)
     ac_prev=site ;;
   -site=* | --site=* | --sit=*)
-    site="$ac_optarg" ;;
+    site=$ac_optarg ;;
 
   -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
     ac_prev=srcdir ;;
   -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
-    srcdir="$ac_optarg" ;;
+    srcdir=$ac_optarg ;;
 
   -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
   | --syscon | --sysco | --sysc | --sys | --sy)
     ac_prev=sysconfdir ;;
   -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
   | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
-    sysconfdir="$ac_optarg" ;;
+    sysconfdir=$ac_optarg ;;
 
   -target | --target | --targe | --targ | --tar | --ta | --t)
-    ac_prev=target ;;
+    ac_prev=target_alias ;;
   -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
-    target="$ac_optarg" ;;
+    target_alias=$ac_optarg ;;
 
   -v | -verbose | --verbose | --verbos | --verbo | --verb)
     verbose=yes ;;
 
-  -version | --version | --versio | --versi | --vers)
-    echo "configure generated by autoconf version 2.13"
-    exit 0 ;;
+  -version | --version | --versio | --versi | --vers | -V)
+    ac_init_version=: ;;
 
   -with-* | --with-*)
-    ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
+    ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
     # Reject names that are not valid shell variable names.
-    if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
-      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
-    fi
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
     ac_package=`echo $ac_package| sed 's/-/_/g'`
-    case "$ac_option" in
-      *=*) ;;
+    case $ac_option in
+      *=*) ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`;;
       *) ac_optarg=yes ;;
     esac
-    eval "with_${ac_package}='$ac_optarg'" ;;
+    eval "with_$ac_package='$ac_optarg'" ;;
 
   -without-* | --without-*)
-    ac_package=`echo $ac_option|sed -e 's/-*without-//'`
+    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
     # Reject names that are not valid shell variable names.
-    if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
-      { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
-    fi
-    ac_package=`echo $ac_package| sed 's/-/_/g'`
-    eval "with_${ac_package}=no" ;;
+    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid package name: $ac_package" >&2
+   { (exit 1); exit 1; }; }
+    ac_package=`echo $ac_package | sed 's/-/_/g'`
+    eval "with_$ac_package=no" ;;
 
   --x)
     # Obsolete; use --with-x.
@@ -371,99 +610,110 @@
     ac_prev=x_includes ;;
   -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
   | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
-    x_includes="$ac_optarg" ;;
+    x_includes=$ac_optarg ;;
 
   -x-libraries | --x-libraries | --x-librarie | --x-librari \
   | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
     ac_prev=x_libraries ;;
   -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
   | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
-    x_libraries="$ac_optarg" ;;
+    x_libraries=$ac_optarg ;;
 
-  -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
+  -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+   { (exit 1); exit 1; }; }
     ;;
 
+  *=*)
+    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+    # Reject names that are not valid shell variable names.
+    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+      { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+   { (exit 1); exit 1; }; }
+    ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"`
+    eval "$ac_envvar='$ac_optarg'"
+    export $ac_envvar ;;
+
   *)
-    if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
-      echo "configure: warning: $ac_option: invalid host type" 1>&2
-    fi
-    if test "x$nonopt" != xNONE; then
-      { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
-    fi
-    nonopt="$ac_option"
+    # FIXME: should be removed in autoconf 3.0.
+    echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+      echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
     ;;
 
   esac
 done
 
 if test -n "$ac_prev"; then
-  { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
-fi
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 6 checking for... messages and results
-# 5 compiler messages saved in config.log
-if test "$silent" = yes; then
-  exec 6>/dev/null
-else
-  exec 6>&1
+  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+  { echo "$as_me: error: missing argument to $ac_option" >&2
+   { (exit 1); exit 1; }; }
 fi
-exec 5>./config.log
 
-echo "\
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-" 1>&5
+# Be sure to have absolute paths.
+for ac_var in exec_prefix prefix
+do
+  eval ac_val=$`echo $ac_var`
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* | NONE | '' ) ;;
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; };;
+  esac
+done
 
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Also quote any args containing shell metacharacters.
-ac_configure_args=
-for ac_arg
+# Be sure to have absolute paths.
+for ac_var in bindir sbindir libexecdir datadir sysconfdir sharedstatedir \
+              localstatedir libdir includedir oldincludedir infodir mandir
 do
-  case "$ac_arg" in
-  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
-  | --no-cr | --no-c) ;;
-  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
-  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
-  *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
-  ac_configure_args="$ac_configure_args '$ac_arg'" ;;
-  *) ac_configure_args="$ac_configure_args $ac_arg" ;;
+  eval ac_val=$`echo $ac_var`
+  case $ac_val in
+    [\\/$]* | ?:[\\/]* ) ;;
+    *)  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+   { (exit 1); exit 1; }; };;
   esac
 done
 
-# NLS nuisances.
-# Only set these to C if already set.  These must not be set unconditionally
-# because not all systems understand e.g. LANG=C (notably SCO).
-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
-# Non-C LC_CTYPE values break the ctype check.
-if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
-if test "${LC_CTYPE+set}"    = set; then LC_CTYPE=C;    export LC_CTYPE;    fi
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+  if test "x$build_alias" = x; then
+    cross_compiling=maybe
+    echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+    If a cross compiler is detected then cross compile mode will be used." >&2
+  elif test "x$build_alias" != "x$host_alias"; then
+    cross_compiling=yes
+  fi
+fi
 
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo > confdefs.h
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
 
-# A filename unique to this package, relative to the directory that
-# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=forwback.c
 
 # Find the source files, if location was not specified.
 if test -z "$srcdir"; then
   ac_srcdir_defaulted=yes
   # Try the directory containing this script, then its parent.
-  ac_prog=$0
-  ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
-  test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
+  ac_confdir=`(dirname "$0") 2>/dev/null ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+         X"$0" : 'X\(//\)[^/]' \| \
+         X"$0" : 'X\(//\)$' \| \
+         X"$0" : 'X\(/\)' \| \
+         .     : '\(.\)' 2>/dev/null ||
+echo X"$0" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
   srcdir=$ac_confdir
   if test ! -r $srcdir/$ac_unique_file; then
     srcdir=..
@@ -473,13 +723,407 @@
 fi
 if test ! -r $srcdir/$ac_unique_file; then
   if test "$ac_srcdir_defaulted" = yes; then
-    { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $ac_confdir or .." >&2
+   { (exit 1); exit 1; }; }
   else
-    { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
+    { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+   { (exit 1); exit 1; }; }
   fi
 fi
-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
+(cd $srcdir && test -r ./$ac_unique_file) 2>/dev/null ||
+  { echo "$as_me: error: sources are in $srcdir, but \`cd $srcdir' does not work" >&2
+   { (exit 1); exit 1; }; }
+srcdir=`echo "$srcdir" | sed 's%\([^\\/]\)[\\/]*$%\1%'`
+ac_env_build_alias_set=${build_alias+set}
+ac_env_build_alias_value=$build_alias
+ac_cv_env_build_alias_set=${build_alias+set}
+ac_cv_env_build_alias_value=$build_alias
+ac_env_host_alias_set=${host_alias+set}
+ac_env_host_alias_value=$host_alias
+ac_cv_env_host_alias_set=${host_alias+set}
+ac_cv_env_host_alias_value=$host_alias
+ac_env_target_alias_set=${target_alias+set}
+ac_env_target_alias_value=$target_alias
+ac_cv_env_target_alias_set=${target_alias+set}
+ac_cv_env_target_alias_value=$target_alias
+ac_env_CC_set=${CC+set}
+ac_env_CC_value=$CC
+ac_cv_env_CC_set=${CC+set}
+ac_cv_env_CC_value=$CC
+ac_env_CFLAGS_set=${CFLAGS+set}
+ac_env_CFLAGS_value=$CFLAGS
+ac_cv_env_CFLAGS_set=${CFLAGS+set}
+ac_cv_env_CFLAGS_value=$CFLAGS
+ac_env_LDFLAGS_set=${LDFLAGS+set}
+ac_env_LDFLAGS_value=$LDFLAGS
+ac_cv_env_LDFLAGS_set=${LDFLAGS+set}
+ac_cv_env_LDFLAGS_value=$LDFLAGS
+ac_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_env_CPPFLAGS_value=$CPPFLAGS
+ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set}
+ac_cv_env_CPPFLAGS_value=$CPPFLAGS
+ac_env_CPP_set=${CPP+set}
+ac_env_CPP_value=$CPP
+ac_cv_env_CPP_set=${CPP+set}
+ac_cv_env_CPP_value=$CPP
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+  # Omit some internal or obsolete options to make the list less imposing.
+  # This message is too long to be a string in the A/UX 3.1 sh.
+  cat <<_ACEOF
+\`configure' configures less 1 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE.  See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+  -h, --help              display this help and exit
+      --help=short        display options specific to this package
+      --help=recursive    display the short help of all the included packages
+  -V, --version           display version information and exit
+  -q, --quiet, --silent   do not print \`checking...' messages
+      --cache-file=FILE   cache test results in FILE [disabled]
+  -C, --config-cache      alias for \`--cache-file=config.cache'
+  -n, --no-create         do not create output files
+      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
+
+_ACEOF
+
+  cat <<_ACEOF
+Installation directories:
+  --prefix=PREFIX         install architecture-independent files in PREFIX
+                          [$ac_default_prefix]
+  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
+                          [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+  --bindir=DIR           user executables [EPREFIX/bin]
+  --sbindir=DIR          system admin executables [EPREFIX/sbin]
+  --libexecdir=DIR       program executables [EPREFIX/libexec]
+  --datadir=DIR          read-only architecture-independent data [PREFIX/share]
+  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
+  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
+  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
+  --libdir=DIR           object code libraries [EPREFIX/lib]
+  --includedir=DIR       C header files [PREFIX/include]
+  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
+  --infodir=DIR          info documentation [PREFIX/info]
+  --mandir=DIR           man documentation [PREFIX/man]
+_ACEOF
+
+  cat <<\_ACEOF
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+  case $ac_init_help in
+     short | recursive ) echo "Configuration of less 1:";;
+   esac
+  cat <<\_ACEOF
+
+Optional Features:
+  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
+  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
+  --disable-largefile     omit support for large files
+
+Optional Packages:
+  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
+  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
+  --with-regex={auto,pcre,posix,regcmp,re_comp,regcomp,regcomp-local}  Select a regular expression library  auto
+  --with-editor=PROGRAM   use PROGRAM as the default editor vi
+
+Some influential environment variables:
+  CC          C compiler command
+  CFLAGS      C compiler flags
+  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
+              nonstandard directory <lib dir>
+  CPPFLAGS    C/C++ preprocessor flags, e.g. -I<include dir> if you have
+              headers in a nonstandard directory <include dir>
+  CPP         C preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+_ACEOF
+fi
+
+if test "$ac_init_help" = "recursive"; then
+  # If there are subdirs, report their specific --help.
+  ac_popdir=`pwd`
+  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+    test -d $ac_dir || continue
+    ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
+  *) # Relative path.
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
+# absolute.
+ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
+ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
+ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
+ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
+
+    cd $ac_dir
+    # Check for guested configure; otherwise get Cygnus style configure.
+    if test -f $ac_srcdir/configure.gnu; then
+      echo
+      $SHELL $ac_srcdir/configure.gnu  --help=recursive
+    elif test -f $ac_srcdir/configure; then
+      echo
+      $SHELL $ac_srcdir/configure  --help=recursive
+    elif test -f $ac_srcdir/configure.ac ||
+           test -f $ac_srcdir/configure.in; then
+      echo
+      $ac_configure --help
+    else
+      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+    fi
+    cd $ac_popdir
+  done
+fi
+
+test -n "$ac_init_help" && exit 0
+if $ac_init_version; then
+  cat <<\_ACEOF
+less configure 1
+generated by GNU Autoconf 2.54
+
+Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002
+Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+  exit 0
+fi
+exec 5>config.log
+cat >&5 <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by less $as_me 1, which was
+generated by GNU Autoconf 2.54.  Invocation command line was
+
+  $ $0 $@
+
+_ACEOF
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
+
+/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
+/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+hostinfo               = `(hostinfo) 2>/dev/null               || echo unknown`
+/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
+/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
+/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  echo "PATH: $as_dir"
+done
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Also quote any args containing shell meta-characters.
+ac_configure_args=
+ac_sep=
+for ac_arg
+do
+  case $ac_arg in
+  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+  | --no-cr | --no-c | -n ) continue ;;
+  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+    continue ;;
+  *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+    ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+  esac
+  ac_configure_args="$ac_configure_args$ac_sep'$ac_arg'"
+  # Get rid of the leading space.
+  ac_sep=" "
+done
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log.  We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Be sure not to use single quotes in there, as some shells,
+# such as our DU 5.0 friend, will then `close' the trap.
+trap 'exit_status=$?
+  # Save into config.log some information that might help in debugging.
+  {
+    echo
+
+    cat <<\_ASBOX
+## ---------------- ##
+## Cache variables. ##
+## ---------------- ##
+_ASBOX
+    echo
+    # The following way of writing the cache mishandles newlines in values,
+{
+  (set) 2>&1 |
+    case `(ac_space='"'"' '"'"'; set | grep ac_space) 2>&1` in
+    *ac_space=\ *)
+      sed -n \
+        "s/'"'"'/'"'"'\\\\'"'"''"'"'/g;
+    	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='"'"'\\2'"'"'/p"
+      ;;
+    *)
+      sed -n \
+        "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      ;;
+    esac;
+}
+    echo
+
+    cat <<\_ASBOX
+## ----------------- ##
+## Output variables. ##
+## ----------------- ##
+_ASBOX
+    echo
+    for ac_var in $ac_subst_vars
+    do
+      eval ac_val=$`echo $ac_var`
+      echo "$ac_var='"'"'$ac_val'"'"'"
+    done | sort
+    echo
+
+    if test -n "$ac_subst_files"; then
+      cat <<\_ASBOX
+## ------------- ##
+## Output files. ##
+## ------------- ##
+_ASBOX
+      echo
+      for ac_var in $ac_subst_files
+      do
+	eval ac_val=$`echo $ac_var`
+        echo "$ac_var='"'"'$ac_val'"'"'"
+      done | sort
+      echo
+    fi
+
+    if test -s confdefs.h; then
+      cat <<\_ASBOX
+## ----------- ##
+## confdefs.h. ##
+## ----------- ##
+_ASBOX
+      echo
+      sed "/^$/d" confdefs.h | sort
+      echo
+    fi
+    test "$ac_signal" != 0 &&
+      echo "$as_me: caught signal $ac_signal"
+    echo "$as_me: exit $exit_status"
+  } >&5
+  rm -f core core.* *.core &&
+  rm -rf conftest* confdefs* conf$$* $ac_clean_files &&
+    exit $exit_status
+     ' 0
+for ac_signal in 1 2 13 15; do
+  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -rf conftest* confdefs.h
+# AIX cpp loses on an empty file, so make sure it contains at least a newline.
+echo >confdefs.h
 
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
 # Prefer explicitly selected file to automatically selected ones.
 if test -z "$CONFIG_SITE"; then
   if test "x$prefix" != xNONE; then
@@ -490,251 +1134,716 @@
 fi
 for ac_site_file in $CONFIG_SITE; do
   if test -r "$ac_site_file"; then
-    echo "loading site script $ac_site_file"
+    { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
+    sed 's/^/| /' "$ac_site_file" >&5
     . "$ac_site_file"
   fi
 done
 
 if test -r "$cache_file"; then
-  echo "loading cache $cache_file"
-  . $cache_file
+  # Some versions of bash will fail to source /dev/null (special
+  # files actually), so we avoid doing that.
+  if test -f "$cache_file"; then
+    { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
+    case $cache_file in
+      [\\/]* | ?:[\\/]* ) . $cache_file;;
+      *)                      . ./$cache_file;;
+    esac
+  fi
 else
-  echo "creating cache $cache_file"
-  > $cache_file
+  { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
+  >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in `(set) 2>&1 |
+               sed -n 's/^ac_env_\([a-zA-Z_0-9]*\)_set=.*/\1/p'`; do
+  eval ac_old_set=\$ac_cv_env_${ac_var}_set
+  eval ac_new_set=\$ac_env_${ac_var}_set
+  eval ac_old_val="\$ac_cv_env_${ac_var}_value"
+  eval ac_new_val="\$ac_env_${ac_var}_value"
+  case $ac_old_set,$ac_new_set in
+    set,)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,set)
+      { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+      ac_cache_corrupted=: ;;
+    ,);;
+    *)
+      if test "x$ac_old_val" != "x$ac_new_val"; then
+        { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+        { echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
+echo "$as_me:   former value:  $ac_old_val" >&2;}
+        { echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
+echo "$as_me:   current value: $ac_new_val" >&2;}
+        ac_cache_corrupted=:
+      fi;;
+  esac
+  # Pass precious variables to config.status.
+  if test "$ac_new_set" = set; then
+    case $ac_new_val in
+    *" "*|*"	"*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?\"\']*)
+      ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+    *) ac_arg=$ac_var=$ac_new_val ;;
+    esac
+    case " $ac_configure_args " in
+      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
+      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
+    esac
+  fi
+done
+if $ac_cache_corrupted; then
+  { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+  { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+   { (exit 1); exit 1; }; }
 fi
 
 ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
 ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
 
-ac_exeext=
-ac_objext=o
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
-  # Stardent Vistra SVR4 grep lacks -e, says ghazi at caip.rutgers.edu.
-  if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
-    ac_n= ac_c='
-' ac_t='	'
-  else
-    ac_n=-n ac_c= ac_t=
-  fi
-else
-  ac_n= ac_c='\c' ac_t=
-fi
 
 
 
 
-# Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:534: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+          ac_config_headers="$ac_config_headers defines.h"
+
+
+# Checks for programs.
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_CC="gcc"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
 fi
 fi
-CC="$ac_cv_prog_CC"
+CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  echo "$ac_t""$CC" 1>&6
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
 else
-  echo "$ac_t""no" 1>&6
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="gcc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  CC=$ac_ct_CC
+else
+  CC="$ac_cv_prog_CC"
 fi
 
 if test -z "$CC"; then
-  # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:564: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+  if test -n "$ac_tool_prefix"; then
+  # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
-  ac_prog_rejected=no
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
-        ac_prog_rejected=yes
-	continue
-      fi
-      ac_cv_prog_CC="cc"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="${ac_tool_prefix}cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+  ac_ct_CC=$CC
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
+else
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+
+  CC=$ac_ct_CC
+else
+  CC="$ac_cv_prog_CC"
+fi
+
+fi
+if test -z "$CC"; then
+  # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$CC"; then
+  ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+  ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+       ac_prog_rejected=yes
+       continue
+     fi
+    ac_cv_prog_CC="cc"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
 if test $ac_prog_rejected = yes; then
   # We found a bogon in the path, so make sure we never use it.
   set dummy $ac_cv_prog_CC
   shift
-  if test $# -gt 0; then
+  if test $# != 0; then
     # We chose a different compiler from the bogus one.
     # However, it has the same basename, so the bogon will be chosen
     # first if we set CC to just the basename; use the full file name.
     shift
-    set dummy "$ac_dir/$ac_word" "$@"
-    shift
-    ac_cv_prog_CC="$@"
+    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
   fi
 fi
 fi
 fi
-CC="$ac_cv_prog_CC"
+CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  echo "$ac_t""$CC" 1>&6
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
 else
-  echo "$ac_t""no" 1>&6
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-  if test -z "$CC"; then
-    case "`uname -s`" in
-    *win32* | *WIN32*)
-      # Extract the first word of "cl", so it can be a program name with args.
-set dummy cl; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:615: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+fi
+if test -z "$CC"; then
+  if test -n "$ac_tool_prefix"; then
+  for ac_prog in cl
+  do
+    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
   if test -n "$CC"; then
   ac_cv_prog_CC="$CC" # Let the user override the test.
 else
-  IFS="${IFS= 	}"; ac_save_ifs="$IFS"; IFS=":"
-  ac_dummy="$PATH"
-  for ac_dir in $ac_dummy; do
-    test -z "$ac_dir" && ac_dir=.
-    if test -f $ac_dir/$ac_word; then
-      ac_cv_prog_CC="cl"
-      break
-    fi
-  done
-  IFS="$ac_save_ifs"
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
+  fi
+done
+done
+
 fi
 fi
-CC="$ac_cv_prog_CC"
+CC=$ac_cv_prog_CC
 if test -n "$CC"; then
-  echo "$ac_t""$CC" 1>&6
+  echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6
 else
-  echo "$ac_t""no" 1>&6
-fi
- ;;
-    esac
-  fi
-  test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:647: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-cat > conftest.$ac_ext << EOF
-
-#line 658 "configure"
-#include "confdefs.h"
-
-main(){return(0);}
-EOF
-if { (eval echo configure:663: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  ac_cv_prog_cc_works=yes
-  # If we can't run a trivial program, we are probably using a cross compiler.
-  if (./conftest; exit) 2>/dev/null; then
-    ac_cv_prog_cc_cross=no
-  else
-    ac_cv_prog_cc_cross=yes
+    test -n "$CC" && break
+  done
+fi
+if test -z "$CC"; then
+  ac_ct_CC=$CC
+  for ac_prog in cl
+do
+  # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if test -n "$ac_ct_CC"; then
+  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for ac_exec_ext in '' $ac_executable_extensions; do
+  if $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+    ac_cv_prog_ac_ct_CC="$ac_prog"
+    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+    break 2
   fi
+done
+done
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+  echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  ac_cv_prog_cc_works=no
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
-rm -fr conftest*
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
 
-echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
-if test $ac_cv_prog_cc_works = no; then
-  { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
-fi
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:689: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
-echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
-cross_compiling=$ac_cv_prog_cc_cross
+  test -n "$ac_ct_CC" && break
+done
 
-echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:694: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.c <<EOF
-#ifdef __GNUC__
-  yes;
-#endif
-EOF
-if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:703: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
-  ac_cv_prog_gcc=yes
-else
-  ac_cv_prog_gcc=no
+  CC=$ac_ct_CC
 fi
+
 fi
 
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
 
-if test $ac_cv_prog_gcc = yes; then
-  GCC=yes
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH" >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH" >&2;}
+   { (exit 1); exit 1; }; }
+
+# Provide some information about the compiler.
+echo "$as_me:$LINENO:" \
+     "checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler --version </dev/null >&5\"") >&5
+  (eval $ac_compiler --version </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -v </dev/null >&5\"") >&5
+  (eval $ac_compiler -v </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+{ (eval echo "$as_me:$LINENO: \"$ac_compiler -V </dev/null >&5\"") >&5
+  (eval $ac_compiler -V </dev/null >&5) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }
+
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.exe"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+echo "$as_me:$LINENO: checking for C compiler default output" >&5
+echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+if { (eval echo "$as_me:$LINENO: \"$ac_link_default\"") >&5
+  (eval $ac_link_default) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # Find the output, starting from the most likely.  This scheme is
+# not robust to junk in `.', hence go to wildcards (a.*) only as a last
+# resort.
+
+# Be careful to initialize this variable, since it used to be cached.
+# Otherwise an old cache value of `no' led to `EXEEXT = no' in a Makefile.
+ac_cv_exeext=
+for ac_file in a_out.exe a.exe conftest.exe a.out conftest a.* conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+    a.out ) # We found the default executable, but exeext='' is most
+            # certainly right.
+            break;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+          # FIXME: I believe we export ac_cv_exeext for Libtool --akim.
+          export ac_cv_exeext
+          break;;
+    * ) break;;
+  esac
+done
 else
-  GCC=
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+check \`config.log' for details." >&5
+echo "$as_me: error: C compiler cannot create executables
+check \`config.log' for details." >&2;}
+   { (exit 77); exit 77; }; }
+fi
+
+ac_exeext=$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6
+
+# Check the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+  if { ac_try='./$ac_file'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+    cross_compiling=no
+  else
+    if test "$cross_compiling" = maybe; then
+	cross_compiling=yes
+    else
+	{ { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'." >&2;}
+   { (exit 1); exit 1; }; }
+    fi
+  fi
 fi
+echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
 
-ac_test_CFLAGS="${CFLAGS+set}"
-ac_save_CFLAGS="$CFLAGS"
-CFLAGS=
-echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:722: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+rm -f a.out a.exe conftest$ac_cv_exeext
+ac_clean_files=$ac_clean_files_save
+# Check the compiler produces executables we can run.  If not, either
+# the compiler is broken, or we cross compile.
+echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6
+echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6
+
+echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+  test -f "$ac_file" || continue
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.o | *.obj ) ;;
+    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+          export ac_cv_exeext
+          break;;
+    * ) break;;
+  esac
+done
 else
-  echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
+  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link" >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest$ac_cv_exeext
+echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6
+if test "${ac_cv_objext+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; then
+  for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do
+  case $ac_file in
+    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg ) ;;
+    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+       break;;
+  esac
+done
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile" >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile" >&2;}
+   { (exit 1); exit 1; }; }
+fi
+
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+int
+main ()
+{
+#ifndef __GNUC__
+       choke me
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_compiler_gnu=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_compiler_gnu=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6
+GCC=`test $ac_compiler_gnu = yes && echo yes`
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+CFLAGS="-g"
+echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_g+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_prog_cc_g=yes
 else
-  ac_cv_prog_cc_g=no
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_prog_cc_g=no
 fi
-rm -f conftest*
-
+rm -f conftest.$ac_objext conftest.$ac_ext
 fi
-
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6
 if test "$ac_test_CFLAGS" = set; then
-  CFLAGS="$ac_save_CFLAGS"
+  CFLAGS=$ac_save_CFLAGS
 elif test $ac_cv_prog_cc_g = yes; then
   if test "$GCC" = yes; then
     CFLAGS="-g -O2"
@@ -748,150 +1857,560 @@
     CFLAGS=
   fi
 fi
+echo "$as_me:$LINENO: checking for $CC option to accept ANSI C" >&5
+echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6
+if test "${ac_cv_prog_cc_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_prog_cc_stdc=no
+ac_save_CC=$CC
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+     char **p;
+     int i;
+{
+  return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+  char *s;
+  va_list v;
+  va_start (v,p);
+  s = g (p, va_arg (v,int));
+  va_end (v);
+  return s;
+}
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
+  ;
+  return 0;
+}
+_ACEOF
+# Don't try gcc -ansi; that turns off useful extensions and
+# breaks some systems' header files.
+# AIX			-qlanglvl=ansi
+# Ultrix and OSF/1	-std1
+# HP-UX 10.20 and later	-Ae
+# HP-UX older versions	-Aa -D_HPUX_SOURCE
+# SVR4			-Xc -D__EXTENSIONS__
+for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+  CC="$ac_save_CC $ac_arg"
+  rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_prog_cc_stdc=$ac_arg
+break
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext
+done
+rm -f conftest.$ac_ext conftest.$ac_objext
+CC=$ac_save_CC
 
-echo $ac_n "checking for POSIXized ISC""... $ac_c" 1>&6
-echo "configure:754: checking for POSIXized ISC" >&5
-if test -d /etc/conf/kconfig.d &&
-  grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1
-then
-  echo "$ac_t""yes" 1>&6
-  ISC=yes # If later tests want to check for ISC.
-  cat >> confdefs.h <<\EOF
-#define _POSIX_SOURCE 1
-EOF
+fi
 
-  if test "$GCC" = yes; then
-    CC="$CC -posix"
-  else
-    CC="$CC -Xp"
-  fi
+case "x$ac_cv_prog_cc_stdc" in
+  x|xno)
+    echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6 ;;
+  *)
+    echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6
+    CC="$CC $ac_cv_prog_cc_stdc" ;;
+esac
+
+# Some people use a C++ compiler to compile C.  Since we use `exit',
+# in C++ we need to declare it.  In case someone uses the same compiler
+# for both compiling C and C++ we need to have the C++ compiler decide
+# the declaration of exit, since it's the most demanding environment.
+cat >conftest.$ac_ext <<_ACEOF
+#ifndef __cplusplus
+  choke me
+#endif
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  for ac_declaration in \
+   ''\
+   '#include <stdlib.h>' \
+   'extern "C" void std::exit (int) throw (); using std::exit;' \
+   'extern "C" void std::exit (int); using std::exit;' \
+   'extern "C" void exit (int) throw ();' \
+   'extern "C" void exit (int);' \
+   'void exit (int);'
+do
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <stdlib.h>
+$ac_declaration
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  :
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+continue
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_declaration
+int
+main ()
+{
+exit (42);
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+done
+rm -f conftest*
+if test -n "$ac_declaration"; then
+  echo '#ifdef __cplusplus' >>confdefs.h
+  echo $ac_declaration      >>confdefs.h
+  echo '#endif'             >>confdefs.h
+fi
+
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+echo "$as_me:$LINENO: checking for library containing strerror" >&5
+echo $ECHO_N "checking for library containing strerror... $ECHO_C" >&6
+if test "${ac_cv_search_strerror+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_func_search_save_LIBS=$LIBS
+ac_cv_search_strerror=no
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char strerror ();
+int
+main ()
+{
+strerror ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_strerror="none required"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+if test "$ac_cv_search_strerror" = no; then
+  for ac_lib in cposix; do
+    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
+    cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char strerror ();
+int
+main ()
+{
+strerror ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_search_strerror="-l$ac_lib"
+break
 else
-  echo "$ac_t""no" 1>&6
-  ISC=
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+  done
+fi
+LIBS=$ac_func_search_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_search_strerror" >&5
+echo "${ECHO_T}$ac_cv_search_strerror" >&6
+if test "$ac_cv_search_strerror" != no; then
+  test "$ac_cv_search_strerror" = "none required" || LIBS="$ac_cv_search_strerror $LIBS"
+
 fi
 
-echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6
-echo "configure:775: checking how to run the C preprocessor" >&5
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6
 # On Suns, sometimes $CPP names a directory.
 if test -n "$CPP" && test -d "$CPP"; then
   CPP=
 fi
 if test -z "$CPP"; then
-if eval "test \"`echo '$''{'ac_cv_prog_CPP'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+  if test "${ac_cv_prog_CPP+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-    # This must be in double quotes, not single quotes, because CPP may get
-  # substituted into the Makefile and "${CC-cc}" will confuse make.
-  CPP="${CC-cc} -E"
+      # Double quotes because CPP needs to be expanded
+    for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+    do
+      ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
   # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp.
-  cat > conftest.$ac_ext <<EOF
-#line 790 "configure"
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:796: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
+                     Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
   :
 else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
+  echo "$as_me: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  CPP="${CC-cc} -E -traditional-cpp"
-  cat > conftest.$ac_ext <<EOF
-#line 807 "configure"
-#include "confdefs.h"
-#include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:813: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  :
+  # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether non-existent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
 else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  CPP="${CC-cc} -nologo -E"
-  cat > conftest.$ac_ext <<EOF
-#line 824 "configure"
+  # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  break
+fi
+
+    done
+    ac_cv_prog_CPP=$CPP
+
+fi
+  CPP=$ac_cv_prog_CPP
+else
+  ac_cv_prog_CPP=$CPP
+fi
+echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+  # Use a header file that comes with gcc, so configuring glibc
+  # with a fresh cross-compiler works.
+  # On the NeXT, cc -E runs the code through the compiler's parser,
+  # not just through cpp. "Syntax error" is here to catch this case.
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <assert.h>
-Syntax Error
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:830: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
+                     Syntax error
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
   :
 else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
+  echo "$as_me: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  CPP=/lib/cpp
+  # Broken: fails on valid input.
+continue
 fi
-rm -f conftest*
-fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_ext
+
+  # OK, works on sane cases.  Now check whether non-existent headers
+  # can be detected and how.
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <ac_nonexistent.h>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
 fi
-rm -f conftest*
-  ac_cv_prog_CPP="$CPP"
+if test -z "$ac_cpp_err"; then
+  # Broken: success on invalid input.
+continue
+else
+  echo "$as_me: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  # Passes both tests.
+ac_preproc_ok=:
+break
 fi
-  CPP="$ac_cv_prog_CPP"
+rm -f conftest.err conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+  :
 else
-  ac_cv_prog_CPP="$CPP"
+  { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check" >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;}
+   { (exit 1); exit 1; }; }
 fi
-echo "$ac_t""$CPP" 1>&6
 
-if test $ac_cv_prog_gcc = yes; then
-    echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6
-echo "configure:856: checking whether ${CC-cc} needs -traditional" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6
+if test "${ac_cv_prog_egrep+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+    then ac_cv_prog_egrep='grep -E'
+    else ac_cv_prog_egrep='egrep'
+    fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5
+echo "${ECHO_T}$ac_cv_prog_egrep" >&6
+ EGREP=$ac_cv_prog_egrep
+
+
+if test $ac_cv_c_compiler_gnu = yes; then
+    echo "$as_me:$LINENO: checking whether $CC needs -traditional" >&5
+echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6
+if test "${ac_cv_prog_gcc_traditional+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
     ac_pattern="Autoconf.*'x'"
-  cat > conftest.$ac_ext <<EOF
-#line 862 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <sgtty.h>
 Autoconf TIOCGETP
-EOF
+_ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "$ac_pattern" >/dev/null 2>&1; then
-  rm -rf conftest*
+  $EGREP "$ac_pattern" >/dev/null 2>&1; then
   ac_cv_prog_gcc_traditional=yes
 else
-  rm -rf conftest*
   ac_cv_prog_gcc_traditional=no
 fi
 rm -f conftest*
 
 
   if test $ac_cv_prog_gcc_traditional = no; then
-    cat > conftest.$ac_ext <<EOF
-#line 880 "configure"
+    cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <termio.h>
 Autoconf TCGETA
-EOF
+_ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "$ac_pattern" >/dev/null 2>&1; then
-  rm -rf conftest*
+  $EGREP "$ac_pattern" >/dev/null 2>&1; then
   ac_cv_prog_gcc_traditional=yes
 fi
 rm -f conftest*
 
   fi
 fi
-
-echo "$ac_t""$ac_cv_prog_gcc_traditional" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_prog_gcc_traditional" >&5
+echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6
   if test $ac_cv_prog_gcc_traditional = yes; then
     CC="$CC -traditional"
   fi
@@ -907,14 +2426,20 @@
     ac_aux_dir=$ac_dir
     ac_install_sh="$ac_aux_dir/install.sh -c"
     break
+  elif test -f $ac_dir/shtool; then
+    ac_aux_dir=$ac_dir
+    ac_install_sh="$ac_aux_dir/shtool install -c"
+    break
   fi
 done
 if test -z "$ac_aux_dir"; then
-  { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; }
-fi
-ac_config_guess=$ac_aux_dir/config.guess
-ac_config_sub=$ac_aux_dir/config.sub
-ac_configure=$ac_aux_dir/configure # This should be Cygnus configure.
+  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5
+echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;}
+   { (exit 1); exit 1; }; }
+fi
+ac_config_guess="$SHELL $ac_aux_dir/config.guess"
+ac_config_sub="$SHELL $ac_aux_dir/config.sub"
+ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure.
 
 # Find a good install program.  We prefer a C program (faster),
 # so one script is as good as another.  But avoid the broken or
@@ -923,416 +2448,824 @@
 # SunOS /usr/etc/install
 # IRIX /sbin/install
 # AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
 # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
 # AFS /usr/afsws/bin/install, which mishandles nonexistent args
 # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
 # ./install, which can be erroneously created by make from ./install.sh.
-echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
-echo "configure:932: checking for a BSD compatible install" >&5
+echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6
 if test -z "$INSTALL"; then
-if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+if test "${ac_cv_path_install+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-    IFS="${IFS= 	}"; ac_save_IFS="$IFS"; IFS=":"
-  for ac_dir in $PATH; do
-    # Account for people who put trailing slashes in PATH elements.
-    case "$ac_dir/" in
-    /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;;
-    *)
-      # OSF1 and SCO ODT 3.0 have their own names for install.
-      # Don't use installbsd from OSF since it installs stuff as root
-      # by default.
-      for ac_prog in ginstall scoinst install; do
-        if test -f $ac_dir/$ac_prog; then
-	  if test $ac_prog = install &&
-            grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then
-	    # AIX install.  It has an incompatible calling convention.
-	    :
-	  else
-	    ac_cv_path_install="$ac_dir/$ac_prog -c"
-	    break 2
-	  fi
-	fi
+  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+  ./ | .// | /cC/* | \
+  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+  /usr/ucb/* ) ;;
+  *)
+    # OSF1 and SCO ODT 3.0 have their own names for install.
+    # Don't use installbsd from OSF since it installs stuff as root
+    # by default.
+    for ac_prog in ginstall scoinst install; do
+      for ac_exec_ext in '' $ac_executable_extensions; do
+        if $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+          if test $ac_prog = install &&
+            grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+            # AIX install.  It has an incompatible calling convention.
+            :
+          elif test $ac_prog = install &&
+            grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+            # program-specific install script used by HP pwplus--don't use.
+            :
+          else
+            ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+            break 3
+          fi
+        fi
       done
-      ;;
-    esac
-  done
-  IFS="$ac_save_IFS"
+    done
+    ;;
+esac
+done
+
 
 fi
   if test "${ac_cv_path_install+set}" = set; then
-    INSTALL="$ac_cv_path_install"
+    INSTALL=$ac_cv_path_install
   else
     # As a last resort, use the slow shell script.  We don't cache a
     # path for INSTALL within a source directory, because that will
     # break other packages using the cache if that directory is
     # removed, or if the path is relative.
-    INSTALL="$ac_install_sh"
+    INSTALL=$ac_install_sh
   fi
 fi
-echo "$ac_t""$INSTALL" 1>&6
+echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6
 
 # Use test -z because SunOS4 sh mishandles braces in ${var-val}.
 # It thinks the first close brace ends the variable substitution.
 test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
 
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
 
 test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
 
 
-
-echo $ac_n "checking for initscr in -lxcurses""... $ac_c" 1>&6
-echo "configure:987: checking for initscr in -lxcurses" >&5
-ac_lib_var=`echo xcurses'_'initscr | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  ac_save_LIBS="$LIBS"
-LIBS="-lxcurses  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 995 "configure"
+# Checks for compilation model.
+# Check whether --enable-largefile or --disable-largefile was given.
+if test "${enable_largefile+set}" = set; then
+  enableval="$enable_largefile"
+
+fi;
+if test "$enable_largefile" != no; then
+
+  echo "$as_me:$LINENO: checking for special C compiler options needed for large files" >&5
+echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6
+if test "${ac_cv_sys_largefile_CC+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_cv_sys_largefile_CC=no
+     if test "$GCC" != yes; then
+       ac_save_CC=$CC
+       while :; do
+     	 # IRIX 6.2 and later do not support large files by default,
+     	 # so use the C compiler's -n32 option if that helps.
+         cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char initscr();
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+     	 rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext
+     	 CC="$CC -n32"
+     	 rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_sys_largefile_CC=' -n32'; break
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext
+         break
+       done
+       CC=$ac_save_CC
+       rm -f conftest.$ac_ext
+    fi
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sys_largefile_CC" >&5
+echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6
+  if test "$ac_cv_sys_largefile_CC" != no; then
+    CC=$CC$ac_cv_sys_largefile_CC
+  fi
 
-int main() {
-initscr()
-; return 0; }
-EOF
-if { (eval echo configure:1006: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+  echo "$as_me:$LINENO: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6
+if test "${ac_cv_sys_file_offset_bits+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  while :; do
+  ac_cv_sys_file_offset_bits=no
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#define _FILE_OFFSET_BITS 64
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_sys_file_offset_bits=64; break
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
 fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
+rm -f conftest.$ac_objext conftest.$ac_ext
+  break
+done
+fi
+echo "$as_me:$LINENO: result: $ac_cv_sys_file_offset_bits" >&5
+echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6
+if test "$ac_cv_sys_file_offset_bits" != no; then
+
+cat >>confdefs.h <<_ACEOF
+#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits
+_ACEOF
 
 fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  have_xcurses=yes
+rm -f conftest*
+  echo "$as_me:$LINENO: checking for _LARGE_FILES value needed for large files" >&5
+echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6
+if test "${ac_cv_sys_large_files+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  while :; do
+  ac_cv_sys_large_files=no
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  break
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#define _LARGE_FILES 1
+#include <sys/types.h>
+ /* Check that off_t can represent 2**63 - 1 correctly.
+    We can't simply define LARGE_OFF_T to be 9223372036854775807,
+    since some C++ compilers masquerading as C compilers
+    incorrectly reject 9223372036854775807.  */
+#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62))
+  int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721
+		       && LARGE_OFF_T % 2147483647 == 1)
+		      ? 1 : -1];
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_sys_large_files=1; break
 else
-  echo "$ac_t""no" 1>&6
-have_xcurses=no
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+  break
+done
 fi
+echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5
+echo "${ECHO_T}$ac_cv_sys_large_files" >&6
+if test "$ac_cv_sys_large_files" != no; then
 
-echo $ac_n "checking for initscr in -lncurses""... $ac_c" 1>&6
-echo "configure:1028: checking for initscr in -lncurses" >&5
-ac_lib_var=`echo ncurses'_'initscr | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+cat >>confdefs.h <<_ACEOF
+#define _LARGE_FILES $ac_cv_sys_large_files
+_ACEOF
+
+fi
+rm -f conftest*
+fi
+
+
+# Checks for general libraries.
+echo "$as_me:$LINENO: checking for initscr in -lxcurses" >&5
+echo $ECHO_N "checking for initscr in -lxcurses... $ECHO_C" >&6
+if test "${ac_cv_lib_xcurses_initscr+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_save_LIBS="$LIBS"
-LIBS="-lncurses  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1036 "configure"
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lxcurses  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
+
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char initscr();
-
-int main() {
-initscr()
-; return 0; }
-EOF
-if { (eval echo configure:1047: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
+   builtin and then its argument prototype would still apply.  */
+char initscr ();
+int
+main ()
+{
+initscr ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_xcurses_initscr=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_xcurses_initscr=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_xcurses_initscr" >&5
+echo "${ECHO_T}$ac_cv_lib_xcurses_initscr" >&6
+if test $ac_cv_lib_xcurses_initscr = yes; then
+  have_xcurses=yes
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
+  have_xcurses=no
 fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
 
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
+echo "$as_me:$LINENO: checking for initscr in -lncurses" >&5
+echo $ECHO_N "checking for initscr in -lncurses... $ECHO_C" >&6
+if test "${ac_cv_lib_ncurses_initscr+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  ac_check_lib_save_LIBS=$LIBS
+LIBS="-lncurses  $LIBS"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char initscr ();
+int
+main ()
+{
+initscr ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_ncurses_initscr=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_ncurses_initscr=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_initscr" >&5
+echo "${ECHO_T}$ac_cv_lib_ncurses_initscr" >&6
+if test $ac_cv_lib_ncurses_initscr = yes; then
   have_ncurses=yes
 else
-  echo "$ac_t""no" 1>&6
-have_ncurses=no
+  have_ncurses=no
 fi
 
-echo $ac_n "checking for initscr in -lcurses""... $ac_c" 1>&6
-echo "configure:1069: checking for initscr in -lcurses" >&5
-ac_lib_var=`echo curses'_'initscr | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for initscr in -lcurses" >&5
+echo $ECHO_N "checking for initscr in -lcurses... $ECHO_C" >&6
+if test "${ac_cv_lib_curses_initscr+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_save_LIBS="$LIBS"
+  ac_check_lib_save_LIBS=$LIBS
 LIBS="-lcurses  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1077 "configure"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
-/* Override any gcc2 internal prototype to avoid an error.  */
-/* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char initscr();
 
-int main() {
-initscr()
-; return 0; }
-EOF
-if { (eval echo configure:1088: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
+/* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
+/* We use char because int might match the return type of a gcc2
+   builtin and then its argument prototype would still apply.  */
+char initscr ();
+int
+main ()
+{
+initscr ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_curses_initscr=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_curses_initscr=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_curses_initscr" >&5
+echo "${ECHO_T}$ac_cv_lib_curses_initscr" >&6
+if test $ac_cv_lib_curses_initscr = yes; then
   have_curses=yes
 else
-  echo "$ac_t""no" 1>&6
-have_curses=no
+  have_curses=no
 fi
 
-echo $ac_n "checking for tgetent in -ltermcap""... $ac_c" 1>&6
-echo "configure:1110: checking for tgetent in -ltermcap" >&5
-ac_lib_var=`echo termcap'_'tgetent | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for tgetent in -ltermcap" >&5
+echo $ECHO_N "checking for tgetent in -ltermcap... $ECHO_C" >&6
+if test "${ac_cv_lib_termcap_tgetent+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_save_LIBS="$LIBS"
+  ac_check_lib_save_LIBS=$LIBS
 LIBS="-ltermcap  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1118 "configure"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
+
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char tgetent();
-
-int main() {
-tgetent()
-; return 0; }
-EOF
-if { (eval echo configure:1129: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
+   builtin and then its argument prototype would still apply.  */
+char tgetent ();
+int
+main ()
+{
+tgetent ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_termcap_tgetent=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_termcap_tgetent=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_termcap_tgetent" >&5
+echo "${ECHO_T}$ac_cv_lib_termcap_tgetent" >&6
+if test $ac_cv_lib_termcap_tgetent = yes; then
   have_termcap=yes
 else
-  echo "$ac_t""no" 1>&6
-have_termcap=no
+  have_termcap=no
 fi
 
-echo $ac_n "checking for tgetent in -ltermlib""... $ac_c" 1>&6
-echo "configure:1151: checking for tgetent in -ltermlib" >&5
-ac_lib_var=`echo termlib'_'tgetent | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for tgetent in -ltermlib" >&5
+echo $ECHO_N "checking for tgetent in -ltermlib... $ECHO_C" >&6
+if test "${ac_cv_lib_termlib_tgetent+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_save_LIBS="$LIBS"
+  ac_check_lib_save_LIBS=$LIBS
 LIBS="-ltermlib  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1159 "configure"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
+
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char tgetent();
-
-int main() {
-tgetent()
-; return 0; }
-EOF
-if { (eval echo configure:1170: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
+   builtin and then its argument prototype would still apply.  */
+char tgetent ();
+int
+main ()
+{
+tgetent ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_termlib_tgetent=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_termlib_tgetent=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_termlib_tgetent" >&5
+echo "${ECHO_T}$ac_cv_lib_termlib_tgetent" >&6
+if test $ac_cv_lib_termlib_tgetent = yes; then
   have_termlib=yes
 else
-  echo "$ac_t""no" 1>&6
-have_termlib=no
+  have_termlib=no
 fi
 
-echo $ac_n "checking for regcmp in -lgen""... $ac_c" 1>&6
-echo "configure:1192: checking for regcmp in -lgen" >&5
-ac_lib_var=`echo gen'_'regcmp | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+# Regular expressions (regcmp) are in -lgen on Solaris 2,
+# and in -lintl on SCO Unix.
+
+echo "$as_me:$LINENO: checking for regcmp in -lgen" >&5
+echo $ECHO_N "checking for regcmp in -lgen... $ECHO_C" >&6
+if test "${ac_cv_lib_gen_regcmp+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_save_LIBS="$LIBS"
+  ac_check_lib_save_LIBS=$LIBS
 LIBS="-lgen  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1200 "configure"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
+
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char regcmp();
-
-int main() {
-regcmp()
-; return 0; }
-EOF
-if { (eval echo configure:1211: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_lib=HAVE_LIB`echo gen | sed -e 's/[^a-zA-Z0-9_]/_/g' \
-    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
-EOF
+   builtin and then its argument prototype would still apply.  */
+char regcmp ();
+int
+main ()
+{
+regcmp ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_gen_regcmp=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_gen_regcmp=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_gen_regcmp" >&5
+echo "${ECHO_T}$ac_cv_lib_gen_regcmp" >&6
+if test $ac_cv_lib_gen_regcmp = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBGEN 1
+_ACEOF
 
   LIBS="-lgen $LIBS"
 
-else
-  echo "$ac_t""no" 1>&6
 fi
 
-echo $ac_n "checking for regcmp in -lintl""... $ac_c" 1>&6
-echo "configure:1239: checking for regcmp in -lintl" >&5
-ac_lib_var=`echo intl'_'regcmp | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+
+echo "$as_me:$LINENO: checking for regcmp in -lintl" >&5
+echo $ECHO_N "checking for regcmp in -lintl... $ECHO_C" >&6
+if test "${ac_cv_lib_intl_regcmp+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_save_LIBS="$LIBS"
+  ac_check_lib_save_LIBS=$LIBS
 LIBS="-lintl  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1247 "configure"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
+
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char regcmp();
-
-int main() {
-regcmp()
-; return 0; }
-EOF
-if { (eval echo configure:1258: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_lib=HAVE_LIB`echo intl | sed -e 's/[^a-zA-Z0-9_]/_/g' \
-    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
-EOF
+   builtin and then its argument prototype would still apply.  */
+char regcmp ();
+int
+main ()
+{
+regcmp ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_intl_regcmp=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_intl_regcmp=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_intl_regcmp" >&5
+echo "${ECHO_T}$ac_cv_lib_intl_regcmp" >&6
+if test $ac_cv_lib_intl_regcmp = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBINTL 1
+_ACEOF
 
   LIBS="-lintl $LIBS"
 
-else
-  echo "$ac_t""no" 1>&6
 fi
 
-echo $ac_n "checking for regcmp in -lPW""... $ac_c" 1>&6
-echo "configure:1286: checking for regcmp in -lPW" >&5
-ac_lib_var=`echo PW'_'regcmp | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+
+echo "$as_me:$LINENO: checking for regcmp in -lPW" >&5
+echo $ECHO_N "checking for regcmp in -lPW... $ECHO_C" >&6
+if test "${ac_cv_lib_PW_regcmp+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_save_LIBS="$LIBS"
+  ac_check_lib_save_LIBS=$LIBS
 LIBS="-lPW  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 1294 "configure"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
+
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char regcmp();
-
-int main() {
-regcmp()
-; return 0; }
-EOF
-if { (eval echo configure:1305: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_lib=HAVE_LIB`echo PW | sed -e 's/[^a-zA-Z0-9_]/_/g' \
-    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_lib 1
-EOF
+   builtin and then its argument prototype would still apply.  */
+char regcmp ();
+int
+main ()
+{
+regcmp ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_PW_regcmp=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_PW_regcmp=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_PW_regcmp" >&5
+echo "${ECHO_T}$ac_cv_lib_PW_regcmp" >&6
+if test $ac_cv_lib_PW_regcmp = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBPW 1
+_ACEOF
 
   LIBS="-lPW $LIBS"
 
-else
-  echo "$ac_t""no" 1>&6
 fi
 
 
-echo $ac_n "checking for working terminal libraries""... $ac_c" 1>&6
-echo "configure:1334: checking for working terminal libraries" >&5
+# Checks for terminal libraries
+echo "$as_me:$LINENO: checking for working terminal libraries" >&5
+echo $ECHO_N "checking for working terminal libraries... $ECHO_C" >&6
 TERMLIBS=
 
+# Check for systems where curses is broken.
 curses_broken=0
 if test x`uname -s` = "xHP-UX" >/dev/null 2>&1; then
 if test x`uname -r` = "xB.11.00" >/dev/null 2>&1; then
@@ -1344,114 +3277,170 @@
 fi
 
 if test $curses_broken = 0; then
+# -- Try xcurses.
 if test "x$TERMLIBS" = x; then
   if test $have_xcurses = yes; then
     TERMLIBS="-lxcurses"
     SAVE_LIBS=$LIBS
     LIBS="$LIBS $TERMLIBS"
-    cat > conftest.$ac_ext <<EOF
-#line 1354 "configure"
+    cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
-int main() {
+int
+main ()
+{
 tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);
-; return 0; }
-EOF
-if { (eval echo configure:1361: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   termok=yes
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  termok=no
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+termok=no
 fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
     LIBS=$SAVE_LIBS
     if test $termok = no; then TERMLIBS=""; fi
   fi
 fi
 
+# -- Try ncurses.
 if test "x$TERMLIBS" = x; then
   if test $have_ncurses = yes; then
     TERMLIBS="-lncurses"
     SAVE_LIBS=$LIBS
     LIBS="$LIBS $TERMLIBS"
-    cat > conftest.$ac_ext <<EOF
-#line 1382 "configure"
+    cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
-int main() {
+int
+main ()
+{
 tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);
-; return 0; }
-EOF
-if { (eval echo configure:1389: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   termok=yes
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  termok=no
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+termok=no
 fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
     LIBS=$SAVE_LIBS
     if test $termok = no; then TERMLIBS=""; fi
   fi
 fi
 
+# -- Try curses.
 if test "x$TERMLIBS" = x; then
   if test $have_curses = yes; then
     TERMLIBS="-lcurses"
     SAVE_LIBS=$LIBS
     LIBS="$LIBS $TERMLIBS"
-    cat > conftest.$ac_ext <<EOF
-#line 1410 "configure"
+    cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
-int main() {
+int
+main ()
+{
 tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);
-; return 0; }
-EOF
-if { (eval echo configure:1417: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   termok=yes
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  termok=no
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+termok=no
 fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
     LIBS=$SAVE_LIBS
     if test $termok = no; then TERMLIBS=""; fi
   fi
 fi
 
+# -- Try curses & termcap.
 if test "x$TERMLIBS" = x; then
   if test $have_curses = yes; then
   if test $have_termcap = yes; then
     TERMLIBS="-lcurses -ltermcap"
     SAVE_LIBS=$LIBS
     LIBS="$LIBS $TERMLIBS"
-    cat > conftest.$ac_ext <<EOF
-#line 1439 "configure"
+    cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
-int main() {
+int
+main ()
+{
 tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);
-; return 0; }
-EOF
-if { (eval echo configure:1446: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   termok=yes
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  termok=no
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+termok=no
 fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
     LIBS=$SAVE_LIBS
     if test $termok = no; then TERMLIBS=""; fi
   fi
@@ -1459,151 +3448,151 @@
 fi
 fi
 
+# -- Try termcap.
 if test "x$TERMLIBS" = x; then
   if test $have_termcap = yes; then
     TERMLIBS="-ltermcap"
     SAVE_LIBS=$LIBS
     LIBS="$LIBS $TERMLIBS"
-    cat > conftest.$ac_ext <<EOF
-#line 1469 "configure"
+    cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
-int main() {
+int
+main ()
+{
 tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);
-; return 0; }
-EOF
-if { (eval echo configure:1476: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   termok=yes
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  termok=no
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+termok=no
 fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
     LIBS=$SAVE_LIBS
     if test $termok = no; then TERMLIBS=""; fi
   fi
 fi
 
+# -- Try termlib.
 if test "x$TERMLIBS" = x; then
   if test $have_termlib = yes; then
     TERMLIBS="-lcurses -ltermlib"
     SAVE_LIBS=$LIBS
     LIBS="$LIBS $TERMLIBS"
-    cat > conftest.$ac_ext <<EOF
-#line 1497 "configure"
+    cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
-int main() {
+int
+main ()
+{
 tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);
-; return 0; }
-EOF
-if { (eval echo configure:1504: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   termok=yes
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  termok=no
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+termok=no
 fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
     LIBS=$SAVE_LIBS
     if test $termok = no; then TERMLIBS=""; fi
   fi
 fi
 
 if test "x$TERMLIBS" = x; then
-  echo "$ac_t""Cannot find terminal libraries - configure failed" 1>&6
+  echo "$as_me:$LINENO: result: Cannot find terminal libraries - configure failed" >&5
+echo "${ECHO_T}Cannot find terminal libraries - configure failed" >&6
   exit 1
 fi
-echo "$ac_t""using $TERMLIBS" 1>&6
+echo "$as_me:$LINENO: result: using $TERMLIBS" >&5
+echo "${ECHO_T}using $TERMLIBS" >&6
 LIBS="$LIBS $TERMLIBS"
 
-
-for ac_hdr in ctype.h errno.h fcntl.h limits.h stdio.h stdlib.h string.h termcap.h termio.h termios.h time.h unistd.h values.h sys/ioctl.h sys/stream.h sys/ptem.h
-do
-ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
-echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:1531: checking for $ac_hdr" >&5
-if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
-else
-  cat > conftest.$ac_ext <<EOF
-#line 1536 "configure"
-#include "confdefs.h"
-#include <$ac_hdr>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1541: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=yes"
-else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_header_$ac_safe=no"
-fi
-rm -f conftest*
-fi
-if eval "test \"`echo '$ac_cv_header_'$ac_safe`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_hdr=HAVE_`echo $ac_hdr | sed 'y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_hdr 1
-EOF
- 
-else
-  echo "$ac_t""no" 1>&6
-fi
-done
-
-
-echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:1569: checking for ANSI C header files" >&5
-if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+# Checks for header files.
+echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6
+if test "${ac_cv_header_stdc+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 1574 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <stdlib.h>
 #include <stdarg.h>
 #include <string.h>
 #include <float.h>
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1582: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
-  rm -rf conftest*
+
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
   ac_cv_header_stdc=yes
 else
-  echo "$ac_err" >&5
-  echo "configure: failed program was:" >&5
+  echo "$as_me: failed program was:" >&5
   cat conftest.$ac_ext >&5
-  rm -rf conftest*
   ac_cv_header_stdc=no
 fi
-rm -f conftest*
+rm -f conftest.err conftest.$ac_ext
 
 if test $ac_cv_header_stdc = yes; then
   # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-cat > conftest.$ac_ext <<EOF
-#line 1599 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <string.h>
-EOF
+
+_ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "memchr" >/dev/null 2>&1; then
+  $EGREP "memchr" >/dev/null 2>&1; then
   :
 else
-  rm -rf conftest*
   ac_cv_header_stdc=no
 fi
 rm -f conftest*
@@ -1612,16 +3601,16 @@
 
 if test $ac_cv_header_stdc = yes; then
   # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-cat > conftest.$ac_ext <<EOF
-#line 1617 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <stdlib.h>
-EOF
+
+_ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "free" >/dev/null 2>&1; then
+  $EGREP "free" >/dev/null 2>&1; then
   :
 else
-  rm -rf conftest*
   ac_cv_header_stdc=no
 fi
 rm -f conftest*
@@ -1630,159 +3619,790 @@
 
 if test $ac_cv_header_stdc = yes; then
   # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-if test "$cross_compiling" = yes; then
+  if test "$cross_compiling" = yes; then
   :
 else
-  cat > conftest.$ac_ext <<EOF
-#line 1638 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <ctype.h>
-#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-#define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) (('a' <= (c) && (c) <= 'i') \
+                     || ('j' <= (c) && (c) <= 'r') \
+                     || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
 #define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int main () { int i; for (i = 0; i < 256; i++)
-if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2);
-exit (0); }
-
-EOF
-if { (eval echo configure:1649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
+int
+main ()
+{
+  int i;
+  for (i = 0; i < 256; i++)
+    if (XOR (islower (i), ISLOWER (i))
+        || toupper (i) != TOUPPER (i))
+      exit(2);
+  exit (0);
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   :
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -fr conftest*
-  ac_cv_header_stdc=no
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+( exit $ac_status )
+ac_cv_header_stdc=no
 fi
-rm -fr conftest*
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
-
 fi
 fi
-
-echo "$ac_t""$ac_cv_header_stdc" 1>&6
+echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6
 if test $ac_cv_header_stdc = yes; then
-  cat >> confdefs.h <<\EOF
+
+cat >>confdefs.h <<\_ACEOF
 #define STDC_HEADERS 1
-EOF
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+                  inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_Header=yes"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_Header=no"
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+
+
+
+
+
+
+
+
+
+
 
+
+
+
+
+
+for ac_header in ctype.h errno.h fcntl.h limits.h stdio.h stdlib.h string.h termcap.h termio.h termios.h time.h unistd.h values.h sys/ioctl.h sys/stream.h sys/ptem.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+else
+  # Is the header compilable?
+echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_header_compiler=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_header_compiler=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6
+
+# Is the header present?
+echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <$ac_header>
+_ACEOF
+if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5
+  (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1
+  ac_status=$?
+  grep -v '^ *+' conftest.er1 >conftest.err
+  rm -f conftest.er1
+  cat conftest.err >&5
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } >/dev/null; then
+  if test -s conftest.err; then
+    ac_cpp_err=$ac_c_preproc_warn_flag
+  else
+    ac_cpp_err=
+  fi
+else
+  ac_cpp_err=yes
+fi
+if test -z "$ac_cpp_err"; then
+  ac_header_preproc=yes
+else
+  echo "$as_me: failed program was:" >&5
+  cat conftest.$ac_ext >&5
+  ac_header_preproc=no
 fi
+rm -f conftest.err conftest.$ac_ext
+echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6
+
+# So?  What about this header?
+case $ac_header_compiler:$ac_header_preproc in
+  yes:no )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};;
+  no:yes )
+    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;};;
+esac
+echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6
+if eval "test \"\${$as_ac_Header+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  eval "$as_ac_Header=$ac_header_preproc"
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
 
-echo $ac_n "checking for off_t""... $ac_c" 1>&6
-echo "configure:1673: checking for off_t" >&5
-if eval "test \"`echo '$''{'ac_cv_type_off_t'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+
+# Checks for typedefs, structures, and compiler characteristics.
+echo "$as_me:$LINENO: checking whether stat file-mode macros are broken" >&5
+echo $ECHO_N "checking whether stat file-mode macros are broken... $ECHO_C" >&6
+if test "${ac_cv_header_stat_broken+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 1678 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <sys/types.h>
-#if STDC_HEADERS
-#include <stdlib.h>
-#include <stddef.h>
+#include <sys/stat.h>
+
+#if defined(S_ISBLK) && defined(S_IFDIR)
+# if S_ISBLK (S_IFDIR)
+You lose.
+# endif
+#endif
+
+#if defined(S_ISBLK) && defined(S_IFCHR)
+# if S_ISBLK (S_IFCHR)
+You lose.
+# endif
+#endif
+
+#if defined(S_ISLNK) && defined(S_IFREG)
+# if S_ISLNK (S_IFREG)
+You lose.
+# endif
 #endif
-EOF
+
+#if defined(S_ISSOCK) && defined(S_IFREG)
+# if S_ISSOCK (S_IFREG)
+You lose.
+# endif
+#endif
+
+_ACEOF
 if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  egrep "(^|[^a-zA-Z_0-9])off_t[^a-zA-Z_0-9]" >/dev/null 2>&1; then
-  rm -rf conftest*
-  ac_cv_type_off_t=yes
+  $EGREP "You lose" >/dev/null 2>&1; then
+  ac_cv_header_stat_broken=yes
 else
-  rm -rf conftest*
-  ac_cv_type_off_t=no
+  ac_cv_header_stat_broken=no
 fi
 rm -f conftest*
 
 fi
-echo "$ac_t""$ac_cv_type_off_t" 1>&6
-if test $ac_cv_type_off_t = no; then
-  cat >> confdefs.h <<\EOF
+echo "$as_me:$LINENO: result: $ac_cv_header_stat_broken" >&5
+echo "${ECHO_T}$ac_cv_header_stat_broken" >&6
+if test $ac_cv_header_stat_broken = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STAT_MACROS_BROKEN 1
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5
+echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6
+if test "${ac_cv_c_const+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+
+int
+main ()
+{
+/* FIXME: Include the comments suggested by Paul. */
+#ifndef __cplusplus
+  /* Ultrix mips cc rejects this.  */
+  typedef int charset[2];
+  const charset x;
+  /* SunOS 4.1.1 cc rejects this.  */
+  char const *const *ccp;
+  char **p;
+  /* NEC SVR4.0.2 mips cc rejects this.  */
+  struct point {int x, y;};
+  static struct point const zero = {0,0};
+  /* AIX XL C 1.02.0.0 rejects this.
+     It does not let you subtract one const X* pointer from another in
+     an arm of an if-expression whose if-part is not a constant
+     expression */
+  const char *g = "string";
+  ccp = &g + (g ? g-g : 0);
+  /* HPUX 7.0 cc rejects these. */
+  ++ccp;
+  p = (char**) ccp;
+  ccp = (char const *const *) p;
+  { /* SCO 3.2v4 cc rejects this.  */
+    char *t;
+    char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+    *t++ = 0;
+  }
+  { /* Someone thinks the Sun supposedly-ANSI compiler will reject this.  */
+    int x[] = {25, 17};
+    const int *foo = &x[0];
+    ++foo;
+  }
+  { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+    typedef const int *iptr;
+    iptr p = 0;
+    ++p;
+  }
+  { /* AIX XL C 1.02.0.0 rejects this saying
+       "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+    struct s { int j; const int *ap[3]; };
+    struct s *b; b->j = 5;
+  }
+  { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+    const int foo = 10;
+  }
+#endif
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_c_const=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_c_const=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5
+echo "${ECHO_T}$ac_cv_c_const" >&6
+if test $ac_cv_c_const = no; then
+
+cat >>confdefs.h <<\_ACEOF
+#define const
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for off_t" >&5
+echo $ECHO_N "checking for off_t... $ECHO_C" >&6
+if test "${ac_cv_type_off_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+int
+main ()
+{
+if ((off_t *) 0)
+  return 0;
+if (sizeof (off_t))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_type_off_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_type_off_t=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5
+echo "${ECHO_T}$ac_cv_type_off_t" >&6
+if test $ac_cv_type_off_t = yes; then
+  :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define off_t long
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking for size_t" >&5
+echo $ECHO_N "checking for size_t... $ECHO_C" >&6
+if test "${ac_cv_type_size_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+int
+main ()
+{
+if ((size_t *) 0)
+  return 0;
+if (sizeof (size_t))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_type_size_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_type_size_t=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_size_t" >&5
+echo "${ECHO_T}$ac_cv_type_size_t" >&6
+if test $ac_cv_type_size_t = yes; then
+  :
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned
+_ACEOF
+
+fi
+
+echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
+echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
+if test "${ac_cv_header_time+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+#include <sys/types.h>
+#include <sys/time.h>
+#include <time.h>
+
+int
+main ()
+{
+if ((struct tm *) 0)
+return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_header_time=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_header_time=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
+echo "${ECHO_T}$ac_cv_header_time" >&6
+if test $ac_cv_header_time = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define TIME_WITH_SYS_TIME 1
+_ACEOF
+
+fi
+
+
+# Autoheader templates for symbols defined later by AC_DEFINE.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Checks for identifiers.
+echo "$as_me:$LINENO: checking for off_t" >&5
+echo $ECHO_N "checking for off_t... $ECHO_C" >&6
+if test "${ac_cv_type_off_t+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+#include "confdefs.h"
+$ac_includes_default
+int
+main ()
+{
+if ((off_t *) 0)
+  return 0;
+if (sizeof (off_t))
+  return 0;
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_type_off_t=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_type_off_t=no
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_type_off_t" >&5
+echo "${ECHO_T}$ac_cv_type_off_t" >&6
+if test $ac_cv_type_off_t = yes; then
+  :
+else
+
+cat >>confdefs.h <<_ACEOF
 #define off_t long
-EOF
+_ACEOF
 
 fi
 
-echo $ac_n "checking for void""... $ac_c" 1>&6
-echo "configure:1706: checking for void" >&5
-cat > conftest.$ac_ext <<EOF
-#line 1708 "configure"
+echo "$as_me:$LINENO: checking for void" >&5
+echo $ECHO_N "checking for void... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
-int main() {
+int
+main ()
+{
 void *foo = 0;
-; return 0; }
-EOF
-if { (eval echo configure:1715: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; cat >>confdefs.h <<\_ACEOF
 #define HAVE_VOID 1
-EOF
+_ACEOF
 
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  echo "$ac_t""no" 1>&6
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
-rm -f conftest*
-echo $ac_n "checking for const""... $ac_c" 1>&6
-echo "configure:1729: checking for const" >&5
-cat > conftest.$ac_ext <<EOF
-#line 1731 "configure"
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: checking for const" >&5
+echo $ECHO_N "checking for const... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
-int main() {
+int
+main ()
+{
 const int foo = 0;
-; return 0; }
-EOF
-if { (eval echo configure:1738: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; cat >>confdefs.h <<\_ACEOF
 #define HAVE_CONST 1
-EOF
+_ACEOF
 
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  echo "$ac_t""no" 1>&6
-fi
-rm -f conftest*
-echo $ac_n "checking for time_t""... $ac_c" 1>&6
-echo "configure:1752: checking for time_t" >&5
-cat > conftest.$ac_ext <<EOF
-#line 1754 "configure"
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+echo "$as_me:$LINENO: checking for time_t" >&5
+echo $ECHO_N "checking for time_t... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <time.h>
-int main() {
+int
+main ()
+{
 time_t t = 0;
-; return 0; }
-EOF
-if { (eval echo configure:1761: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
-  echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; cat >>confdefs.h <<\_ACEOF
 #define HAVE_TIME_T 1
-EOF
+_ACEOF
 
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  echo "$ac_t""no" 1>&6
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
 
-echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6
-echo "configure:1776: checking return type of signal handlers" >&5
-if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+# Checks for library functions.
+echo "$as_me:$LINENO: checking return type of signal handlers" >&5
+echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6
+if test "${ac_cv_type_signal+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 1781 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <sys/types.h>
 #include <signal.h>
 #ifdef signal
-#undef signal
+# undef signal
 #endif
 #ifdef __cplusplus
 extern "C" void (*signal (int, void (*)(int)))(int);
@@ -1790,167 +4410,235 @@
 void (*signal ()) ();
 #endif
 
-int main() {
+int
+main ()
+{
 int i;
-; return 0; }
-EOF
-if { (eval echo configure:1798: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
-  rm -rf conftest*
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   ac_cv_type_signal=void
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  ac_cv_type_signal=int
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_type_signal=int
 fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest.$ac_ext
 fi
+echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5
+echo "${ECHO_T}$ac_cv_type_signal" >&6
+
+cat >>confdefs.h <<_ACEOF
+#define RETSIGTYPE $ac_cv_type_signal
+_ACEOF
+
+
+
+
+
+
+
+
+
 
-echo "$ac_t""$ac_cv_type_signal" 1>&6
-cat >> confdefs.h <<EOF
-#define RETSIGTYPE $ac_cv_type_signal
-EOF
 
 
 for ac_func in fsync memcpy popen _setjmp sigprocmask sigsetmask stat strchr strstr system
 do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:1819: checking for $ac_func" >&5
-if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6
+if eval "test \"\${$as_ac_var+set}\" = set"; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 1824 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func(); below.  */
+    which can conflict with char $ac_func (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char $ac_func();
-
-int main() {
-
+   builtin and then its argument prototype would still apply.  */
+char $ac_func ();
+char (*f) ();
+
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_$ac_func) || defined (__stub___$ac_func)
 choke me
 #else
-$ac_func();
+f = $ac_func;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:1847: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_$ac_func=no"
-fi
-rm -f conftest*
-fi
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  eval "$as_ac_var=yes"
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+eval "$as_ac_var=no"
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+  cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
 
-if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-    ac_tr_func=HAVE_`echo $ac_func | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-  cat >> confdefs.h <<EOF
-#define $ac_tr_func 1
-EOF
- 
-else
-  echo "$ac_t""no" 1>&6
 fi
 done
 
 
-echo $ac_n "checking for tcgetattr""... $ac_c" 1>&6
-echo "configure:1873: checking for tcgetattr" >&5
-if eval "test \"`echo '$''{'ac_cv_func_tcgetattr'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+# Some systems have termios.h but not the corresponding functions.
+echo "$as_me:$LINENO: checking for tcgetattr" >&5
+echo $ECHO_N "checking for tcgetattr... $ECHO_C" >&6
+if test "${ac_cv_func_tcgetattr+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 1878 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char tcgetattr(); below.  */
+    which can conflict with char tcgetattr (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char tcgetattr();
-
-int main() {
-
+   builtin and then its argument prototype would still apply.  */
+char tcgetattr ();
+char (*f) ();
+
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_tcgetattr) || defined (__stub___tcgetattr)
 choke me
 #else
-tcgetattr();
+f = tcgetattr;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:1901: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_tcgetattr=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_tcgetattr=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'tcgetattr`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_tcgetattr=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_func_tcgetattr=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_tcgetattr" >&5
+echo "${ECHO_T}$ac_cv_func_tcgetattr" >&6
+if test $ac_cv_func_tcgetattr = yes; then
+  cat >>confdefs.h <<\_ACEOF
 #define HAVE_TERMIOS_FUNCS 1
-EOF
+_ACEOF
 
-else
-  echo "$ac_t""no" 1>&6
 fi
 
 
-echo $ac_n "checking for fileno""... $ac_c" 1>&6
-echo "configure:1925: checking for fileno" >&5
-cat > conftest.$ac_ext <<EOF
-#line 1927 "configure"
+echo "$as_me:$LINENO: checking for fileno" >&5
+echo $ECHO_N "checking for fileno... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #if HAVE_STDIO_H
 #include <stdio.h>
 #endif
-int main() {
+int
+main ()
+{
 static int x; x = fileno(stdin);
-; return 0; }
-EOF
-if { (eval echo configure:1937: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; cat >>confdefs.h <<\_ACEOF
 #define HAVE_FILENO 1
-EOF
+_ACEOF
 
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  echo "$ac_t""no" 1>&6
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 
-echo $ac_n "checking for strerror""... $ac_c" 1>&6
-echo "configure:1952: checking for strerror" >&5
-cat > conftest.$ac_ext <<EOF
-#line 1954 "configure"
+echo "$as_me:$LINENO: checking for strerror" >&5
+echo $ECHO_N "checking for strerror... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #if HAVE_STDIO_H
@@ -1962,211 +4650,332 @@
 #if HAVE_ERRNO_H
 #include <errno.h>
 #endif
-int main() {
+int
+main ()
+{
 static char *x; x = strerror(0);
-; return 0; }
-EOF
-if { (eval echo configure:1970: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; cat >>confdefs.h <<\_ACEOF
 #define HAVE_STRERROR 1
-EOF
+_ACEOF
 
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  echo "$ac_t""no" 1>&6
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 
-echo $ac_n "checking for sys_errlist""... $ac_c" 1>&6
-echo "configure:1985: checking for sys_errlist" >&5
-cat > conftest.$ac_ext <<EOF
-#line 1987 "configure"
+echo "$as_me:$LINENO: checking for sys_errlist" >&5
+echo $ECHO_N "checking for sys_errlist... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
-int main() {
+int
+main ()
+{
 extern char *sys_errlist[]; static char **x; x = sys_errlist;
-; return 0; }
-EOF
-if { (eval echo configure:1994: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; cat >>confdefs.h <<\_ACEOF
 #define HAVE_SYS_ERRLIST 1
-EOF
+_ACEOF
 
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  echo "$ac_t""no" 1>&6
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 
-echo $ac_n "checking for sigset_t""... $ac_c" 1>&6
-echo "configure:2009: checking for sigset_t" >&5
-cat > conftest.$ac_ext <<EOF
-#line 2011 "configure"
+echo "$as_me:$LINENO: checking for sigset_t" >&5
+echo $ECHO_N "checking for sigset_t... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #include <signal.h>
 
-int main() {
+int
+main ()
+{
 sigset_t s; s = 0;
-; return 0; }
-EOF
-if { (eval echo configure:2020: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; cat >>confdefs.h <<\_ACEOF
 #define HAVE_SIGSET_T 1
-EOF
+_ACEOF
 
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  echo "$ac_t""no" 1>&6
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 
-echo $ac_n "checking for sigemptyset""... $ac_c" 1>&6
-echo "configure:2035: checking for sigemptyset" >&5
-cat > conftest.$ac_ext <<EOF
-#line 2037 "configure"
+echo "$as_me:$LINENO: checking for sigemptyset" >&5
+echo $ECHO_N "checking for sigemptyset... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #include <signal.h>
 
-int main() {
+int
+main ()
+{
 sigset_t s; sigemptyset(&s);
-; return 0; }
-EOF
-if { (eval echo configure:2046: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; cat >>confdefs.h <<\_ACEOF
 #define HAVE_SIGEMPTYSET 1
-EOF
+_ACEOF
 
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  echo "$ac_t""no" 1>&6
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 
 have_errno=no
-echo $ac_n "checking for errno""... $ac_c" 1>&6
-echo "configure:2062: checking for errno" >&5
-cat > conftest.$ac_ext <<EOF
-#line 2064 "configure"
+echo "$as_me:$LINENO: checking for errno" >&5
+echo $ECHO_N "checking for errno... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #if HAVE_ERRNO_H
 #include <errno.h>
 #endif
-int main() {
+int
+main ()
+{
 static int x; x = errno;
-; return 0; }
-EOF
-if { (eval echo configure:2074: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  echo "$ac_t""yes - in errno.h" 1>&6; cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  echo "$as_me:$LINENO: result: yes - in errno.h" >&5
+echo "${ECHO_T}yes - in errno.h" >&6; cat >>confdefs.h <<\_ACEOF
 #define HAVE_ERRNO 1
-EOF
+_ACEOF
  have_errno=yes
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
 fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 if test $have_errno = no; then
-cat > conftest.$ac_ext <<EOF
-#line 2087 "configure"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #if HAVE_ERRNO_H
 #include <errno.h>
 #endif
-int main() {
+int
+main ()
+{
 extern int errno; static int x; x = errno;
-; return 0; }
-EOF
-if { (eval echo configure:2097: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  echo "$ac_t""yes - must define" 1>&6; cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  echo "$as_me:$LINENO: result: yes - must define" >&5
+echo "${ECHO_T}yes - must define" >&6; cat >>confdefs.h <<\_ACEOF
 #define HAVE_ERRNO 1
-EOF
- cat >> confdefs.h <<\EOF
+_ACEOF
+ cat >>confdefs.h <<\_ACEOF
 #define MUST_DEFINE_ERRNO 1
-EOF
+_ACEOF
 
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  echo "$ac_t""no" 1>&6
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
 
-echo $ac_n "checking for locale""... $ac_c" 1>&6
-echo "configure:2116: checking for locale" >&5
-cat > conftest.$ac_ext <<EOF
-#line 2118 "configure"
+echo "$as_me:$LINENO: checking for locale" >&5
+echo $ECHO_N "checking for locale... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 #include <locale.h>
 #include <ctype.h>
-int main() {
+int
+main ()
+{
 setlocale(LC_CTYPE,""); isprint(0); iscntrl(0);
-; return 0; }
-EOF
-if { (eval echo configure:2126: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; cat >>confdefs.h <<\_ACEOF
 #define HAVE_LOCALE 1
-EOF
+_ACEOF
 
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  echo "$ac_t""no" 1>&6
-fi
-rm -f conftest*
-echo $ac_n "checking for ctype functions""... $ac_c" 1>&6
-echo "configure:2140: checking for ctype functions" >&5
-cat > conftest.$ac_ext <<EOF
-#line 2142 "configure"
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+echo "$as_me:$LINENO: checking for ctype functions" >&5
+echo $ECHO_N "checking for ctype functions... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #if HAVE_CTYPE_H
 #include <ctype.h>
 #endif
-int main() {
+int
+main ()
+{
 static int x; x = isupper(x); x = tolower(x); x = toupper(x);
-; return 0; }
-EOF
-if { (eval echo configure:2152: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  echo "$ac_t""yes" 1>&6; cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; cat >>confdefs.h <<\_ACEOF
 #define HAVE_UPPER_LOWER 1
-EOF
+_ACEOF
 
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  echo "$ac_t""no" 1>&6
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 
+# Checks for external variable ospeed in the termcap library.
 have_ospeed=no
-echo $ac_n "checking termcap for ospeed""... $ac_c" 1>&6
-echo "configure:2168: checking termcap for ospeed" >&5
-cat > conftest.$ac_ext <<EOF
-#line 2170 "configure"
+echo "$as_me:$LINENO: checking termcap for ospeed" >&5
+echo $ECHO_N "checking termcap for ospeed... $ECHO_C" >&6
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -2176,68 +4985,101 @@
 #if HAVE_TERMCAP_H
 #include <termcap.h>
 #endif
-int main() {
+int
+main ()
+{
 ospeed = 0;
-; return 0; }
-EOF
-if { (eval echo configure:2184: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  echo "$ac_t""yes - in termcap.h" 1>&6; cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  echo "$as_me:$LINENO: result: yes - in termcap.h" >&5
+echo "${ECHO_T}yes - in termcap.h" >&6; cat >>confdefs.h <<\_ACEOF
 #define HAVE_OSPEED 1
-EOF
+_ACEOF
  have_ospeed=yes
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
 fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 if test $have_ospeed = no; then
-cat > conftest.$ac_ext <<EOF
-#line 2197 "configure"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
-int main() {
+int
+main ()
+{
 extern short ospeed; ospeed = 0;
-; return 0; }
-EOF
-if { (eval echo configure:2204: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  echo "$ac_t""yes - must define" 1>&6; cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  echo "$as_me:$LINENO: result: yes - must define" >&5
+echo "${ECHO_T}yes - must define" >&6; cat >>confdefs.h <<\_ACEOF
 #define HAVE_OSPEED 1
-EOF
- cat >> confdefs.h <<\EOF
+_ACEOF
+ cat >>confdefs.h <<\_ACEOF
 #define MUST_DEFINE_OSPEED 1
-EOF
+_ACEOF
 
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  echo "$ac_t""no" 1>&6
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
 
+# Checks for regular expression functions.
 have_regex=no
 have_posix_regex=unknown
-echo $ac_n "checking for regcomp""... $ac_c" 1>&6
-echo "configure:2225: checking for regcomp" >&5
+echo "$as_me:$LINENO: checking for regcomp" >&5
+echo $ECHO_N "checking for regcomp... $ECHO_C" >&6
 
 WANT_REGEX=auto
+
 # Check whether --with-regex or --without-regex was given.
 if test "${with_regex+set}" = set; then
   withval="$with_regex"
   WANT_REGEX="$withval"
-fi
-
+fi;
 
 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.
 if test "$cross_compiling" = yes; then
   have_posix_regex=unknown
 else
-  cat > conftest.$ac_ext <<EOF
-#line 2241 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
@@ -2251,98 +5093,138 @@
 if (rm.rm_sp != text + 1) exit(1); /* check for correct offset */
 #endif
 exit(0); }
-EOF
-if { (eval echo configure:2256: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
-then
+_ACEOF
+rm -f conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
   have_posix_regex=yes
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -fr conftest*
-  have_posix_regex=no
+  echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+( exit $ac_status )
+have_posix_regex=no
 fi
-rm -fr conftest*
+rm -f core core.* *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
 fi
-
 if test $have_posix_regex = yes; then
-  echo "$ac_t""using POSIX regcomp" 1>&6
-  cat >> confdefs.h <<\EOF
+  echo "$as_me:$LINENO: result: using POSIX regcomp" >&5
+echo "${ECHO_T}using POSIX regcomp" >&6
+  cat >>confdefs.h <<\_ACEOF
 #define HAVE_POSIX_REGCOMP 1
-EOF
+_ACEOF
 
   have_regex=yes
 elif test $have_posix_regex = unknown; then
-  cat > conftest.$ac_ext <<EOF
-#line 2277 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #include <sys/types.h>
 #include <regex.h>
-int main() {
+int
+main ()
+{
 regex_t *r; regfree(r);
-; return 0; }
-EOF
-if { (eval echo configure:2286: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  echo "$ac_t""using POSIX regcomp" 1>&6
-  cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  echo "$as_me:$LINENO: result: using POSIX regcomp" >&5
+echo "${ECHO_T}using POSIX regcomp" >&6
+  cat >>confdefs.h <<\_ACEOF
 #define HAVE_POSIX_REGCOMP 1
-EOF
+_ACEOF
  have_regex=yes
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
 fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 else
-  echo "$ac_t""no" 1>&6
+  echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
 fi
 fi
 fi
 
 if test $have_regex = no; then
 if test $WANT_REGEX = auto -o $WANT_REGEX = pcre; then
-echo $ac_n "checking for pcre_compile in -lpcre""... $ac_c" 1>&6
-echo "configure:2307: checking for pcre_compile in -lpcre" >&5
-ac_lib_var=`echo pcre'_'pcre_compile | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for pcre_compile in -lpcre" >&5
+echo $ECHO_N "checking for pcre_compile in -lpcre... $ECHO_C" >&6
+if test "${ac_cv_lib_pcre_pcre_compile+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  ac_save_LIBS="$LIBS"
+  ac_check_lib_save_LIBS=$LIBS
 LIBS="-lpcre  $LIBS"
-cat > conftest.$ac_ext <<EOF
-#line 2315 "configure"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
+
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char pcre_compile();
-
-int main() {
-pcre_compile()
-; return 0; }
-EOF
-if { (eval echo configure:2326: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  echo "$ac_t""using pcre" 1>&6; cat >> confdefs.h <<\EOF
+   builtin and then its argument prototype would still apply.  */
+char pcre_compile ();
+int
+main ()
+{
+pcre_compile ();
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_lib_pcre_pcre_compile=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_lib_pcre_pcre_compile=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+echo "$as_me:$LINENO: result: $ac_cv_lib_pcre_pcre_compile" >&5
+echo "${ECHO_T}$ac_cv_lib_pcre_pcre_compile" >&6
+if test $ac_cv_lib_pcre_pcre_compile = yes; then
+  echo "$as_me:$LINENO: result: using pcre" >&5
+echo "${ECHO_T}using pcre" >&6; cat >>confdefs.h <<\_ACEOF
 #define HAVE_PCRE 1
-EOF
+_ACEOF
  LIBS="$LIBS -lpcre" have_regex=yes
-else
-  echo "$ac_t""no" 1>&6
 fi
 
 fi
@@ -2350,55 +5232,70 @@
 
 if test $have_regex = no; then
 if test $WANT_REGEX = auto -o $WANT_REGEX = regcmp; then
-echo $ac_n "checking for regcmp""... $ac_c" 1>&6
-echo "configure:2355: checking for regcmp" >&5
-if eval "test \"`echo '$''{'ac_cv_func_regcmp'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: checking for regcmp" >&5
+echo $ECHO_N "checking for regcmp... $ECHO_C" >&6
+if test "${ac_cv_func_regcmp+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 2360 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char regcmp(); below.  */
+    which can conflict with char regcmp (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char regcmp();
-
-int main() {
-
+   builtin and then its argument prototype would still apply.  */
+char regcmp ();
+char (*f) ();
+
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_regcmp) || defined (__stub___regcmp)
 choke me
 #else
-regcmp();
+f = regcmp;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:2383: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_regcmp=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_regcmp=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'regcmp`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  echo "$ac_t""using regcmp" 1>&6; cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_regcmp=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_func_regcmp=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_regcmp" >&5
+echo "${ECHO_T}$ac_cv_func_regcmp" >&6
+if test $ac_cv_func_regcmp = yes; then
+  echo "$as_me:$LINENO: result: using regcmp" >&5
+echo "${ECHO_T}using regcmp" >&6; cat >>confdefs.h <<\_ACEOF
 #define HAVE_REGCMP 1
-EOF
+_ACEOF
  have_regex=yes
-else
-  echo "$ac_t""no" 1>&6
 fi
 
 fi
@@ -2406,469 +5303,1209 @@
 
 if test $have_regex = no; then
 if test $WANT_REGEX = auto -o $WANT_REGEX = regcomp; then
-cat > conftest.$ac_ext <<EOF
-#line 2411 "configure"
+cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 
 #include "regexp.h"
-int main() {
+int
+main ()
+{
 regcomp("");
-; return 0; }
-EOF
-if { (eval echo configure:2419: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  echo "$ac_t""using V8 regcomp" 1>&6; cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  echo "$as_me:$LINENO: result: using V8 regcomp" >&5
+echo "${ECHO_T}using V8 regcomp" >&6; cat >>confdefs.h <<\_ACEOF
 #define HAVE_V8_REGCOMP 1
-EOF
+_ACEOF
  have_regex=yes
 else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
 fi
-rm -f conftest*
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
 fi
 fi
 
 if test $have_regex = no && test -f ${srcdir}/regexp.c; then
 if test $WANT_REGEX = auto -o $WANT_REGEX = regcomp-local; then
-echo "$ac_t""using V8 regcomp -- local source" 1>&6; cat >> confdefs.h <<\EOF
+echo "$as_me:$LINENO: result: using V8 regcomp -- local source" >&5
+echo "${ECHO_T}using V8 regcomp -- local source" >&6; cat >>confdefs.h <<\_ACEOF
 #define HAVE_V8_REGCOMP 1
-EOF
- cat >> confdefs.h <<\EOF
+_ACEOF
+ cat >>confdefs.h <<\_ACEOF
 #define HAVE_REGEXEC2 1
-EOF
+_ACEOF
  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
-echo "$ac_t""using re_comp" 1>&6; echo $ac_n "checking for re_comp""... $ac_c" 1>&6
-echo "configure:2448: checking for re_comp" >&5
-if eval "test \"`echo '$''{'ac_cv_func_re_comp'+set}'`\" = set"; then
-  echo $ac_n "(cached) $ac_c" 1>&6
+echo "$as_me:$LINENO: result: using re_comp" >&5
+echo "${ECHO_T}using re_comp" >&6; echo "$as_me:$LINENO: checking for re_comp" >&5
+echo $ECHO_N "checking for re_comp... $ECHO_C" >&6
+if test "${ac_cv_func_re_comp+set}" = set; then
+  echo $ECHO_N "(cached) $ECHO_C" >&6
 else
-  cat > conftest.$ac_ext <<EOF
-#line 2453 "configure"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char re_comp(); below.  */
+    which can conflict with char re_comp (); below.  */
 #include <assert.h>
 /* Override any gcc2 internal prototype to avoid an error.  */
+#ifdef __cplusplus
+extern "C"
+#endif
 /* We use char because int might match the return type of a gcc2
-    builtin and then its argument prototype would still apply.  */
-char re_comp();
-
-int main() {
-
+   builtin and then its argument prototype would still apply.  */
+char re_comp ();
+char (*f) ();
+
+int
+main ()
+{
 /* The GNU C library defines this for functions which it implements
     to always fail with ENOSYS.  Some functions are actually named
     something starting with __ and the normal name is an alias.  */
 #if defined (__stub_re_comp) || defined (__stub___re_comp)
 choke me
 #else
-re_comp();
+f = re_comp;
 #endif
 
-; return 0; }
-EOF
-if { (eval echo configure:2476: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
-  rm -rf conftest*
-  eval "ac_cv_func_re_comp=yes"
-else
-  echo "configure: failed program was:" >&5
-  cat conftest.$ac_ext >&5
-  rm -rf conftest*
-  eval "ac_cv_func_re_comp=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'re_comp`\" = yes"; then
-  echo "$ac_t""yes" 1>&6
-  cat >> confdefs.h <<\EOF
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext conftest$ac_exeext
+if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+  (eval $ac_link) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest$ac_exeext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+  ac_cv_func_re_comp=yes
+else
+  echo "$as_me: failed program was:" >&5
+cat conftest.$ac_ext >&5
+ac_cv_func_re_comp=no
+fi
+rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
+fi
+echo "$as_me:$LINENO: result: $ac_cv_func_re_comp" >&5
+echo "${ECHO_T}$ac_cv_func_re_comp" >&6
+if test $ac_cv_func_re_comp = yes; then
+  cat >>confdefs.h <<\_ACEOF
 #define HAVE_RE_COMP 1
-EOF
+_ACEOF
  have_regex=yes
-else
-  echo "$ac_t""no" 1>&6
 fi
 
 fi
 fi
 
 if test $have_regex = no; then
-echo "$ac_t""cannot find regular expression library" 1>&6; cat >> confdefs.h <<\EOF
+echo "$as_me:$LINENO: result: cannot find regular expression library" >&5
+echo "${ECHO_T}cannot find regular expression library" >&6; cat >>confdefs.h <<\_ACEOF
 #define NO_REGEX 1
-EOF
+_ACEOF
 
 fi
 
+
 # Check whether --with-editor or --without-editor was given.
 if test "${with_editor+set}" = set; then
   withval="$with_editor"
-  cat >> confdefs.h <<EOF
+  cat >>confdefs.h <<_ACEOF
 #define EDIT_PGM "$withval"
-EOF
+_ACEOF
+
+else
+  cat >>confdefs.h <<\_ACEOF
+#define EDIT_PGM "vi"
+_ACEOF
+
+fi;
 
-fi
 
 
-trap '' 1 2 15
-cat > confcache <<\EOF
+
+          ac_config_files="$ac_config_files Makefile"
+
+cat >confcache <<\_ACEOF
 # This file is a shell script that caches the results of configure
 # tests run on this system so they can be shared between configure
-# scripts and configure runs.  It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems.  If it contains results you don't
+# want to keep, you may remove or edit it.
 #
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already.  You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
 #
-EOF
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
 # The following way of writing the cache mishandles newlines in values,
 # but we know of no workaround that is simple, portable, and efficient.
 # So, don't put newlines in cache variables' values.
 # Ultrix sh set writes to stderr and can't be redirected directly,
 # and sets the high bit in the cache file unless we assign to the vars.
-(set) 2>&1 |
-  case `(ac_space=' '; set | grep ac_space) 2>&1` in
-  *ac_space=\ *)
-    # `set' does not quote correctly, so add quotes (double-quote substitution
-    # turns \\\\ into \\, and sed turns \\ into \).
-    sed -n \
-      -e "s/'/'\\\\''/g" \
-      -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
-    ;;
-  *)
-    # `set' quotes correctly as required by POSIX, so do not add quotes.
-    sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
-    ;;
-  esac >> confcache
-if cmp -s $cache_file confcache; then
-  :
-else
+{
+  (set) 2>&1 |
+    case `(ac_space=' '; set | grep ac_space) 2>&1` in
+    *ac_space=\ *)
+      # `set' does not quote correctly, so add quotes (double-quote
+      # substitution turns \\\\ into \\, and sed turns \\ into \).
+      sed -n \
+        "s/'/'\\\\''/g;
+    	  s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+      ;;
+    *)
+      # `set' quotes correctly as required by POSIX, so do not add quotes.
+      sed -n \
+        "s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1=\\2/p"
+      ;;
+    esac;
+} |
+  sed '
+     t clear
+     : clear
+     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+     t end
+     /^ac_cv_env/!s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+     : end' >>confcache
+if cmp -s $cache_file confcache; then :; else
   if test -w $cache_file; then
-    echo "updating cache $cache_file"
-    cat confcache > $cache_file
+    test "x$cache_file" != "x/dev/null" && echo "updating cache $cache_file"
+    cat confcache >$cache_file
   else
     echo "not updating unwritable cache $cache_file"
   fi
 fi
 rm -f confcache
 
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
 test "x$prefix" = xNONE && prefix=$ac_default_prefix
 # Let make expand exec_prefix.
 test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
 
-# Any assignment to VPATH causes Sun make to only execute
-# the first set of double-colon rules, so remove it if not needed.
-# If there is a colon in the path, we need to keep it.
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
 if test "x$srcdir" = x.; then
-  ac_vpsub='/^[ 	]*VPATH[ 	]*=[^:]*$/d'
+  ac_vpsub='/^[ 	]*VPATH[ 	]*=/{
+s/:*\$(srcdir):*/:/;
+s/:*\${srcdir}:*/:/;
+s/:*@srcdir@:*/:/;
+s/^\([^=]*=[ 	]*\):*/\1/;
+s/:*$//;
+s/^[^=]*=[ 	]*$//;
+}'
 fi
 
-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
-
 DEFS=-DHAVE_CONFIG_H
 
-# Without the "./", some shells look in PATH for config.status.
-: ${CONFIG_STATUS=./config.status}
+ac_libobjs=
+ac_ltlibobjs=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+  # 1. Remove the extension, and $U if already installed.
+  ac_i=`echo "$ac_i" |
+         sed 's/\$U\././;s/\.o$//;s/\.obj$//'`
+  # 2. Add them.
+  ac_libobjs="$ac_libobjs $ac_i\$U.$ac_objext"
+  ac_ltlibobjs="$ac_ltlibobjs $ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
 
-echo creating $CONFIG_STATUS
-rm -f $CONFIG_STATUS
-cat > $CONFIG_STATUS <<EOF
-#! /bin/sh
-# Generated automatically by configure.
+LTLIBOBJS=$ac_ltlibobjs
+
+
+
+: ${CONFIG_STATUS=./config.status}
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
+#! $SHELL
+# Generated by $as_me.
 # Run this file to recreate the current configuration.
-# This directory was configured as follows,
-# on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-#
-# $0 $ac_configure_args
-#
 # Compiler output produced by configure, useful for debugging
-# configure, is in ./config.log if it exists.
+# configure, is in config.log if it exists.
 
-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-for ac_option
+debug=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization.  ##
+## --------------------- ##
+
+# Be Bourne compatible
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+  emulate sh
+  NULLCMD=:
+  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+  # is contrary to our usage.  Disable this feature.
+  alias -g '${1+"$@"}'='"$@"'
+elif test -n "${BASH_VERSION+set}" && (set -o posix) >/dev/null 2>&1; then
+  set -o posix
+fi
+
+# Support unset when possible.
+if (FOO=FOO; unset FOO) >/dev/null 2>&1; then
+  as_unset=unset
+else
+  as_unset=false
+fi
+
+
+# Work around bugs in pre-3.0 UWIN ksh.
+$as_unset ENV MAIL MAILPATH
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+for as_var in LANG LANGUAGE LC_ALL LC_COLLATE LC_CTYPE LC_NUMERIC LC_MESSAGES LC_TIME
+do
+  if (set +x; test -n "`(eval $as_var=C; export $as_var) 2>&1`"); then
+    eval $as_var=C; export $as_var
+  else
+    $as_unset $as_var
+  fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+if (basename /) >/dev/null 2>&1 && test "X`basename / 2>&1`" = "X/"; then
+  as_basename=basename
+else
+  as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+	 X"$0" : 'X\(//\)$' \| \
+	 X"$0" : 'X\(/\)$' \| \
+	 .     : '\(.\)' 2>/dev/null ||
+echo X/"$0" |
+    sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/; q; }
+  	  /^X\/\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\/\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+
+
+# PATH needs CR, and LINENO needs CR and PATH.
+# 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
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+  echo "#! /bin/sh" >conftest.sh
+  echo  "exit 0"   >>conftest.sh
+  chmod +x conftest.sh
+  if (PATH="/nonexistent;."; conftest.sh) >/dev/null 2>&1; then
+    PATH_SEPARATOR=';'
+  else
+    PATH_SEPARATOR=:
+  fi
+  rm -f conftest.sh
+fi
+
+
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2"  || {
+  # Find who we are.  Look in the path if we contain no path at all
+  # relative or not.
+  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
+
+       ;;
+  esac
+  # We did not find ourselves, most probably we were run as `sh COMMAND'
+  # in which case we are not to be found in the path.
+  if test "x$as_myself" = x; then
+    as_myself=$0
+  fi
+  if test ! -f "$as_myself"; then
+    { { echo "$as_me:$LINENO: error: cannot find myself; rerun with an absolute path" >&5
+echo "$as_me: error: cannot find myself; rerun with an absolute path" >&2;}
+   { (exit 1); exit 1; }; }
+  fi
+  case $CONFIG_SHELL in
+  '')
+    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+  IFS=$as_save_IFS
+  test -z "$as_dir" && as_dir=.
+  for as_base in sh bash ksh sh5; do
+	 case $as_dir in
+	 /*)
+	   if ("$as_dir/$as_base" -c '
+  as_lineno_1=$LINENO
+  as_lineno_2=$LINENO
+  as_lineno_3=`(expr $as_lineno_1 + 1) 2>/dev/null`
+  test "x$as_lineno_1" != "x$as_lineno_2" &&
+  test "x$as_lineno_3"  = "x$as_lineno_2" ') 2>/dev/null; then
+	     $as_unset BASH_ENV || test "${BASH_ENV+set}" != set || { BASH_ENV=; export BASH_ENV; }
+	     $as_unset ENV || test "${ENV+set}" != set || { ENV=; export ENV; }
+	     CONFIG_SHELL=$as_dir/$as_base
+	     export CONFIG_SHELL
+	     exec "$CONFIG_SHELL" "$0" ${1+"$@"}
+	   fi;;
+	 esac
+       done
+done
+;;
+  esac
+
+  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+  # uniformly replaced by the line number.  The first 'sed' inserts a
+  # line-number line before each line; the second 'sed' does the real
+  # work.  The second script uses 'N' to pair each line-number line
+  # with the numbered line, and appends trailing '-' during
+  # substitution so that $LINENO is not a special case at line end.
+  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+  # second 'sed' script.  Blame Lee E. McMahon for sed's syntax.  :-)
+  sed '=' <$as_myself |
+    sed '
+      N
+      s,$,-,
+      : loop
+      s,^\(['$as_cr_digits']*\)\(.*\)[$]LINENO\([^'$as_cr_alnum'_]\),\1\2\1\3,
+      t loop
+      s,-$,,
+      s,^['$as_cr_digits']*\n,,
+    ' >$as_me.lineno &&
+  chmod +x $as_me.lineno ||
+    { { echo "$as_me:$LINENO: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&5
+echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2;}
+   { (exit 1); exit 1; }; }
+
+  # Don't try to exec as it changes $[0], causing all sort of problems
+  # (the dirname of $[0] is not the place where we might find the
+  # original and so on.  Autoconf is especially sensible to this).
+  . ./$as_me.lineno
+  # Exit status is that of the last command.
+  exit
+}
+
+
+case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in
+  *c*,-n*) ECHO_N= ECHO_C='
+' ECHO_T='	' ;;
+  *c*,*  ) ECHO_N=-n ECHO_C= ECHO_T= ;;
+  *)       ECHO_N= ECHO_C='\c' ECHO_T= ;;
+esac
+
+if expr a : '\(a\)' >/dev/null 2>&1; then
+  as_expr=expr
+else
+  as_expr=false
+fi
+
+rm -f conf$$ conf$$.exe conf$$.file
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conf$$.exe; then
+    # Don't use ln at all; we don't have any links
+    as_ln_s='cp -p'
+  else
+    as_ln_s='ln -s'
+  fi
+elif ln conf$$.file conf$$ 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conf$$ conf$$.exe conf$$.file
+
+if mkdir -p . 2>/dev/null; then
+  as_mkdir_p=:
+else
+  as_mkdir_p=false
+fi
+
+as_executable_p="test -f"
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="sed y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="sed y%*+%pp%;s%[^_$as_cr_alnum]%_%g"
+
+
+# IFS
+# We need space, tab and new line, in precisely that order.
+as_nl='
+'
+IFS=" 	$as_nl"
+
+# CDPATH.
+$as_unset CDPATH
+
+exec 6>&1
+
+# Open the log real soon, to keep \$[0] and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.  Logging --version etc. is OK.
+exec 5>>config.log
+{
+  echo
+  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+} >&5
+cat >&5 <<_CSEOF
+
+This file was extended by less $as_me 1, which was
+generated by GNU Autoconf 2.54.  Invocation command line was
+
+  CONFIG_FILES    = $CONFIG_FILES
+  CONFIG_HEADERS  = $CONFIG_HEADERS
+  CONFIG_LINKS    = $CONFIG_LINKS
+  CONFIG_COMMANDS = $CONFIG_COMMANDS
+  $ $0 $@
+
+_CSEOF
+echo "on `(hostname || uname -n) 2>/dev/null | sed 1q`" >&5
+echo >&5
+_ACEOF
+
+# Files that config.status was made for.
+if test -n "$ac_config_files"; then
+  echo "config_files=\"$ac_config_files\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_headers"; then
+  echo "config_headers=\"$ac_config_headers\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_links"; then
+  echo "config_links=\"$ac_config_links\"" >>$CONFIG_STATUS
+fi
+
+if test -n "$ac_config_commands"; then
+  echo "config_commands=\"$ac_config_commands\"" >>$CONFIG_STATUS
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+ac_cs_usage="\
+\`$as_me' instantiates files from templates according to the
+current configuration.
+
+Usage: $0 [OPTIONS] [FILE]...
+
+  -h, --help       print this help, then exit
+  -V, --version    print version number, then exit
+  -d, --debug      don't remove temporary files
+      --recheck    update $as_me by reconfiguring in the same conditions
+  --file=FILE[:TEMPLATE]
+                   instantiate the configuration file FILE
+  --header=FILE[:TEMPLATE]
+                   instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Report bugs to <bug-autoconf at gnu.org>."
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+ac_cs_version="\\
+less config.status 1
+configured by $0, generated by GNU Autoconf 2.54,
+  with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\"
+
+Copyright 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001
+Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+srcdir=$srcdir
+INSTALL="$INSTALL"
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value.  By we need to know if files were specified by the user.
+ac_need_defaults=:
+while test $# != 0
 do
-  case "\$ac_option" in
+  case $1 in
+  --*=*)
+    ac_option=`expr "x$1" : 'x\([^=]*\)='`
+    ac_optarg=`expr "x$1" : 'x[^=]*=\(.*\)'`
+    ac_shift=:
+    ;;
+  -*)
+    ac_option=$1
+    ac_optarg=$2
+    ac_shift=shift
+    ;;
+  *) # This is not an option, so the user has probably given explicit
+     # arguments.
+     ac_option=$1
+     ac_need_defaults=false;;
+  esac
+
+  case $ac_option in
+  # Handling of the options.
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
   -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
-    echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
-    exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
-  -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
-    echo "$CONFIG_STATUS generated by autoconf version 2.13"
-    exit 0 ;;
-  -help | --help | --hel | --he | --h)
-    echo "\$ac_cs_usage"; exit 0 ;;
-  *) echo "\$ac_cs_usage"; exit 1 ;;
+    echo "running $SHELL $0 " $ac_configure_args " --no-create --no-recursion"
+    exec $SHELL $0 $ac_configure_args --no-create --no-recursion ;;
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+  --version | --vers* | -V )
+    echo "$ac_cs_version"; exit 0 ;;
+  --he | --h)
+    # Conflict between --help and --header
+    { { echo "$as_me:$LINENO: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2;}
+   { (exit 1); exit 1; }; };;
+  --help | --hel | -h )
+    echo "$ac_cs_usage"; exit 0 ;;
+  --debug | --d* | -d )
+    debug=: ;;
+  --file | --fil | --fi | --f )
+    $ac_shift
+    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+    ac_need_defaults=false;;
+  --header | --heade | --head | --hea )
+    $ac_shift
+    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+    ac_need_defaults=false;;
+
+  # This is an error.
+  -*) { { echo "$as_me:$LINENO: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&5
+echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2;}
+   { (exit 1); exit 1; }; } ;;
+
+  *) ac_config_targets="$ac_config_targets $1" ;;
+
   esac
+  shift
 done
 
-ac_given_srcdir=$srcdir
-ac_given_INSTALL="$INSTALL"
+_ACEOF
 
-trap 'rm -fr `echo "Makefile defines.h" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
-EOF
-cat >> $CONFIG_STATUS <<EOF
-
-# Protect against being on the right side of a sed subst in config.status.
-sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g;
- s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF
-$ac_vpsub
-$extrasub
-s%@SHELL@%$SHELL%g
-s%@CFLAGS@%$CFLAGS%g
-s%@CPPFLAGS@%$CPPFLAGS%g
-s%@CXXFLAGS@%$CXXFLAGS%g
-s%@FFLAGS@%$FFLAGS%g
-s%@DEFS@%$DEFS%g
-s%@LDFLAGS@%$LDFLAGS%g
-s%@LIBS@%$LIBS%g
-s%@exec_prefix@%$exec_prefix%g
-s%@prefix@%$prefix%g
-s%@program_transform_name@%$program_transform_name%g
-s%@bindir@%$bindir%g
-s%@sbindir@%$sbindir%g
-s%@libexecdir@%$libexecdir%g
-s%@datadir@%$datadir%g
-s%@sysconfdir@%$sysconfdir%g
-s%@sharedstatedir@%$sharedstatedir%g
-s%@localstatedir@%$localstatedir%g
-s%@libdir@%$libdir%g
-s%@includedir@%$includedir%g
-s%@oldincludedir@%$oldincludedir%g
-s%@infodir@%$infodir%g
-s%@mandir@%$mandir%g
-s%@CC@%$CC%g
-s%@CPP@%$CPP%g
-s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g
-s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g
-s%@INSTALL_DATA@%$INSTALL_DATA%g
-s%@REGEX_O@%$REGEX_O%g
 
+
+
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_config_target in $ac_config_targets
+do
+  case "$ac_config_target" in
+  # Handling of arguments.
+  "Makefile" ) CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+  "defines.h" ) CONFIG_HEADERS="$CONFIG_HEADERS defines.h" ;;
+  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+   { (exit 1); exit 1; }; };;
+  esac
+done
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used.  Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+fi
+
+# Create a temporary directory, and hook for its removal unless debugging.
+$debug ||
+{
+  trap 'exit_status=$?; rm -rf $tmp && exit $exit_status' 0
+  trap '{ (exit 1); exit 1; }' 1 2 13 15
+}
+
+# Create a (secure) tmp directory for tmp files.
+: ${TMPDIR=/tmp}
+{
+  tmp=`(umask 077 && mktemp -d -q "$TMPDIR/csXXXXXX") 2>/dev/null` &&
+  test -n "$tmp" && test -d "$tmp"
+}  ||
+{
+  tmp=$TMPDIR/cs$$-$RANDOM
+  (umask 077 && mkdir $tmp)
+} ||
+{
+   echo "$me: cannot create a temporary directory in $TMPDIR" >&2
+   { (exit 1); exit 1; }
+}
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<_ACEOF
+
+#
+# CONFIG_FILES section.
+#
+
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "\$CONFIG_FILES"; then
+  # Protect against being on the right side of a sed subst in config.status.
+  sed 's/,@/@@/; s/@,/@@/; s/,;t t\$/@;t t/; /@;t t\$/s/[\\\\&,]/\\\\&/g;
+   s/@@/,@/; s/@@/@,/; s/@;t t\$/,;t t/' >\$tmp/subs.sed <<\\CEOF
+s, at SHELL@,$SHELL,;t t
+s, at PATH_SEPARATOR@,$PATH_SEPARATOR,;t t
+s, at PACKAGE_NAME@,$PACKAGE_NAME,;t t
+s, at PACKAGE_TARNAME@,$PACKAGE_TARNAME,;t t
+s, at PACKAGE_VERSION@,$PACKAGE_VERSION,;t t
+s, at PACKAGE_STRING@,$PACKAGE_STRING,;t t
+s, at PACKAGE_BUGREPORT@,$PACKAGE_BUGREPORT,;t t
+s, at exec_prefix@,$exec_prefix,;t t
+s, at prefix@,$prefix,;t t
+s, at program_transform_name@,$program_transform_name,;t t
+s, at bindir@,$bindir,;t t
+s, at sbindir@,$sbindir,;t t
+s, at libexecdir@,$libexecdir,;t t
+s, at datadir@,$datadir,;t t
+s, at sysconfdir@,$sysconfdir,;t t
+s, at sharedstatedir@,$sharedstatedir,;t t
+s, at localstatedir@,$localstatedir,;t t
+s, at libdir@,$libdir,;t t
+s, at includedir@,$includedir,;t t
+s, at oldincludedir@,$oldincludedir,;t t
+s, at infodir@,$infodir,;t t
+s, at mandir@,$mandir,;t t
+s, at build_alias@,$build_alias,;t t
+s, at host_alias@,$host_alias,;t t
+s, at target_alias@,$target_alias,;t t
+s, at DEFS@,$DEFS,;t t
+s, at ECHO_C@,$ECHO_C,;t t
+s, at ECHO_N@,$ECHO_N,;t t
+s, at ECHO_T@,$ECHO_T,;t t
+s, at LIBS@,$LIBS,;t t
+s, at CC@,$CC,;t t
+s, at CFLAGS@,$CFLAGS,;t t
+s, at LDFLAGS@,$LDFLAGS,;t t
+s, at CPPFLAGS@,$CPPFLAGS,;t t
+s, at ac_ct_CC@,$ac_ct_CC,;t t
+s, at EXEEXT@,$EXEEXT,;t t
+s, at OBJEXT@,$OBJEXT,;t t
+s, at CPP@,$CPP,;t t
+s, at EGREP@,$EGREP,;t t
+s, at INSTALL_PROGRAM@,$INSTALL_PROGRAM,;t t
+s, at INSTALL_SCRIPT@,$INSTALL_SCRIPT,;t t
+s, at INSTALL_DATA@,$INSTALL_DATA,;t t
+s, at REGEX_O@,$REGEX_O,;t t
+s, at LIBOBJS@,$LIBOBJS,;t t
+s, at LTLIBOBJS@,$LTLIBOBJS,;t t
 CEOF
-EOF
 
-cat >> $CONFIG_STATUS <<\EOF
+_ACEOF
 
-# Split the substitutions into bite-sized pieces for seds with
-# small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
-ac_file=1 # Number of current file.
-ac_beg=1 # First line for current file.
-ac_end=$ac_max_sed_cmds # Line after last line for current file.
-ac_more_lines=:
-ac_sed_cmds=""
-while $ac_more_lines; do
-  if test $ac_beg -gt 1; then
-    sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
-  else
-    sed "${ac_end}q" conftest.subs > conftest.s$ac_file
-  fi
-  if test ! -s conftest.s$ac_file; then
-    ac_more_lines=false
-    rm -f conftest.s$ac_file
-  else
-    if test -z "$ac_sed_cmds"; then
-      ac_sed_cmds="sed -f conftest.s$ac_file"
+  cat >>$CONFIG_STATUS <<\_ACEOF
+  # Split the substitutions into bite-sized pieces for seds with
+  # small command number limits, like on Digital OSF/1 and HP-UX.
+  ac_max_sed_lines=48
+  ac_sed_frag=1 # Number of current file.
+  ac_beg=1 # First line for current file.
+  ac_end=$ac_max_sed_lines # Line after last line for current file.
+  ac_more_lines=:
+  ac_sed_cmds=
+  while $ac_more_lines; do
+    if test $ac_beg -gt 1; then
+      sed "1,${ac_beg}d; ${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+    else
+      sed "${ac_end}q" $tmp/subs.sed >$tmp/subs.frag
+    fi
+    if test ! -s $tmp/subs.frag; then
+      ac_more_lines=false
     else
-      ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
+      # The purpose of the label and of the branching condition is to
+      # speed up the sed processing (if there are no `@' at all, there
+      # is no need to browse any of the substitutions).
+      # These are the two extra sed commands mentioned above.
+      (echo ':t
+  /@[a-zA-Z_][a-zA-Z_0-9]*@/!b' && cat $tmp/subs.frag) >$tmp/subs-$ac_sed_frag.sed
+      if test -z "$ac_sed_cmds"; then
+  	ac_sed_cmds="sed -f $tmp/subs-$ac_sed_frag.sed"
+      else
+  	ac_sed_cmds="$ac_sed_cmds | sed -f $tmp/subs-$ac_sed_frag.sed"
+      fi
+      ac_sed_frag=`expr $ac_sed_frag + 1`
+      ac_beg=$ac_end
+      ac_end=`expr $ac_end + $ac_max_sed_lines`
     fi
-    ac_file=`expr $ac_file + 1`
-    ac_beg=$ac_end
-    ac_end=`expr $ac_end + $ac_max_sed_cmds`
+  done
+  if test -z "$ac_sed_cmds"; then
+    ac_sed_cmds=cat
   fi
-done
-if test -z "$ac_sed_cmds"; then
-  ac_sed_cmds=cat
-fi
-EOF
+fi # test -n "$CONFIG_FILES"
 
-cat >> $CONFIG_STATUS <<EOF
-
-CONFIG_FILES=\${CONFIG_FILES-"Makefile"}
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+for ac_file in : $CONFIG_FILES; do test "x$ac_file" = x: && continue
   # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
-  case "$ac_file" in
-  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
-       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
-  *) ac_file_in="${ac_file}.in" ;;
+  case $ac_file in
+  - | *:- | *:-:* ) # input from stdin
+        cat >$tmp/stdin
+        ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+        ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+        ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  * )   ac_file_in=$ac_file.in ;;
   esac
 
-  # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
-
-  # Remove last slash and all that follows it.  Not all systems have dirname.
-  ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
-  if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
-    # The file is in a subdirectory.
-    test ! -d "$ac_dir" && mkdir "$ac_dir"
-    ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
-    # A "../" for each directory in $ac_dir_suffix.
-    ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
-  else
-    ac_dir_suffix= ac_dots=
-  fi
-
-  case "$ac_given_srcdir" in
-  .)  srcdir=.
-      if test -z "$ac_dots"; then top_srcdir=.
-      else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
-  /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
+  # Compute @srcdir@, @top_srcdir@, and @INSTALL@ for subdirectories.
+  ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+         X"$ac_file" : 'X\(//\)[^/]' \| \
+         X"$ac_file" : 'X\(//\)$' \| \
+         X"$ac_file" : 'X\(/\)' \| \
+         .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+  { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+         X"$as_dir" : 'X\(//\)[^/]' \| \
+         X"$as_dir" : 'X\(//\)$' \| \
+         X"$as_dir" : 'X\(/\)' \| \
+         .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
+
+  ac_builddir=.
+
+if test "$ac_dir" != .; then
+  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+  # A "../" for each directory in $ac_dir_suffix.
+  ac_top_builddir=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,../,g'`
+else
+  ac_dir_suffix= ac_top_builddir=
+fi
+
+case $srcdir in
+  .)  # No --srcdir option.  We are building in place.
+    ac_srcdir=.
+    if test -z "$ac_top_builddir"; then
+       ac_top_srcdir=.
+    else
+       ac_top_srcdir=`echo $ac_top_builddir | sed 's,/$,,'`
+    fi ;;
+  [\\/]* | ?:[\\/]* )  # Absolute path.
+    ac_srcdir=$srcdir$ac_dir_suffix;
+    ac_top_srcdir=$srcdir ;;
   *) # Relative path.
-    srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
-    top_srcdir="$ac_dots$ac_given_srcdir" ;;
-  esac
+    ac_srcdir=$ac_top_builddir$srcdir$ac_dir_suffix
+    ac_top_srcdir=$ac_top_builddir$srcdir ;;
+esac
+# Don't blindly perform a `cd "$ac_dir"/$ac_foo && pwd` since $ac_foo can be
+# absolute.
+ac_abs_builddir=`cd "$ac_dir" && cd $ac_builddir && pwd`
+ac_abs_top_builddir=`cd "$ac_dir" && cd ${ac_top_builddir}. && pwd`
+ac_abs_srcdir=`cd "$ac_dir" && cd $ac_srcdir && pwd`
+ac_abs_top_srcdir=`cd "$ac_dir" && cd $ac_top_srcdir && pwd`
 
-  case "$ac_given_INSTALL" in
-  [/$]*) INSTALL="$ac_given_INSTALL" ;;
-  *) INSTALL="$ac_dots$ac_given_INSTALL" ;;
-  esac
 
-  echo creating "$ac_file"
-  rm -f "$ac_file"
-  configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
-  case "$ac_file" in
-  *Makefile*) ac_comsub="1i\\
-# $configure_input" ;;
-  *) ac_comsub= ;;
+  case $INSTALL in
+  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+  *) ac_INSTALL=$ac_top_builddir$INSTALL ;;
   esac
 
-  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
-  sed -e "$ac_comsub
-s%@configure_input@%$configure_input%g
-s%@srcdir@%$srcdir%g
-s%@top_srcdir@%$top_srcdir%g
-s%@INSTALL@%$INSTALL%g
-" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
-fi; done
-rm -f conftest.s*
+  if test x"$ac_file" != x-; then
+    { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
+    rm -f "$ac_file"
+  fi
+  # Let's still pretend it is `configure' which instantiates (i.e., don't
+  # use $as_me), people would be surprised to read:
+  #    /* config.h.  Generated by config.status.  */
+  if test x"$ac_file" = x-; then
+    configure_input=
+  else
+    configure_input="$ac_file.  "
+  fi
+  configure_input=$configure_input"Generated from `echo $ac_file_in |
+                                     sed 's,.*/,,'` by configure."
+
+  # First look for the input files in the build tree, otherwise in the
+  # src tree.
+  ac_file_inputs=`IFS=:
+    for f in $ac_file_in; do
+      case $f in
+      -) echo $tmp/stdin ;;
+      [\\/$]*)
+         # Absolute (can't be DOS-style, as IFS=:)
+         test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+         echo $f;;
+      *) # Relative
+         if test -f "$f"; then
+           # Build tree
+           echo $f
+         elif test -f "$srcdir/$f"; then
+           # Source tree
+           echo $srcdir/$f
+         else
+           # /dev/null tree
+           { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+         fi;;
+      esac
+    done` || { (exit 1); exit 1; }
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF
+  sed "$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s, at configure_input@,$configure_input,;t t
+s, at srcdir@,$ac_srcdir,;t t
+s, at abs_srcdir@,$ac_abs_srcdir,;t t
+s, at top_srcdir@,$ac_top_srcdir,;t t
+s, at abs_top_srcdir@,$ac_abs_top_srcdir,;t t
+s, at builddir@,$ac_builddir,;t t
+s, at abs_builddir@,$ac_abs_builddir,;t t
+s, at top_builddir@,$ac_top_builddir,;t t
+s, at abs_top_builddir@,$ac_abs_top_builddir,;t t
+s, at INSTALL@,$ac_INSTALL,;t t
+" $ac_file_inputs | (eval "$ac_sed_cmds") >$tmp/out
+  rm -f $tmp/stdin
+  if test x"$ac_file" != x-; then
+    mv $tmp/out $ac_file
+  else
+    cat $tmp/out
+    rm -f $tmp/out
+  fi
+
+done
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF
+
+#
+# CONFIG_HEADER section.
+#
 
 # These sed commands are passed to sed as "A NAME B NAME C VALUE D", where
 # NAME is the cpp macro being defined and VALUE is the value it is being given.
 #
 # ac_d sets the value in "#define NAME VALUE" lines.
-ac_dA='s%^\([ 	]*\)#\([ 	]*define[ 	][ 	]*\)'
-ac_dB='\([ 	][ 	]*\)[^ 	]*%\1#\2'
-ac_dC='\3'
-ac_dD='%g'
-# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE".
-ac_uA='s%^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
-ac_uB='\([ 	]\)%\1#\2define\3'
+ac_dA='s,^\([ 	]*\)#\([ 	]*define[ 	][ 	]*\)'
+ac_dB='[ 	].*$,\1#\2'
+ac_dC=' '
+ac_dD=',;t'
+# ac_u turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
+ac_uA='s,^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
+ac_uB='$,\1#\2define\3'
 ac_uC=' '
-ac_uD='\4%g'
-# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE".
-ac_eA='s%^\([ 	]*\)#\([ 	]*\)undef\([ 	][ 	]*\)'
-ac_eB='$%\1#\2define\3'
-ac_eC=' '
-ac_eD='%g'
-
-if test "${CONFIG_HEADERS+set}" != set; then
-EOF
-cat >> $CONFIG_STATUS <<EOF
-  CONFIG_HEADERS="defines.h"
-EOF
-cat >> $CONFIG_STATUS <<\EOF
-fi
-for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then
+ac_uD=',;t'
+
+for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue
   # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
-  case "$ac_file" in
-  *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
-       ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
-  *) ac_file_in="${ac_file}.in" ;;
+  case $ac_file in
+  - | *:- | *:-:* ) # input from stdin
+        cat >$tmp/stdin
+        ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+        ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  *:* ) ac_file_in=`echo "$ac_file" | sed 's,[^:]*:,,'`
+        ac_file=`echo "$ac_file" | sed 's,:.*,,'` ;;
+  * )   ac_file_in=$ac_file.in ;;
   esac
 
-  echo creating $ac_file
+  test x"$ac_file" != x- && { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
 
-  rm -f conftest.frag conftest.in conftest.out
-  ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
-  cat $ac_file_inputs > conftest.in
-
-EOF
-
-# Transform confdefs.h into a sed script conftest.vals that substitutes
-# the proper values into config.h.in to produce config.h.  And first:
-# Protect against being on the right side of a sed subst in config.status.
-# Protect against being in an unquoted here document in config.status.
-rm -f conftest.vals
-cat > conftest.hdr <<\EOF
-s/[\\&%]/\\&/g
-s%[\\$`]%\\&%g
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp
-s%ac_d%ac_u%gp
-s%ac_u%ac_e%gp
-EOF
-sed -n -f conftest.hdr confdefs.h > conftest.vals
-rm -f conftest.hdr
+  # First look for the input files in the build tree, otherwise in the
+  # src tree.
+  ac_file_inputs=`IFS=:
+    for f in $ac_file_in; do
+      case $f in
+      -) echo $tmp/stdin ;;
+      [\\/$]*)
+         # Absolute (can't be DOS-style, as IFS=:)
+         test -f "$f" || { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+         echo $f;;
+      *) # Relative
+         if test -f "$f"; then
+           # Build tree
+           echo $f
+         elif test -f "$srcdir/$f"; then
+           # Source tree
+           echo $srcdir/$f
+         else
+           # /dev/null tree
+           { { echo "$as_me:$LINENO: error: cannot find input file: $f" >&5
+echo "$as_me: error: cannot find input file: $f" >&2;}
+   { (exit 1); exit 1; }; }
+         fi;;
+      esac
+    done` || { (exit 1); exit 1; }
+  # Remove the trailing spaces.
+  sed 's/[ 	]*$//' $ac_file_inputs >$tmp/in
+
+_ACEOF
+
+# Transform confdefs.h into two sed scripts, `conftest.defines' and
+# `conftest.undefs', that substitutes the proper values into
+# config.h.in to produce config.h.  The first handles `#define'
+# templates, and the second `#undef' templates.
+# And first: Protect against being on the right side of a sed subst in
+# config.status.  Protect against being in an unquoted here document
+# in config.status.
+rm -f conftest.defines conftest.undefs
+# Using a here document instead of a string reduces the quoting nightmare.
+# Putting comments in sed scripts is not portable.
+#
+# `end' is used to avoid that the second main sed command (meant for
+# 0-ary CPP macros) applies to n-ary macro definitions.
+# See the Autoconf documentation for `clear'.
+cat >confdef2sed.sed <<\_ACEOF
+s/[\\&,]/\\&/g
+s,[\\$`],\\&,g
+t clear
+: clear
+s,^[ 	]*#[ 	]*define[ 	][ 	]*\([^ 	(][^ 	(]*\)\(([^)]*)\)[ 	]*\(.*\)$,${ac_dA}\1${ac_dB}\1\2${ac_dC}\3${ac_dD},gp
+t end
+s,^[ 	]*#[ 	]*define[ 	][ 	]*\([^ 	][^ 	]*\)[ 	]*\(.*\)$,${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD},gp
+: end
+_ACEOF
+# If some macros were called several times there might be several times
+# the same #defines, which is useless.  Nevertheless, we may not want to
+# sort them, since we want the *last* AC-DEFINE to be honored.
+uniq confdefs.h | sed -n -f confdef2sed.sed >conftest.defines
+sed 's/ac_d/ac_u/g' conftest.defines >conftest.undefs
+rm -f confdef2sed.sed
 
 # This sed command replaces #undef with comments.  This is necessary, for
 # example, in the case of _POSIX_SOURCE, which is predefined and required
 # on some systems where configure will not decide to define it.
-cat >> conftest.vals <<\EOF
-s%^[ 	]*#[ 	]*undef[ 	][ 	]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */%
-EOF
-
-# Break up conftest.vals because some shells have a limit on
-# the size of here documents, and old seds have small limits too.
-
+cat >>conftest.undefs <<\_ACEOF
+s,^[ 	]*#[ 	]*undef[ 	][ 	]*[a-zA-Z_][a-zA-Z_0-9]*,/* & */,
+_ACEOF
+
+# Break up conftest.defines because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo '  # Handle all the #define templates only if necessary.' >>$CONFIG_STATUS
+echo '  if grep "^[ 	]*#[ 	]*define" $tmp/in >/dev/null; then' >>$CONFIG_STATUS
+echo '  # If there are no defines, we may have an empty if/fi' >>$CONFIG_STATUS
+echo '  :' >>$CONFIG_STATUS
 rm -f conftest.tail
-while :
+while grep . conftest.defines >/dev/null
 do
-  ac_lines=`grep -c . conftest.vals`
-  # grep -c gives empty output for an empty file on some AIX systems.
-  if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi
-  # Write a limited-size here document to conftest.frag.
-  echo '  cat > conftest.frag <<CEOF' >> $CONFIG_STATUS
-  sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS
+  # Write a limited-size here document to $tmp/defines.sed.
+  echo '  cat >$tmp/defines.sed <<CEOF' >>$CONFIG_STATUS
+  # Speed up: don't consider the non `#define' lines.
+  echo '/^[ 	]*#[ 	]*define/!b' >>$CONFIG_STATUS
+  # Work around the forget-to-reset-the-flag bug.
+  echo 't clr' >>$CONFIG_STATUS
+  echo ': clr' >>$CONFIG_STATUS
+  sed ${ac_max_here_lines}q conftest.defines >>$CONFIG_STATUS
   echo 'CEOF
-  sed -f conftest.frag conftest.in > conftest.out
-  rm -f conftest.in
-  mv conftest.out conftest.in
-' >> $CONFIG_STATUS
-  sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail
-  rm -f conftest.vals
-  mv conftest.tail conftest.vals
-done
-rm -f conftest.vals
-
-cat >> $CONFIG_STATUS <<\EOF
-  rm -f conftest.frag conftest.h
-  echo "/* $ac_file.  Generated automatically by configure.  */" > conftest.h
-  cat conftest.in >> conftest.h
-  rm -f conftest.in
-  if cmp -s $ac_file conftest.h 2>/dev/null; then
-    echo "$ac_file is unchanged"
-    rm -f conftest.h
-  else
-    # Remove last slash and all that follows it.  Not all systems have dirname.
-      ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
-      if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
-      # The file is in a subdirectory.
-      test ! -d "$ac_dir" && mkdir "$ac_dir"
-    fi
-    rm -f $ac_file
-    mv conftest.h $ac_file
+  sed -f $tmp/defines.sed $tmp/in >$tmp/out
+  rm -f $tmp/in
+  mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+  sed 1,${ac_max_here_lines}d conftest.defines >conftest.tail
+  rm -f conftest.defines
+  mv conftest.tail conftest.defines
+done
+rm -f conftest.defines
+echo '  fi # grep' >>$CONFIG_STATUS
+echo >>$CONFIG_STATUS
+
+# Break up conftest.undefs because some shells have a limit on the size
+# of here documents, and old seds have small limits too (100 cmds).
+echo '  # Handle all the #undef templates' >>$CONFIG_STATUS
+rm -f conftest.tail
+while grep . conftest.undefs >/dev/null
+do
+  # Write a limited-size here document to $tmp/undefs.sed.
+  echo '  cat >$tmp/undefs.sed <<CEOF' >>$CONFIG_STATUS
+  # Speed up: don't consider the non `#undef'
+  echo '/^[ 	]*#[ 	]*undef/!b' >>$CONFIG_STATUS
+  # Work around the forget-to-reset-the-flag bug.
+  echo 't clr' >>$CONFIG_STATUS
+  echo ': clr' >>$CONFIG_STATUS
+  sed ${ac_max_here_lines}q conftest.undefs >>$CONFIG_STATUS
+  echo 'CEOF
+  sed -f $tmp/undefs.sed $tmp/in >$tmp/out
+  rm -f $tmp/in
+  mv $tmp/out $tmp/in
+' >>$CONFIG_STATUS
+  sed 1,${ac_max_here_lines}d conftest.undefs >conftest.tail
+  rm -f conftest.undefs
+  mv conftest.tail conftest.undefs
+done
+rm -f conftest.undefs
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+  # Let's still pretend it is `configure' which instantiates (i.e., don't
+  # use $as_me), people would be surprised to read:
+  #    /* config.h.  Generated by config.status.  */
+  if test x"$ac_file" = x-; then
+    echo "/* Generated by configure.  */" >$tmp/config.h
+  else
+    echo "/* $ac_file.  Generated by configure.  */" >$tmp/config.h
   fi
-fi; done
+  cat $tmp/in >>$tmp/config.h
+  rm -f $tmp/in
+  if test x"$ac_file" != x-; then
+    if cmp -s $ac_file $tmp/config.h 2>/dev/null; then
+      { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+echo "$as_me: $ac_file is unchanged" >&6;}
+    else
+      ac_dir=`(dirname "$ac_file") 2>/dev/null ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+         X"$ac_file" : 'X\(//\)[^/]' \| \
+         X"$ac_file" : 'X\(//\)$' \| \
+         X"$ac_file" : 'X\(/\)' \| \
+         .     : '\(.\)' 2>/dev/null ||
+echo X"$ac_file" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+      { if $as_mkdir_p; then
+    mkdir -p "$ac_dir"
+  else
+    as_dir="$ac_dir"
+    as_dirs=
+    while test ! -d "$as_dir"; do
+      as_dirs="$as_dir $as_dirs"
+      as_dir=`(dirname "$as_dir") 2>/dev/null ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+         X"$as_dir" : 'X\(//\)[^/]' \| \
+         X"$as_dir" : 'X\(//\)$' \| \
+         X"$as_dir" : 'X\(/\)' \| \
+         .     : '\(.\)' 2>/dev/null ||
+echo X"$as_dir" |
+    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/; q; }
+  	  /^X\(\/\/\)[^/].*/{ s//\1/; q; }
+  	  /^X\(\/\/\)$/{ s//\1/; q; }
+  	  /^X\(\/\).*/{ s//\1/; q; }
+  	  s/.*/./; q'`
+    done
+    test ! -n "$as_dirs" || mkdir $as_dirs
+  fi || { { echo "$as_me:$LINENO: error: cannot create directory \"$ac_dir\"" >&5
+echo "$as_me: error: cannot create directory \"$ac_dir\"" >&2;}
+   { (exit 1); exit 1; }; }; }
 
-EOF
-cat >> $CONFIG_STATUS <<EOF
+      rm -f $ac_file
+      mv $tmp/config.h $ac_file
+    fi
+  else
+    cat $tmp/config.h
+    rm -f $tmp/config.h
+  fi
+done
+_ACEOF
 
-EOF
-cat >> $CONFIG_STATUS <<\EOF
+cat >>$CONFIG_STATUS <<\_ACEOF
 
-exit 0
-EOF
+{ (exit 0); exit 0; }
+_ACEOF
 chmod +x $CONFIG_STATUS
-rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
+ac_clean_files=$ac_clean_files_save
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded.  So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status.  When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+  ac_cs_success=:
+  exec 5>/dev/null
+  $SHELL $CONFIG_STATUS || ac_cs_success=false
+  exec 5>>config.log
+  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+  # would make configure fail if this is the last instruction.
+  $ac_cs_success || { (exit 1); exit 1; }
+fi
 
Index: contrib/less/configure.in
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/configure.in,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 configure.in
--- contrib/less/configure.in	7 Jan 2002 20:29:17 -0000	1.1.1.3
+++ contrib/less/configure.in	3 Jul 2003 19:03:04 -0000
@@ -1,322 +0,0 @@
-dnl Process this file with autoconf to produce a configure script.
-AC_INIT(forwback.c)
-AC_CONFIG_HEADER(defines.h)
-
-dnl Checks for programs.
-AC_PROG_CC
-AC_ISC_POSIX
-AC_PROG_GCC_TRADITIONAL
-AC_PROG_INSTALL
-
-dnl Check for compilation model.
-dnl AC_SYS_LARGEFILE is not supported in all versions of autoconf.
-dnl Remove the dnl comment on the next line to use large (64 bit) files.
-dnl AC_SYS_LARGEFILE
-
-dnl Checks for libraries.
-AC_CHECK_LIB(xcurses, initscr, [have_xcurses=yes], [have_xcurses=no])
-AC_CHECK_LIB(ncurses, initscr, [have_ncurses=yes], [have_ncurses=no])
-AC_CHECK_LIB(curses, initscr, [have_curses=yes], [have_curses=no])
-AC_CHECK_LIB(termcap, tgetent, [have_termcap=yes], [have_termcap=no])
-AC_CHECK_LIB(termlib, tgetent, [have_termlib=yes], [have_termlib=no])
-dnl Regular expressions (regcmp) are in -lgen on Solaris 2,
-dnl and in -lintl on SCO Unix.
-AC_CHECK_LIB(gen, regcmp)
-AC_CHECK_LIB(intl, regcmp)
-AC_CHECK_LIB(PW, regcmp)
-dnl Checks for terminal libraries
-
-AC_MSG_CHECKING(for working terminal libraries)
-TERMLIBS=
-
-dnl Check for systems where curses is broken.
-curses_broken=0
-if test x`uname -s` = "xHP-UX" >/dev/null 2>&1; then
-if test x`uname -r` = "xB.11.00" >/dev/null 2>&1; then
-   curses_broken=1
-fi
-if test x`uname -r` = "xB.11.11" >/dev/null 2>&1; then
-   curses_broken=1
-fi
-fi
-
-if test $curses_broken = 0; then
-dnl -- Try xcurses.
-if test "x$TERMLIBS" = x; then
-  if test $have_xcurses = yes; then
-    TERMLIBS="-lxcurses"
-    SAVE_LIBS=$LIBS
-    LIBS="$LIBS $TERMLIBS"
-    AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);],
-      [termok=yes], [termok=no])
-    LIBS=$SAVE_LIBS
-    if test $termok = no; then TERMLIBS=""; fi
-  fi
-fi
-
-dnl -- Try ncurses.
-if test "x$TERMLIBS" = x; then
-  if test $have_ncurses = yes; then
-    TERMLIBS="-lncurses"
-    SAVE_LIBS=$LIBS
-    LIBS="$LIBS $TERMLIBS"
-    AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);],
-      [termok=yes], [termok=no])
-    LIBS=$SAVE_LIBS
-    if test $termok = no; then TERMLIBS=""; fi
-  fi
-fi
-
-dnl -- Try curses.
-if test "x$TERMLIBS" = x; then
-  if test $have_curses = yes; then
-    TERMLIBS="-lcurses"
-    SAVE_LIBS=$LIBS
-    LIBS="$LIBS $TERMLIBS"
-    AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);],
-      [termok=yes], [termok=no])
-    LIBS=$SAVE_LIBS
-    if test $termok = no; then TERMLIBS=""; fi
-  fi
-fi
-
-dnl -- Try curses & termcap.
-if test "x$TERMLIBS" = x; then
-  if test $have_curses = yes; then
-  if test $have_termcap = yes; then
-    TERMLIBS="-lcurses -ltermcap"
-    SAVE_LIBS=$LIBS
-    LIBS="$LIBS $TERMLIBS"
-    AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);],
-      [termok=yes], [termok=no])
-    LIBS=$SAVE_LIBS
-    if test $termok = no; then TERMLIBS=""; fi
-  fi
-  fi
-fi
-fi
-
-dnl -- Try termcap.
-if test "x$TERMLIBS" = x; then
-  if test $have_termcap = yes; then
-    TERMLIBS="-ltermcap"
-    SAVE_LIBS=$LIBS
-    LIBS="$LIBS $TERMLIBS"
-    AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);],
-      [termok=yes], [termok=no])
-    LIBS=$SAVE_LIBS
-    if test $termok = no; then TERMLIBS=""; fi
-  fi
-fi
-
-dnl -- Try termlib.
-if test "x$TERMLIBS" = x; then
-  if test $have_termlib = yes; then
-    TERMLIBS="-lcurses -ltermlib"
-    SAVE_LIBS=$LIBS
-    LIBS="$LIBS $TERMLIBS"
-    AC_TRY_LINK(, [tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0);],
-      [termok=yes], [termok=no])
-    LIBS=$SAVE_LIBS
-    if test $termok = no; then TERMLIBS=""; fi
-  fi
-fi
-
-if test "x$TERMLIBS" = x; then
-  AC_MSG_RESULT(Cannot find terminal libraries - configure failed)
-  exit 1
-fi
-AC_MSG_RESULT(using $TERMLIBS)
-LIBS="$LIBS $TERMLIBS"
-
-
-dnl Checks for header files.
-AC_CHECK_HEADERS(ctype.h errno.h fcntl.h limits.h stdio.h stdlib.h string.h termcap.h termio.h termios.h time.h unistd.h values.h sys/ioctl.h sys/stream.h sys/ptem.h)
-
-dnl Checks for identifiers.
-AC_TYPE_OFF_T
-AC_MSG_CHECKING(for void)
-AC_TRY_COMPILE(, [void *foo = 0;], 
-  [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_VOID)], [AC_MSG_RESULT(no)])
-AC_MSG_CHECKING(for const)
-AC_TRY_COMPILE(, [const int foo = 0;], 
-  [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_CONST)], [AC_MSG_RESULT(no)])
-AC_MSG_CHECKING(for time_t)
-AC_TRY_COMPILE([#include <time.h>], [time_t t = 0;],
-  [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_TIME_T)], [AC_MSG_RESULT(no)])
-
-dnl Checks for functions and external variables.
-AC_TYPE_SIGNAL
-AC_CHECK_FUNCS(fsync memcpy popen _setjmp sigprocmask sigsetmask stat strchr strstr system)
-
-dnl Some systems have termios.h but not the corresponding functions.
-AC_CHECK_FUNC(tcgetattr, AC_DEFINE(HAVE_TERMIOS_FUNCS))
-
-AC_MSG_CHECKING(for fileno)
-AC_TRY_LINK([
-#if HAVE_STDIO_H
-#include <stdio.h>
-#endif], [static int x; x = fileno(stdin);],
-  [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FILENO)], [AC_MSG_RESULT(no)])
-
-AC_MSG_CHECKING(for strerror)
-AC_TRY_LINK([
-#if HAVE_STDIO_H
-#include <stdio.h>
-#endif
-#if HAVE_STRING_H
-#include <string.h>
-#endif
-#if HAVE_ERRNO_H
-#include <errno.h>
-#endif], [static char *x; x = strerror(0);],
-  [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STRERROR)], [AC_MSG_RESULT(no)])
-
-AC_MSG_CHECKING(for sys_errlist)
-AC_TRY_LINK(, [extern char *sys_errlist[]; static char **x; x = sys_errlist;], 
-  [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SYS_ERRLIST)], [AC_MSG_RESULT(no)])
-
-AC_MSG_CHECKING(for sigset_t)
-AC_TRY_LINK([
-#include <signal.h>
-], [sigset_t s; s = 0;],
-  [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SIGSET_T)], [AC_MSG_RESULT(no)])
-
-AC_MSG_CHECKING(for sigemptyset)
-AC_TRY_LINK([
-#include <signal.h>
-], [sigset_t s; sigemptyset(&s);],
-  [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_SIGEMPTYSET)], [AC_MSG_RESULT(no)])
-
-have_errno=no
-AC_MSG_CHECKING(for errno)
-AC_TRY_LINK([
-#if HAVE_ERRNO_H
-#include <errno.h>
-#endif], [static int x; x = errno;], 
-  [AC_MSG_RESULT(yes - in errno.h); AC_DEFINE(HAVE_ERRNO) have_errno=yes])
-if test $have_errno = no; then
-AC_TRY_LINK([
-#if HAVE_ERRNO_H
-#include <errno.h>
-#endif], [extern int errno; static int x; x = errno;], 
-  [AC_MSG_RESULT(yes - must define); AC_DEFINE(HAVE_ERRNO) AC_DEFINE(MUST_DEFINE_ERRNO)],
-  [AC_MSG_RESULT(no)])
-fi
-
-AC_MSG_CHECKING(for locale)
-AC_TRY_LINK([#include <locale.h>
-#include <ctype.h>], [setlocale(LC_CTYPE,""); isprint(0); iscntrl(0);],
-  [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_LOCALE)], [AC_MSG_RESULT(no)])
-AC_MSG_CHECKING(for ctype functions)
-AC_TRY_LINK([
-#if HAVE_CTYPE_H
-#include <ctype.h>
-#endif], [static int x; x = isupper(x); x = tolower(x); x = toupper(x);],
-  [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_UPPER_LOWER)], [AC_MSG_RESULT(no)])
-
-dnl Checks for external variable ospeed in the termcap library.
-have_ospeed=no
-AC_MSG_CHECKING(termcap for ospeed)
-AC_TRY_LINK([
-#include <sys/types.h>
-#if HAVE_TERMIOS_H
-#include <termios.h>
-#endif
-#if HAVE_TERMCAP_H
-#include <termcap.h>
-#endif], [ospeed = 0;],
-[AC_MSG_RESULT(yes - in termcap.h); AC_DEFINE(HAVE_OSPEED) have_ospeed=yes])
-if test $have_ospeed = no; then
-AC_TRY_LINK(, [extern short ospeed; ospeed = 0;], 
-  [AC_MSG_RESULT(yes - must define); AC_DEFINE(HAVE_OSPEED) AC_DEFINE(MUST_DEFINE_OSPEED)],
-  [AC_MSG_RESULT(no)])
-fi
-
-dnl Checks for regular expression functions.
-have_regex=no
-have_posix_regex=unknown
-AC_MSG_CHECKING(for regcomp)
-
-WANT_REGEX=auto
-AC_ARG_WITH(regex,
-  [  --with-regex={auto,pcre,posix,regcmp,re_comp,regcomp,regcomp-local}  Select a regular expression library  [auto]],
-  WANT_REGEX="$withval")
-
-if test $have_regex = no; then
-if test $WANT_REGEX = auto -o $WANT_REGEX = posix; then
-dnl Some versions of Solaris have a regcomp() function, but it doesn't work!
-dnl So we run a test program.  If we're cross-compiling, do it the old way.
-AC_TRY_RUN([
-#include <sys/types.h>
-#include <regex.h>
-main() { regex_t r; regmatch_t rm; char *text = "xabcy";
-if (regcomp(&r, "abc", 0)) exit(1);
-if (regexec(&r, text, 1, &rm, 0)) exit(1);
-#ifndef __WATCOMC__
-if (rm.rm_so != 1) exit(1); /* check for correct offset */
-#else
-if (rm.rm_sp != text + 1) exit(1); /* check for correct offset */
-#endif
-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)
-  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)
-else
-  AC_MSG_RESULT(no)
-fi
-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], [])
-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)
-fi
-fi
-
-if test $have_regex = no; then
-if test $WANT_REGEX = auto -o $WANT_REGEX = regcomp; then
-AC_TRY_LINK([
-#include "regexp.h"], [regcomp("");],
-AC_MSG_RESULT(using V8 regcomp); AC_DEFINE(HAVE_V8_REGCOMP) have_regex=yes)
-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
-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)
-fi
-fi
-
-if test $have_regex = no; then
-AC_MSG_RESULT(cannot find regular expression library); AC_DEFINE(NO_REGEX)
-fi
-
-AC_ARG_WITH(editor,
-  [  --with-editor=PROGRAM   use PROGRAM as the default editor [vi]],
-  AC_DEFINE_UNQUOTED(EDIT_PGM, "$withval"))
-
-AC_OUTPUT(Makefile)
Index: contrib/less/decode.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/decode.c,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 decode.c
--- contrib/less/decode.c	7 Jan 2002 20:28:42 -0000	1.1.1.3
+++ contrib/less/decode.c	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
@@ -260,7 +260,7 @@
 			repl = special_key_str(fm[1]);
 			klen = fm[2] & 0377;
 			fm += klen;
-			if (repl == NULL || strlen(repl) > klen)
+			if (repl == NULL || (int) strlen(repl) > klen)
 				repl = "\377";
 			while (*repl != '\0')
 				*to++ = *repl++;
@@ -653,7 +653,7 @@
 	/*
 	 * Try to open the lesskey file.
 	 */
-	filename = unquote_file(filename);
+	filename = shell_unquote(filename);
 	f = open(filename, OPEN_READ);
 	free(filename);
 	if (f < 0)
Index: contrib/less/defines.ds
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/defines.ds,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 defines.ds
--- contrib/less/defines.ds	7 Jan 2002 20:29:35 -0000	1.1.1.3
+++ contrib/less/defines.ds	3 Jul 2003 19:03:04 -0000
@@ -169,6 +169,12 @@
  */
 #define	HAVE_SHELL	0
 
+/*
+ * Default shell metacharacters and meta-escape character.
+ */
+#define	DEF_METACHARS	"; *?\t\n'\"()<>|&"
+#define	DEF_METAESCAPE	""
+
 /* 
  * HAVE_DUP is 1 if your system has the dup() call.
  */
Index: contrib/less/defines.h.in
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/defines.h.in,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 defines.h.in
--- contrib/less/defines.h.in	7 Jan 2002 20:29:22 -0000	1.1.1.3
+++ contrib/less/defines.h.in	3 Jul 2003 19:03:04 -0000
@@ -1,4 +1,6 @@
-/* defines.h.in.  Generated automatically from configure.in by autoheader.  */
+/* defines.h.in.  Generated from configure.ac by autoheader.  */
+
+
 /* Unix definition file for less.  -*- C -*-
  *
  * This file has 3 sections:
@@ -10,7 +12,7 @@
  * If you edit defines.h by hand, do "touch stamp-h" before you run make
  * so config.status doesn't overwrite your changes.
  */
-
+
 /* User preferences.  */
 
 /*
@@ -108,7 +110,7 @@
 #define	LESSKEYFILE_SYS		SYSDIR "/sysless"
 #define	DEF_LESSKEYINFILE	".lesskey"
 
-
+
 /* Settings always true on Unix.  */
 
 /*
@@ -150,7 +152,7 @@
 /*
  * Default shell metacharacters and meta-escape character.
  */
-#define	DEF_METACHARS	"; \t\n'\"()<>|&^`\\"
+#define	DEF_METACHARS	"; *?\t\n'\"()<>|&^`#\\"
 #define	DEF_METAESCAPE	"\\"
 
 /* 
@@ -170,170 +172,224 @@
 #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 */
-
-/* Settings automatically determined by configure.  */
-
-/* Define to `long' if <sys/types.h> doesn't define.  */
-#undef off_t
-
-/* Define if you need to in order for stat and other things to work.  */
-#undef _POSIX_SOURCE
 
-/* Define as the return type of signal handlers (int or void).  */
-#undef RETSIGTYPE
-
-/* Define if you have the ANSI C header files.  */
-#undef STDC_HEADERS
+/* Settings automatically determined by configure.  */
 
-/*
- * Regular expression library.
- * Define exactly one of the following to be 1:
- * HAVE_POSIX_REGCOMP: POSIX regcomp() and regex.h
- * HAVE_PCRE: PCRE (Perl-compatible regular expression) library
- * HAVE_RE_COMP: BSD re_comp()
- * HAVE_REGCMP: System V regcmp()
- * HAVE_V8_REGCOMP: Henry Spencer V8 regcomp() and regexp.h
- * NO_REGEX: pattern matching is supported, but without metacharacters.
- */
-#undef HAVE_POSIX_REGCOMP
-#undef HAVE_PCRE
-#undef HAVE_RE_COMP
-#undef HAVE_REGCMP
-#undef HAVE_V8_REGCOMP
-#undef NO_REGEX
-#undef HAVE_REGEXEC2
 
-/* Define HAVE_VOID if your compiler supports the "void" type. */
-#undef HAVE_VOID
+/* Define EDIT_PGM to your editor. */
+#undef EDIT_PGM
 
 /* Define HAVE_CONST if your compiler supports the "const" modifier. */
 #undef HAVE_CONST
 
-/* Define HAVE_TIME_T if your system supports the "time_t" type. */
-#undef HAVE_TIME_T
+/* Define to 1 if you have the <ctype.h> header file. */
+#undef HAVE_CTYPE_H
 
-/* Define HAVE_STRERROR if you have the strerror() function. */
-#undef HAVE_STRERROR
+/* Define HAVE_ERRNO if you have the errno variable. */
+#undef HAVE_ERRNO
+
+/* Define to 1 if you have the <errno.h> header file. */
+#undef HAVE_ERRNO_H
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
 
 /* Define HAVE_FILENO if you have the fileno() macro. */
 #undef HAVE_FILENO
 
-/* Define HAVE_ERRNO if you have the errno variable */
-/* Define MUST_DEFINE_ERRNO if you have errno but it is not define 
- * in errno.h */
-#undef HAVE_ERRNO
-#undef MUST_DEFINE_ERRNO
+/* Define to 1 if you have the `fsync' function. */
+#undef HAVE_FSYNC
 
-/* Define HAVE_SYS_ERRLIST if you have the sys_errlist[] variable */
-#undef HAVE_SYS_ERRLIST
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
 
-/* Define HAVE_OSPEED if your termcap library has the ospeed variable */
-/* Define MUST_DEFINE_OSPEED if you have ospeed but it is not defined
- * in termcap.h. */
-#undef HAVE_OSPEED
-#undef MUST_DEFINE_OSPEED
+/* Define to 1 if you have the `gen' library (-lgen). */
+#undef HAVE_LIBGEN
+
+/* Define to 1 if you have the `intl' library (-lintl). */
+#undef HAVE_LIBINTL
+
+/* Define to 1 if you have the `PW' library (-lPW). */
+#undef HAVE_LIBPW
+
+/* Define to 1 if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
 
 /* Define HAVE_LOCALE if you have locale.h and setlocale. */
 #undef HAVE_LOCALE
 
-/* Define HAVE_TERMIOS_FUNCS if you have tcgetattr/tcsetattr */
-#undef HAVE_TERMIOS_FUNCS
+/* Define to 1 if you have the `memcpy' function. */
+#undef HAVE_MEMCPY
 
-/* Define HAVE_UPPER_LOWER if you have isupper, islower, toupper, tolower */
-#undef HAVE_UPPER_LOWER
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
 
-/* Define HAVE_SIGSET_T you have the sigset_t type */
-#undef HAVE_SIGSET_T
+/* Define HAVE_OSPEED if your termcap library has the ospeed variable. */
+#undef HAVE_OSPEED
 
-/* Define HAVE_SIGEMPTYSET if you have the sigemptyset macro */
-#undef HAVE_SIGEMPTYSET
+/* PCRE (Perl-compatible regular expression) library */
+#undef HAVE_PCRE
 
-/* Define EDIT_PGM to your editor. */
-#define EDIT_PGM "vi"
+/* Define to 1 if you have the `popen' function. */
+#undef HAVE_POPEN
 
-/* Define if you have the _setjmp function.  */
-#undef HAVE__SETJMP
+/* POSIX regcomp() and regex.h */
+#undef HAVE_POSIX_REGCOMP
 
-/* Define if you have the fsync function.  */
-#undef HAVE_FSYNC
+/* System V regcmp() */
+#undef HAVE_REGCMP
 
-/* Define if you have the memcpy function.  */
-#undef HAVE_MEMCPY
+/* */
+#undef HAVE_REGEXEC2
 
-/* Define if you have the popen function.  */
-#undef HAVE_POPEN
+/* BSD re_comp() */
+#undef HAVE_RE_COMP
 
-/* Define if you have the sigprocmask function.  */
+/* Define HAVE_SIGEMPTYSET if you have the sigemptyset macro. */
+#undef HAVE_SIGEMPTYSET
+
+/* Define to 1 if you have the `sigprocmask' function. */
 #undef HAVE_SIGPROCMASK
 
-/* Define if you have the sigsetmask function.  */
+/* Define to 1 if you have the `sigsetmask' function. */
 #undef HAVE_SIGSETMASK
 
-/* Define if you have the stat function.  */
+/* Define HAVE_SIGSET_T you have the sigset_t type. */
+#undef HAVE_SIGSET_T
+
+/* Define to 1 if you have the `stat' function. */
 #undef HAVE_STAT
 
-/* Define if you have the strchr function.  */
-#undef HAVE_STRCHR
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
 
-/* Define if you have the strstr function.  */
-#undef HAVE_STRSTR
+/* Define to 1 if you have the <stdio.h> header file. */
+#undef HAVE_STDIO_H
 
-/* Define if you have the system function.  */
-#undef HAVE_SYSTEM
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
 
-/* Define if you have the <ctype.h> header file.  */
-#undef HAVE_CTYPE_H
+/* Define to 1 if you have the `strchr' function. */
+#undef HAVE_STRCHR
 
-/* Define if you have the <errno.h> header file.  */
-#undef HAVE_ERRNO_H
+/* Define HAVE_STRERROR if you have the strerror() function. */
+#undef HAVE_STRERROR
 
-/* Define if you have the <fcntl.h> header file.  */
-#undef HAVE_FCNTL_H
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
 
-/* Define if you have the <limits.h> header file.  */
-#undef HAVE_LIMITS_H
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
 
-/* Define if you have the <stdio.h> header file.  */
-#undef HAVE_STDIO_H
+/* Define to 1 if you have the `strstr' function. */
+#undef HAVE_STRSTR
 
-/* Define if you have the <stdlib.h> header file.  */
-#undef HAVE_STDLIB_H
+/* Define to 1 if you have the `system' function. */
+#undef HAVE_SYSTEM
 
-/* Define if you have the <string.h> header file.  */
-#undef HAVE_STRING_H
+/* Define HAVE_SYS_ERRLIST if you have the sys_errlist[] variable. */
+#undef HAVE_SYS_ERRLIST
 
-/* Define if you have the <sys/ioctl.h> header file.  */
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
 #undef HAVE_SYS_IOCTL_H
 
-/* Define if you have the <sys/ptem.h> header file.  */
+/* Define to 1 if you have the <sys/ptem.h> header file. */
 #undef HAVE_SYS_PTEM_H
 
-/* Define if you have the <sys/stream.h> header file.  */
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/stream.h> header file. */
 #undef HAVE_SYS_STREAM_H
 
-/* Define if you have the <termcap.h> header file.  */
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <termcap.h> header file. */
 #undef HAVE_TERMCAP_H
 
-/* Define if you have the <termio.h> header file.  */
-#undef HAVE_TERMIO_H
+/* Define HAVE_TERMIOS_FUNCS if you have tcgetattr/tcsetattr. */
+#undef HAVE_TERMIOS_FUNCS
 
-/* Define if you have the <termios.h> header file.  */
+/* Define to 1 if you have the <termios.h> header file. */
 #undef HAVE_TERMIOS_H
 
-/* Define if you have the <time.h> header file.  */
+/* Define to 1 if you have the <termio.h> header file. */
+#undef HAVE_TERMIO_H
+
+/* Define to 1 if you have the <time.h> header file. */
 #undef HAVE_TIME_H
 
-/* Define if you have the <unistd.h> header file.  */
+/* Define HAVE_TIME_T if your system supports the "time_t" type. */
+#undef HAVE_TIME_T
+
+/* Define to 1 if you have the <unistd.h> header file. */
 #undef HAVE_UNISTD_H
 
-/* Define if you have the <values.h> header file.  */
+/* Define HAVE_UPPER_LOWER if you have isupper, islower, toupper, tolower. */
+#undef HAVE_UPPER_LOWER
+
+/* Henry Spencer V8 regcomp() and regexp.h */
+#undef HAVE_V8_REGCOMP
+
+/* Define to 1 if you have the <values.h> header file. */
 #undef HAVE_VALUES_H
 
-/* Define if you have the PW library (-lPW).  */
-#undef HAVE_LIBPW
+/* Define HAVE_VOID if your compiler supports the "void" type. */
+#undef HAVE_VOID
 
-/* Define if you have the gen library (-lgen).  */
-#undef HAVE_LIBGEN
+/* Define to 1 if you have the `_setjmp' function. */
+#undef HAVE__SETJMP
 
-/* Define if you have the intl library (-lintl).  */
-#undef HAVE_LIBINTL
+/* Define MUST_DEFINE_ERRNO if you have errno but it is not define in errno.h.
+   */
+#undef MUST_DEFINE_ERRNO
+
+/* Define MUST_DEFINE_OSPEED if you have ospeed but it is not defined in
+   termcap.h. */
+#undef MUST_DEFINE_OSPEED
+
+/* pattern matching is supported, but without metacharacters. */
+#undef NO_REGEX
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#undef RETSIGTYPE
+
+/* Define to 1 if the `S_IS*' macros in <sys/stat.h> do not work properly. */
+#undef STAT_MACROS_BROKEN
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#undef TIME_WITH_SYS_TIME
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+#undef _FILE_OFFSET_BITS
+
+/* Define for large files, on AIX-style hosts. */
+#undef _LARGE_FILES
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to `long' if <sys/types.h> does not define. */
+#undef off_t
+
+/* Define to `unsigned' if <sys/types.h> does not define. */
+#undef size_t
Index: contrib/less/defines.h.top
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/defines.h.top,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 defines.h.top
--- contrib/less/defines.h.top	7 Jan 2002 20:29:22 -0000	1.1.1.2
+++ contrib/less/defines.h.top	3 Jul 2003 19:03:04 -0000
@@ -1,173 +0,0 @@
-/* Unix definition file for less.  -*- C -*-
- *
- * This file has 3 sections:
- * User preferences.
- * Settings always true on Unix.
- * Settings automatically determined by configure.
- *
- * * * * * *  WARNING  * * * * * *
- * If you edit defines.h by hand, do "touch stamp-h" before you run make
- * so config.status doesn't overwrite your changes.
- */
-
-/* User preferences.  */
-
-/*
- * SECURE is 1 if you wish to disable a bunch of features in order to
- * be safe to run by unprivileged users.
- */
-#define	SECURE		0
-
-/*
- * SHELL_ESCAPE is 1 if you wish to allow shell escapes.
- * (This is possible only if your system supplies the system() function.)
- */
-#define	SHELL_ESCAPE	(!SECURE)
-
-/*
- * EXAMINE is 1 if you wish to allow examining files by name from within less.
- */
-#define	EXAMINE		(!SECURE)
-
-/*
- * TAB_COMPLETE_FILENAME is 1 if you wish to allow the TAB key
- * to complete filenames at prompts.
- */
-#define	TAB_COMPLETE_FILENAME	(!SECURE)
-
-/*
- * CMD_HISTORY is 1 if you wish to allow keys to cycle through
- * previous commands at prompts.
- */
-#define	CMD_HISTORY	1
-
-/*
- * HILITE_SEARCH is 1 if you wish to have search targets to be 
- * displayed in standout mode.
- */
-#define	HILITE_SEARCH	1
-
-/*
- * EDITOR is 1 if you wish to allow editor invocation (the "v" command).
- * (This is possible only if your system supplies the system() function.)
- * EDIT_PGM is the name of the (default) editor to be invoked.
- */
-#define	EDITOR		(!SECURE)
-
-/*
- * TAGS is 1 if you wish to support tag files.
- */
-#define	TAGS		(!SECURE)
-
-/*
- * USERFILE is 1 if you wish to allow a .less file to specify 
- * user-defined key bindings.
- */
-#define	USERFILE	(!SECURE)
-
-/*
- * GLOB is 1 if you wish to have shell metacharacters expanded in filenames.
- * This will generally work if your system provides the "popen" function
- * and the "echo" shell command.
- */
-#define	GLOB		(!SECURE)
-
-/*
- * PIPEC is 1 if you wish to have the "|" command
- * which allows the user to pipe data into a shell command.
- */
-#define	PIPEC		(!SECURE)
-
-/*
- * LOGFILE is 1 if you wish to allow the -l option (to create log files).
- */
-#define	LOGFILE		(!SECURE)
-
-/*
- * GNU_OPTIONS is 1 if you wish to support the GNU-style command
- * line options --help and --version.
- */
-#define	GNU_OPTIONS	1
-
-/*
- * ONLY_RETURN is 1 if you want RETURN to be the only input which
- * will continue past an error message.
- * Otherwise, any key will continue past an error message.
- */
-#define	ONLY_RETURN	0
-
-/*
- * LESSKEYFILE is the filename of the default lesskey output file 
- * (in the HOME directory).
- * LESSKEYFILE_SYS is the filename of the system-wide lesskey output file.
- * DEF_LESSKEYINFILE is the filename of the default lesskey input 
- * (in the HOME directory).
- */
-#define	LESSKEYFILE		".less"
-#define	LESSKEYFILE_SYS		SYSDIR "/sysless"
-#define	DEF_LESSKEYINFILE	".lesskey"
-
-
-/* Settings always true on Unix.  */
-
-/*
- * Define MSDOS_COMPILER if compiling under Microsoft C.
- */
-#define	MSDOS_COMPILER	0
-
-/*
- * Pathname separator character.
- */
-#define	PATHNAME_SEP	"/"
-
-/*
- * HAVE_SYS_TYPES_H is 1 if your system has <sys/types.h>.
- */
-#define HAVE_SYS_TYPES_H	1
-
-/*
- * Define if you have the <sgstat.h> header file.
- */
-#undef HAVE_SGSTAT_H
-
-/*
- * HAVE_PERROR is 1 if your system has the perror() call.
- * (Actually, if it has sys_errlist, sys_nerr and errno.)
- */
-#define	HAVE_PERROR	1
-
-/*
- * HAVE_TIME is 1 if your system has the time() call.
- */
-#define	HAVE_TIME	1
-
-/*
- * HAVE_SHELL is 1 if your system supports a SHELL command interpreter.
- */
-#define	HAVE_SHELL	1
-
-/*
- * Default shell metacharacters and meta-escape character.
- */
-#define	DEF_METACHARS	"; \t\n'\"()<>|&^`\\"
-#define	DEF_METAESCAPE	"\\"
-
-/* 
- * HAVE_DUP is 1 if your system has the dup() call.
- */
-#define	HAVE_DUP	1
-
-/*
- * Sizes of various buffers.
- */
-#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	OUTBUF_SIZE	1024	/* Output buffer */
-#define	PROMPT_SIZE	200	/* 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	512	/* Max size of line in tags file */
-#define	TABSTOP_MAX	32	/* Max number of custom tab stops */
-
-/* Settings automatically determined by configure.  */
Index: contrib/less/defines.o2
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/defines.o2,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 defines.o2
--- contrib/less/defines.o2	7 Jan 2002 20:29:36 -0000	1.1.1.3
+++ contrib/less/defines.o2	3 Jul 2003 19:03:04 -0000
@@ -150,6 +150,12 @@
  */
 #define	HAVE_SHELL	0
 
+/*
+ * Default shell metacharacters and meta-escape character.
+ */
+#define	DEF_METACHARS	"; *?\t\n'\"()<>|&"
+#define	DEF_METAESCAPE	""
+
 /* 
  * HAVE_DUP is 1 if your system has the dup() call.
  */
Index: contrib/less/defines.wn
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/defines.wn,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 defines.wn
--- contrib/less/defines.wn	7 Jan 2002 20:29:38 -0000	1.1.1.3
+++ contrib/less/defines.wn	3 Jul 2003 19:03:04 -0000
@@ -151,6 +151,12 @@
  */
 #define	HAVE_SHELL	0
 
+/*
+ * Default shell metacharacters and meta-escape character.
+ */
+#define	DEF_METACHARS	"; *?\t\n'\"()<>|&"
+#define	DEF_METAESCAPE	""
+
 /* 
  * HAVE_DUP is 1 if your system has the dup() call.
  */
Index: contrib/less/edit.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/edit.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 edit.c
--- contrib/less/edit.c	22 May 2000 09:53:21 -0000	1.1.1.1
+++ contrib/less/edit.c	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
@@ -54,7 +54,10 @@
 {
 	char *s;
 #if SPACES_IN_FILENAMES
-	int quoted = 0;
+	int meta_quoted = 0;
+	int delim_quoted = 0;
+	char *esc = get_meta_escape();
+	int esclen = strlen(esc);
 #endif
 	
 	tlist->string = skipsp(str);
@@ -62,12 +65,25 @@
 	for (s = str;  s < tlist->endstring;  s++)
 	{
 #if SPACES_IN_FILENAMES
-		if (*s == ' ' && !quoted)
-			*s = '\0';
-		if (!quoted && *s == openquote)
-			quoted = 1;
-		else if (quoted && *s == closequote)
-			quoted = 0;
+		if (meta_quoted)
+		{
+			meta_quoted = 0;
+		} else if (esclen > 0 && s + esclen < tlist->endstring &&
+		           strncmp(s, esc, esclen) == 0)
+		{
+			meta_quoted = 1;
+			s += esclen - 1;
+		} else if (delim_quoted)
+		{
+			if (*s == closequote)
+				delim_quoted = 0;
+		} else /* (!delim_quoted) */
+		{
+			if (*s == openquote)
+				delim_quoted = 1;
+			else if (*s == ' ')
+				*s = '\0';
+		}
 #else
 		if (*s == ' ')
 			*s = '\0';
@@ -132,7 +148,6 @@
 close_file()
 {
 	struct scrpos scrpos;
-	char *filename;
 	
 	if (curr_ifile == NULL_IFILE)
 		return;
@@ -157,9 +172,8 @@
 	 */
 	if (curr_altfilename != NULL)
 	{
-		filename = unquote_file(get_filename(curr_ifile));
-		close_altfile(curr_altfilename, filename, curr_altpipe);
-		free(filename);
+		close_altfile(curr_altfilename, get_filename(curr_ifile),
+				curr_altpipe);
 		free(curr_altfilename);
 		curr_altfilename = NULL;
 	}
@@ -194,6 +208,7 @@
 	int chflags;
 	char *filename;
 	char *open_filename;
+	char *qopen_filename;
 	char *alt_filename;
 	void *alt_pipe;
 	IFILE was_curr_ifile;
@@ -244,13 +259,14 @@
 		return (0);
 	}
 
-	filename = unquote_file(get_filename(ifile));
+	filename = save(get_filename(ifile));
 	/*
 	 * See if LESSOPEN specifies an "alternate" file to open.
 	 */
 	alt_pipe = NULL;
 	alt_filename = open_altfile(filename, &f, &alt_pipe);
 	open_filename = (alt_filename != NULL) ? alt_filename : filename;
+	qopen_filename = shell_unquote(open_filename);
 
 	chflags = 0;
 	if (alt_pipe != NULL)
@@ -301,13 +317,14 @@
 			free(alt_filename);
 		}
 		del_ifile(ifile);
+		free(qopen_filename);
 		free(filename);
 		/*
 		 * Re-open the current file.
 		 */
 		reedit_ifile(was_curr_ifile);
 		return (1);
-	} else if ((f = open(open_filename, OPEN_READ)) < 0)
+	} else if ((f = open(qopen_filename, OPEN_READ)) < 0)
 	{
 		/*
 		 * Got an error trying to open it.
@@ -335,6 +352,7 @@
 			}
 		}
 	}
+	free(qopen_filename);
 
 	/*
 	 * Get the new ifile.
@@ -683,7 +701,7 @@
 	/*
 	 * {{ We could use access() here. }}
 	 */
-	filename = unquote_file(filename);
+	filename = shell_unquote(filename);
 	exists = open(filename, OPEN_READ);
 	close(exists);
 	exists = (exists >= 0);
Index: contrib/less/filename.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/filename.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 filename.c
--- contrib/less/filename.c	7 Jan 2002 20:28:44 -0000	1.1.1.2
+++ contrib/less/filename.c	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
@@ -50,6 +50,7 @@
 
 extern int force_open;
 extern int secure;
+extern int use_lessopen;
 extern IFILE curr_ifile;
 extern IFILE old_ifile;
 #if SPACES_IN_FILENAMES
@@ -61,24 +62,157 @@
  * Remove quotes around a filename.
  */
 	public char *
-unquote_file(str)
+shell_unquote(str)
 	char *str;
 {
-#if SPACES_IN_FILENAMES
 	char *name;
 	char *p;
 
-	if (*str != openquote)
-		return (save(str));
-	name = (char *) ecalloc(strlen(str), sizeof(char));
-	strcpy(name, str+1);
-	p = name + strlen(name) - 1;
-	if (*p == closequote)
-		*p = '\0';
+	name = p = (char *) ecalloc(strlen(str)+1, sizeof(char));
+	if (*str == openquote)
+	{
+		str++;
+		while (*str != '\0')
+		{
+			if (*str == closequote)
+			{
+				if (str[1] != closequote)
+					break;
+				str++;
+			}
+			*p++ = *str++;
+		}
+	} else
+	{
+		char *esc = get_meta_escape();
+		int esclen = strlen(esc);
+		while (*str != '\0')
+		{
+			if (esclen > 0 && strncmp(str, esc, esclen) == 0)
+				str += esclen;
+			*p++ = *str++;
+		}
+	}
+	*p = '\0';
 	return (name);
-#else
-	return (save(str));
-#endif
+}
+
+/*
+ * Get the shell's escape character.
+ */
+	public char *
+get_meta_escape()
+{
+	char *s;
+
+	s = lgetenv("LESSMETAESCAPE");
+	if (s == NULL)
+		s = DEF_METAESCAPE;
+	return (s);
+}
+
+/*
+ * Get the characters which the shell considers to be "metacharacters".
+ */
+	static char *
+metachars()
+{
+	static char *mchars = NULL;
+
+	if (mchars == NULL)
+	{
+		mchars = lgetenv("LESSMETACHARS");
+		if (mchars == NULL)
+			mchars = DEF_METACHARS;
+	}
+	return (mchars);
+}
+
+/*
+ * Is this a shell metacharacter?
+ */
+	static int
+metachar(c)
+	char c;
+{
+	return (strchr(metachars(), c) != NULL);
+}
+
+/*
+ * Insert a backslash before each metacharacter in a string.
+ */
+	public char *
+shell_quote(s)
+	char *s;
+{
+	char *p;
+	char *newstr;
+	int len;
+	char *esc = get_meta_escape();
+	int esclen = strlen(esc);
+	int use_quotes = 0;
+	int have_quotes = 0;
+
+	/*
+	 * Determine how big a string we need to allocate.
+	 */
+	len = 1; /* Trailing null byte */
+	for (p = s;  *p != '\0';  p++)
+	{
+		len++;
+		if (*p == openquote || *p == closequote)
+			have_quotes = 1;
+		if (metachar(*p))
+		{
+			if (esclen == 0)
+			{
+				/*
+				 * We've got a metachar, but this shell 
+				 * doesn't support escape chars.  Use quotes.
+				 */
+				use_quotes = 1;
+			} else
+			{
+				/*
+				 * Allow space for the escape char.
+				 */
+				len += esclen;
+			}
+		}
+	}
+	if (use_quotes)
+	{
+		if (have_quotes)
+			/*
+			 * We can't quote a string that contains quotes.
+			 */
+			return (NULL);
+		len = strlen(s) + 3;
+	}
+	/*
+	 * Allocate and construct the new string.
+	 */
+	newstr = p = (char *) ecalloc(len, sizeof(char));
+	if (use_quotes)
+	{
+		sprintf(newstr, "%c%s%c", openquote, s, closequote);
+	} else
+	{
+		while (*s != '\0')
+		{
+			if (metachar(*s))
+			{
+				/*
+				 * Add the escape char.
+				 */
+				strcpy(p, esc);
+				p += esclen;
+			}
+			*p++ = *s++;
+		}
+		*p = '\0';
+	}
+	return (newstr);
 }
 
 /*
@@ -107,7 +241,7 @@
 	/*
 	 * Make sure the file exists.
 	 */
-	qpathname = unquote_file(pathname);
+	qpathname = shell_unquote(pathname);
 	f = open(qpathname, OPEN_READ);
 	if (f < 0)
 	{
@@ -274,6 +408,7 @@
 	char *s;
 {
 	char *fpat;
+	char *qs;
 
 	if (secure)
 		return (NULL);
@@ -303,17 +438,19 @@
 	fpat = (char *) ecalloc(strlen(s)+2, sizeof(char));
 	sprintf(fpat, "%s*", s);
 #endif
-	s = lglob(fpat);
+	qs = lglob(fpat);
+	s = shell_unquote(qs);
 	if (strcmp(s,fpat) == 0)
 	{
 		/*
 		 * The filename didn't expand.
 		 */
-		free(s);
-		s = NULL;
+		free(qs);
+		qs = NULL;
 	}
+	free(s);
 	free(fpat);
-	return (s);
+	return (qs);
 }
 #endif
 
@@ -398,108 +535,6 @@
 	return (buf);
 }
 
-#if HAVE_SHELL
-
-/*
- * Get the shell's escape character.
- */
-	static char *
-get_meta_escape()
-{
-	char *s;
-
-	s = lgetenv("LESSMETAESCAPE");
-	if (s == NULL)
-		s = DEF_METAESCAPE;
-	return (s);
-}
-
-/*
- * Is this a shell metacharacter?
- */
-	static int
-metachar(c)
-	char c;
-{
-	static char *metachars = NULL;
-
-	if (metachars == NULL)
-	{
-		metachars = lgetenv("LESSMETACHARS");
-		if (metachars == NULL)
-			metachars = DEF_METACHARS;
-	}
-	return (strchr(metachars, c) != NULL);
-}
-
-/*
- * Insert a backslash before each metacharacter in a string.
- */
-	public char *
-esc_metachars(s)
-	char *s;
-{
-	char *p;
-	char *newstr;
-	int len;
-	char *esc;
-	int esclen;
-
-	/*
-	 * Determine how big a string we need to allocate.
-	 */
-	esc = get_meta_escape();
-	esclen = strlen(esc);
-	len = 1; /* Trailing null byte */
-	for (p = s;  *p != '\0';  p++)
-	{
-		len++;
-		if (metachar(*p))
-		{
-			if (*esc == '\0')
-			{
-				/*
-				 * We've got a metachar, but this shell 
-				 * doesn't support escape chars.  Give up.
-				 */
-				return (NULL);
-			}
-			/*
-			 * Allow space for the escape char.
-			 */
-			len += esclen;
-		}
-	}
-	/*
-	 * Allocate and construct the new string.
-	 */
-	newstr = p = (char *) ecalloc(len, sizeof(char));
-	while (*s != '\0')
-	{
-		if (metachar(*s))
-		{
-			/*
-			 * Add the escape char.
-			 */
-			strcpy(p, esc);
-			p += esclen;
-		}
-		*p++ = *s++;
-	}
-	*p = '\0';
-	return (newstr);
-}
-
-#else /* HAVE_SHELL */
-
-	public char *
-esc_metachars(s)
-	char *s;
-{
-	return (save(s));
-}
-
-#endif /* HAVE_SHELL */
 
 
 #if HAVE_POPEN
@@ -526,43 +561,32 @@
 		char *esccmd;
 
 		/*
-		 * Try to escape any metacharacters in the command.
-		 * If we can't do that, just put the command in quotes.
-		 * (But that doesn't work well if the command itself 
-		 * contains quotes.)
+		 * Read the output of <$SHELL -c cmd>.  
+		 * Escape any metacharacters in the command.
 		 */
-		if ((esccmd = esc_metachars(cmd)) == NULL)
+		esccmd = shell_quote(cmd);
+		if (esccmd == NULL)
 		{
-			/*
-			 * Cannot escape the metacharacters, so use quotes.
-			 * Read the output of <$SHELL -c "cmd">.
-			 */
-			scmd = (char *) ecalloc(strlen(shell) + strlen(cmd) + 7,
-						sizeof(char));
-			sprintf(scmd, "%s -c \"%s\"", shell, cmd);
+			fd = popen(cmd, "r");
 		} else
 		{
-			/*
-			 * Read the output of <$SHELL -c cmd>.  
-			 * No quotes; use the escaped cmd.
-			 */
 			scmd = (char *) ecalloc(strlen(shell) + strlen(esccmd) + 5,
 						sizeof(char));
-			sprintf(scmd, "%s -c %s", shell, esccmd);
+			sprintf(scmd, "%s %s %s", shell, shell_coption(), esccmd);
 			free(esccmd);
+			fd = popen(scmd, "r");
+			free(scmd);
 		}
-		fd = popen(scmd, "r");
-		free(scmd);
 	} else
 #endif
 	{
 		fd = popen(cmd, "r");
-		/*
-		 * Redirection in `popen' might have messed with the
-		 * standard devices.  Restore binary input mode.
-		 */
-		SET_BINARY(0);
 	}
+	/*
+	 * Redirection in `popen' might have messed with the
+	 * standard devices.  Restore binary input mode.
+	 */
+	SET_BINARY(0);
 	return (fd);
 }
 
@@ -582,7 +606,7 @@
 	ofilename = fexpand(filename);
 	if (secure)
 		return (ofilename);
-	filename = unquote_file(ofilename);
+	filename = shell_unquote(ofilename);
 
 #ifdef DECL_GLOB_LIST
 {
@@ -591,6 +615,7 @@
 	 */
 	int length;
 	char *p;
+	char *qfilename;
 	DECL_GLOB_LIST(list)
 
 	GLOB_LIST(filename, list);
@@ -603,23 +628,23 @@
 	for (SCAN_GLOB_LIST(list, p))
 	{
 		INIT_GLOB_LIST(list, p);
-	  	length += strlen(p) + 1;
-#if SPACES_IN_FILENAMES
-		if (strchr(p, ' ') != NULL)
-			length += 2; /* Allow for quotes */
-#endif
+		qfilename = shell_quote(p);
+		if (qfilename != NULL)
+		{
+	  		length += strlen(qfilename) + 1;
+			free(qfilename);
+		}
 	}
 	gfilename = (char *) ecalloc(length, sizeof(char));
 	for (SCAN_GLOB_LIST(list, p))
 	{
 		INIT_GLOB_LIST(list, p);
-#if SPACES_IN_FILENAMES
-		if (strchr(p, ' ') != NULL)
-			sprintf(gfilename + strlen(gfilename), "%c%s%c ",
-				openquote, p, closequote);
-		else
-#endif
-			sprintf(gfilename + strlen(gfilename), "%s ", p);
+		qfilename = shell_quote(p);
+		if (qfilename != NULL)
+		{
+			sprintf(gfilename + strlen(gfilename), "%s ", qfilename);
+			free(qfilename);
+		}
 	}
 	/*
 	 * Overwrite the final trailing space with a null terminator.
@@ -637,9 +662,8 @@
 	register char *p;
 	register int len;
 	register int n;
-#if SPACES_IN_FILENAMES
-	register int spaces_in_file;
-#endif
+	char *pathname;
+	char *qpathname;
 	DECL_GLOB_NAME(fnd,drive,dir,fname,ext,handle)
 	
 	GLOB_FIRST_NAME(filename, &fnd, handle);
@@ -655,36 +679,32 @@
 	p = gfilename;
 	do {
 		n = strlen(drive) + strlen(dir) + strlen(fnd.GLOB_NAME) + 1;
-#if SPACES_IN_FILENAMES
-		spaces_in_file = 0;
-		if (strchr(fnd.GLOB_NAME, ' ') != NULL ||
-		    strchr(filename, ' ') != NULL)
-		{
-			spaces_in_file = 1;
-			n += 2;
-		}
-#endif
-		while (p - gfilename + n+2 >= len)
+		pathname = (char *) ecalloc(n, sizeof(char));
+		sprintf(pathname, "%s%s%s", drive, dir, fnd.GLOB_NAME);
+		qpathname = shell_quote(pathname);
+		free(pathname);
+		if (qpathname != NULL)
 		{
-			/*
-			 * No room in current buffer.  Allocate a bigger one.
-			 */
-			len *= 2;
-			*p = '\0';
-			p = (char *) ecalloc(len, sizeof(char));
-			strcpy(p, gfilename);
-			free(gfilename);
-			gfilename = p;
-			p = gfilename + strlen(gfilename);
+			n = strlen(qpathname);
+			while (p - gfilename + n + 2 >= len)
+			{
+				/*
+				 * No room in current buffer.
+				 * Allocate a bigger one.
+				 */
+				len *= 2;
+				*p = '\0';
+				p = (char *) ecalloc(len, sizeof(char));
+				strcpy(p, gfilename);
+				free(gfilename);
+				gfilename = p;
+				p = gfilename + strlen(gfilename);
+			}
+			strcpy(p, qpathname);
+			free(qpathname);
+			p += n;
+			*p++ = ' ';
 		}
-#if SPACES_IN_FILENAMES
-		if (spaces_in_file)
-			sprintf(p, "%c%s%s%s%c ", openquote, 
-				drive, dir, fnd.GLOB_NAME, closequote);
-		else
-#endif
-			sprintf(p, "%s%s%s ", drive, dir, fnd.GLOB_NAME);
-		p += n;
 	} while (GLOB_NEXT_NAME(handle, &fnd) == 0);
 
 	/*
@@ -704,30 +724,30 @@
 	char *s;
 	char *lessecho;
 	char *cmd;
+	char *esc;
 
-	lessecho = lgetenv("LESSECHO");
-	if (lessecho == NULL || *lessecho == '\0')
-		lessecho = "lessecho";
-	s = esc_metachars(filename);
-	if (s == NULL)
+	esc = get_meta_escape();
+	if (strlen(esc) == 0)
+		esc = "-";
+	esc = shell_quote(esc);
+	if (esc == NULL)
 	{
-		/*
-		 * There may be dangerous metachars in this name.
-		 * We can't risk passing it to the shell.
-		 * {{ For example, do "!;TAB" when the first file 
-		 *    in the dir is named "rm". }}
-		 */
 		free(filename);
 		return (ofilename);
 	}
+	lessecho = lgetenv("LESSECHO");
+	if (lessecho == NULL || *lessecho == '\0')
+		lessecho = "lessecho";
 	/*
 	 * Invoke lessecho, and read its output (a globbed list of filenames).
 	 */
-	cmd = (char *) ecalloc(strlen(lessecho) + strlen(s) + 24, sizeof(char));
-	sprintf(cmd, "%s -p0x%x -d0x%x -- %s", 
-		lessecho, openquote, closequote, s);
+	cmd = (char *) ecalloc(strlen(lessecho) + strlen(ofilename) + (7*strlen(metachars())) + 24, sizeof(char));
+	sprintf(cmd, "%s -p0x%x -d0x%x -e%s ", lessecho, openquote, closequote, esc);
+	free(esc);
+	for (s = metachars();  *s != '\0';  s++)
+		sprintf(cmd + strlen(cmd), "-n0x%x ", *s);
+	sprintf(cmd + strlen(cmd), "-- %s", ofilename);
 	fd = shellcmd(cmd);
-	free(s);
 	free(cmd);
 	if (fd == NULL)
 	{
@@ -774,14 +794,13 @@
 	return (NULL);
 #else
 	char *lessopen;
-	char *gfilename;
 	char *cmd;
 	FILE *fd;
 #if HAVE_FILENO
 	int returnfd = 0;
 #endif
 	
-	if (secure)
+	if (!use_lessopen || secure)
 		return (NULL);
 	ch_ungetchar(-1);
 	if ((lessopen = lgetenv("LESSOPEN")) == NULL)
@@ -803,19 +822,10 @@
 #endif
 	}
 
-	gfilename = esc_metachars(filename);
-	if (gfilename == NULL)
-	{
-		/*
-		 * Cannot escape metacharacters.
-		 */
-		return (NULL);
-	}
-	cmd = (char *) ecalloc(strlen(lessopen) + strlen(gfilename) + 2, 
+	cmd = (char *) ecalloc(strlen(lessopen) + strlen(filename) + 2, 
 			sizeof(char));
-	sprintf(cmd, lessopen, gfilename);
+	sprintf(cmd, lessopen, filename);
 	fd = shellcmd(cmd);
-	free(gfilename);
 	free(cmd);
 	if (fd == NULL)
 	{
@@ -850,14 +860,14 @@
 		return (save("-"));
 	}
 #endif
-	gfilename = readfd(fd);
+	cmd = readfd(fd);
 	pclose(fd);
-	if (*gfilename == '\0')
+	if (*cmd == '\0')
 		/*
 		 * Pipe is empty.  This means there is no alt file.
 		 */
 		return (NULL);
-	return (gfilename);
+	return (cmd);
 #endif /* HAVE_POPEN */
 }
 
@@ -872,8 +882,6 @@
 {
 #if HAVE_POPEN
 	char *lessclose;
-	char *gfilename;
-	char *galtfilename;
 	FILE *fd;
 	char *cmd;
 	
@@ -892,23 +900,10 @@
 	}
 	if ((lessclose = lgetenv("LESSCLOSE")) == NULL)
 	     	return;
-	gfilename = esc_metachars(filename);
-	if (gfilename == NULL)
-	{
-		return;
-	}
-	galtfilename = esc_metachars(altfilename);
-	if (galtfilename == NULL)
-	{
-		free(gfilename);
-		return;
-	}
-	cmd = (char *) ecalloc(strlen(lessclose) + strlen(gfilename) + 
-			strlen(galtfilename) + 2, sizeof(char));
-	sprintf(cmd, lessclose, gfilename, galtfilename);
+	cmd = (char *) ecalloc(strlen(lessclose) + strlen(filename) + 
+			strlen(altfilename) + 2, sizeof(char));
+	sprintf(cmd, lessclose, filename, altfilename);
 	fd = shellcmd(cmd);
-	free(galtfilename);
-	free(gfilename);
 	free(cmd);
 	if (fd != NULL)
 		pclose(fd);
@@ -924,7 +919,7 @@
 {
 	int isdir = 0;
 
-	filename = unquote_file(filename);
+	filename = shell_unquote(filename);
 #if HAVE_STAT
 {
 	int r;
@@ -960,15 +955,15 @@
 {
 	register char *m = NULL;
 
-	filename = unquote_file(filename);
+	filename = shell_unquote(filename);
 	if (is_dir(filename))
 	{
-		static char is_dir[] = " is a directory";
+		static char is_a_dir[] = " is a directory";
 
-		m = (char *) ecalloc(strlen(filename) + sizeof(is_dir), 
+		m = (char *) ecalloc(strlen(filename) + sizeof(is_a_dir), 
 			sizeof(char));
 		strcpy(m, filename);
-		strcat(m, is_dir);
+		strcat(m, is_a_dir);
 	} else
 	{
 #if HAVE_STAT
@@ -1020,3 +1015,11 @@
 	return (seek_filesize(f));
 }
 
+/*
+ * 
+ */
+	public char *
+shell_coption()
+{
+	return ("-c");
+}
Index: contrib/less/forwback.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/forwback.c,v
retrieving revision 1.3
diff -u -r1.3 forwback.c
--- contrib/less/forwback.c	23 May 2000 08:18:52 -0000	1.3
+++ contrib/less/forwback.c	3 Jul 2003 19:20:27 -0000
@@ -1,6 +1,6 @@
 /* $FreeBSD: src/contrib/less/forwback.c,v 1.3 2000/05/23 08:18:52 ps Exp $ */
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
@@ -28,7 +28,6 @@
 extern int quiet;
 extern int sc_width, sc_height;
 extern int quit_at_eof;
-extern int more_mode;
 extern int plusoption;
 extern int forw_scroll;
 extern int back_scroll;
@@ -144,12 +143,9 @@
 			pos_clear();
 			add_forw_pos(pos);
 			force = 1;
-			if (more_mode == 0)
-			{
-				if (top_scroll == OPT_ONPLUS || first_time)
-					clear();
-				home();
-			}
+			if (top_scroll == OPT_ONPLUS || first_time)
+				clear();
+			home();
 		} else
 		{
 			clear_bot();
@@ -233,8 +229,7 @@
 		 * start the display after the beginning of the file,
 		 * and it is not appropriate to squish in that case.
 		 */
-		if ((first_time || more_mode) &&
-		    pos == NULL_POSITION && !top_scroll && 
+		if (first_time && pos == NULL_POSITION && !top_scroll && 
 #if TAGS
 		    tagoption == NULL &&
 #endif
Index: contrib/less/funcs.h
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/funcs.h,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 funcs.h
--- contrib/less/funcs.h	7 Jan 2002 20:29:19 -0000	1.1.1.3
+++ contrib/less/funcs.h	3 Jul 2003 19:03:04 -0000
@@ -43,7 +43,7 @@
 	public POSITION ch_tell ();
 	public int ch_forw_get ();
 	public int ch_back_get ();
-	public int ch_nbuf ();
+	public void ch_setbufspace ();
 	public void ch_flush ();
 	public int seekable ();
 	public void ch_init ();
@@ -62,7 +62,7 @@
 	public void cmd_addhist ();
 	public void cmd_accept ();
 	public int cmd_char ();
-	public int cmd_int ();
+	public LINENUM cmd_int ();
 	public char * get_cmdbuf ();
 	public int in_mca ();
 	public void dispversion ();
@@ -96,19 +96,20 @@
 	public int edit_stdin ();
 	public void cat_file ();
 	public void use_logfile ();
-	public char * unquote_file ();
+	public char * shell_unquote ();
+	public char * get_meta_escape ();
+	public char * shell_quote ();
 	public char * homefile ();
 	public char * fexpand ();
 	public char * fcomplete ();
 	public int bin_file ();
-	public char * esc_metachars ();
-	public char * esc_metachars ();
 	public char * lglob ();
 	public char * open_altfile ();
 	public void close_altfile ();
 	public int is_dir ();
 	public char * bad_file ();
 	public POSITION filesize ();
+	public char * shell_coption ();
 	public void forw ();
 	public void back ();
 	public void forward ();
@@ -152,9 +153,9 @@
 	public POSITION back_raw_line ();
 	public void clr_linenum ();
 	public void add_lnum ();
-	public int find_linenum ();
+	public LINENUM find_linenum ();
 	public POSITION find_pos ();
-	public int currline ();
+	public LINENUM currline ();
 	public void lsystem ();
 	public int pipe_mark ();
 	public int pipe_data ();
@@ -189,8 +190,8 @@
 	public void nopendopt ();
 	public int getnum ();
 	public void init_option ();
-	public struct option * findopt ();
-	public struct option * findopt_name ();
+	public struct loption * findopt ();
+	public struct loption * findopt_name ();
 	public int iread ();
 	public void intread ();
 	public long get_time ();
Index: contrib/less/help.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/help.c,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 help.c
--- contrib/less/help.c	7 Jan 2002 20:28:48 -0000	1.1.1.3
+++ contrib/less/help.c	3 Jul 2003 19:03:04 -0000
@@ -22,8 +22,8 @@
 ' ',' ','E','S','C','-','S','P','A','C','E',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','F','o','r','w','a','r','d',' ',' ','o','n','e',' ','w','i','n','d','o','w',',',' ','b','u','t',' ','d','o','n','\'','t',' ','s','t','o','p',' ','a','t',' ','e','n','d','-','o','f','-','f','i','l','e','.','\n',
 ' ',' ','d',' ',' ','^','D',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','F','o','r','w','a','r','d',' ',' ','o','n','e',' ','h','a','l','f','-','w','i','n','d','o','w',' ','(','a','n','d',' ','s','e','t',' ','h','a','l','f','-','w','i','n','d','o','w',' ','t','o',' ','_','\b','N',')','.','\n',
 ' ',' ','u',' ',' ','^','U',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','B','a','c','k','w','a','r','d',' ','o','n','e',' ','h','a','l','f','-','w','i','n','d','o','w',' ','(','a','n','d',' ','s','e','t',' ','h','a','l','f','-','w','i','n','d','o','w',' ','t','o',' ','_','\b','N',')','.','\n',
-' ',' ','E','S','C','-','(',' ',' ','R','i','g','h','t','A','r','r','o','w',' ','*',' ',' ','L','e','f','t',' ',' ','o','n','e',' ','h','a','l','f',' ','s','c','r','e','e','n',' ','w','i','d','t','h',' ','(','o','r',' ','_','\b','N',' ','p','o','s','i','t','i','o','n','s',')','.','\n',
-' ',' ','E','S','C','-',')',' ',' ','L','e','f','t','A','r','r','o','w',' ',' ','*',' ',' ','R','i','g','h','t',' ','o','n','e',' ','h','a','l','f',' ','s','c','r','e','e','n',' ','w','i','d','t','h',' ','(','o','r',' ','_','\b','N',' ','p','o','s','i','t','i','o','n','s',')','.','\n',
+' ',' ','E','S','C','-',')',' ',' ','R','i','g','h','t','A','r','r','o','w',' ','*',' ',' ','L','e','f','t',' ',' ','o','n','e',' ','h','a','l','f',' ','s','c','r','e','e','n',' ','w','i','d','t','h',' ','(','o','r',' ','_','\b','N',' ','p','o','s','i','t','i','o','n','s',')','.','\n',
+' ',' ','E','S','C','-','(',' ',' ','L','e','f','t','A','r','r','o','w',' ',' ','*',' ',' ','R','i','g','h','t',' ','o','n','e',' ','h','a','l','f',' ','s','c','r','e','e','n',' ','w','i','d','t','h',' ','(','o','r',' ','_','\b','N',' ','p','o','s','i','t','i','o','n','s',')','.','\n',
 ' ',' ','F',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','F','o','r','w','a','r','d',' ','f','o','r','e','v','e','r',';',' ','l','i','k','e',' ','"','t','a','i','l',' ','-','f','"','.','\n',
 ' ',' ','r',' ',' ','^','R',' ',' ','^','L',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','R','e','p','a','i','n','t',' ','s','c','r','e','e','n','.','\n',
 ' ',' ','R',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','R','e','p','a','i','n','t',' ','s','c','r','e','e','n',',',' ','d','i','s','c','a','r','d','i','n','g',' ','b','u','f','f','e','r','e','d',' ','i','n','p','u','t','.','\n',
@@ -146,6 +146,8 @@
 ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','i','s','p','l','a','y',' ','a',' ','s','t','a','t','u','s',' ','c','o','l','u','m','n',' ','a','t',' ','l','e','f','t',' ','e','d','g','e',' ','o','f',' ','s','c','r','e','e','n','.','\n',
 ' ',' ','-','k',' ','[','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']',' ',' ','.',' ',' ','-','-','l','e','s','s','k','e','y','-','f','i','l','e','=','[','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']','\n',
 ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','U','s','e',' ','a',' ','l','e','s','s','k','e','y',' ','f','i','l','e','.','\n',
+' ',' ','-','L',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','n','o','-','l','e','s','s','o','p','e','n','\n',
+' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','I','g','n','o','r','e',' ','t','h','e',' ','L','E','S','S','O','P','E','N',' ','e','n','v','i','r','o','n','m','e','n','t',' ','v','a','r','i','a','b','l','e','.','\n',
 ' ',' ','-','m',' ',' ','-','M',' ',' ','.','.','.','.',' ',' ','-','-','l','o','n','g','-','p','r','o','m','p','t',' ',' ','-','-','L','O','N','G','-','P','R','O','M','P','T','\n',
 ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','S','e','t',' ','p','r','o','m','p','t',' ','s','t','y','l','e','.','\n',
 ' ',' ','-','n',' ',' ','-','N',' ',' ','.','.','.','.',' ',' ','-','-','l','i','n','e','-','n','u','m','b','e','r','s',' ',' ','-','-','L','I','N','E','-','N','U','M','B','E','R','S','\n',
Index: contrib/less/ifile.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/ifile.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 ifile.c
--- contrib/less/ifile.c	22 May 2000 09:53:21 -0000	1.1.1.1
+++ contrib/less/ifile.c	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
Index: contrib/less/input.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/input.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 input.c
--- contrib/less/input.c	14 Jul 2000 09:50:53 -0000	1.1.1.2
+++ contrib/less/input.c	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
Index: contrib/less/jump.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/jump.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 jump.c
--- contrib/less/jump.c	22 May 2000 09:53:21 -0000	1.1.1.1
+++ contrib/less/jump.c	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
@@ -52,8 +52,8 @@
  * Jump to line n in the file.
  */
 	public void
-jump_back(n)
-	int n;
+jump_back(linenum)
+	LINENUM linenum;
 {
 	POSITION pos;
 	PARG parg;
@@ -64,20 +64,20 @@
 	 * If we can't seek, but we're trying to go to line number 1,
 	 * use ch_beg_seek() to get as close as we can.
 	 */
-	pos = find_pos(n);
+	pos = find_pos(linenum);
 	if (pos != NULL_POSITION && ch_seek(pos) == 0)
 	{
 		if (show_attn)
 			set_attnpos(pos);
 		jump_loc(pos, jump_sline);
-	} else if (n <= 1 && ch_beg_seek() == 0)
+	} else if (linenum <= 1 && ch_beg_seek() == 0)
 	{
 		jump_loc(ch_tell(), jump_sline);
 		error("Cannot seek to beginning of file", NULL_PARG);
 	} else
 	{
-		parg.p_int = n;
-		error("Cannot seek to line number %d", &parg);
+		parg.p_linenum = linenum;
+		error("Cannot seek to line number %n", &parg);
 	}
 }
 
Index: contrib/less/less.h
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/less.h,v
retrieving revision 1.4
diff -u -r1.4 less.h
--- contrib/less/less.h	7 Jan 2002 20:37:09 -0000	1.4
+++ contrib/less/less.h	3 Jul 2003 19:20:43 -0000
@@ -1,6 +1,6 @@
 /* $FreeBSD: src/contrib/less/less.h,v 1.4 2002/01/07 20:37:09 ps Exp $ */
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
@@ -155,6 +155,8 @@
  * Special types and constants.
  */
 typedef off_t		POSITION;
+typedef off_t		LINENUM;
+#define MIN_LINENUM_WIDTH  7	/* Min printing width of a line number */
 
 #define	NULL_POSITION	((POSITION)(-1))
 
@@ -232,6 +234,7 @@
 {
 	char *p_string;
 	int p_int;
+	LINENUM p_linenum;
 } PARG;
 
 #define	NULL_PARG	((PARG *)NULL)
@@ -410,3 +413,7 @@
 
 #include "funcs.h"
 
+/* Functions not included in funcs.h */
+void postoa();
+void linenumtoa();
+void inttoa();
Index: contrib/less/less.hlp
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/less.hlp,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 less.hlp
--- contrib/less/less.hlp	7 Jan 2002 20:29:35 -0000	1.1.1.3
+++ contrib/less/less.hlp	3 Jul 2003 19:03:04 -0000
@@ -19,8 +19,8 @@
   ESC-SPACE         *  Forward  one window, but don't stop at end-of-file.
   d  ^D             *  Forward  one half-window (and set half-window to _N).
   u  ^U             *  Backward one half-window (and set half-window to _N).
-  ESC-(  RightArrow *  Left  one half screen width (or _N positions).
-  ESC-)  LeftArrow  *  Right one half screen width (or _N positions).
+  ESC-)  RightArrow *  Left  one half screen width (or _N positions).
+  ESC-(  LeftArrow  *  Right one half screen width (or _N positions).
   F                    Forward forever; like "tail -f".
   r  ^R  ^L            Repaint screen.
   R                    Repaint screen, discarding buffered input.
@@ -143,6 +143,8 @@
                   Display a status column at left edge of screen.
   -k [_f_i_l_e]  .  --lesskey-file=[_f_i_l_e]
                   Use a lesskey file.
+  -L  ........  --no-lessopen
+                  Ignore the LESSOPEN environment variable.
   -m  -M  ....  --long-prompt  --LONG-PROMPT
                   Set prompt style.
   -n  -N  ....  --line-numbers  --LINE-NUMBERS
Index: contrib/less/less.man
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/less.man,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 less.man
--- contrib/less/less.man	7 Jan 2002 20:29:33 -0000	1.1.1.3
+++ contrib/less/less.man	3 Jul 2003 19:03:04 -0000
@@ -12,11 +12,11 @@
        lleessss ----hheellpp
        lleessss --VV
        lleessss ----vveerrssiioonn
-       lleessss [[--[[++]]aaBBccCCddeeEEffFFggGGiiIIJJmmMMnnNNqqQQrrRRssSSuuUUVVwwWWXX]]
-            [[--bb _b_u_f_s]] [[--hh _l_i_n_e_s]] [[--jj _l_i_n_e]] [[--kk _k_e_y_f_i_l_e]]
+       lleessss [[--[[++]]aaBBccCCddeeEEffFFggGGiiIIJJLLmmMMnnNNqqQQrrRRssSSuuUUVVwwWWXX~~]]
+            [[--bb _s_p_a_c_e]] [[--hh _l_i_n_e_s]] [[--jj _l_i_n_e]] [[--kk _k_e_y_f_i_l_e]]
             [[--{{ooOO}} _l_o_g_f_i_l_e]] [[--pp _p_a_t_t_e_r_n]] [[--PP _p_r_o_m_p_t]] [[--tt _t_a_g]]
             [[--TT _t_a_g_s_f_i_l_e]] [[--xx _t_a_b,,......]] [[--yy _l_i_n_e_s]] [[--[[zz]] _l_i_n_e_s]]
-            [[++[[++]]_c_m_d]] [[----]] [[_f_i_l_e_n_a_m_e]]......
+            [[--## _s_h_i_f_t]] [[++[[++]]_c_m_d]] [[----]] [[_f_i_l_e_n_a_m_e]]......
        (See  the OPTIONS section for alternate option syntax with
        long option names.)
 
@@ -61,7 +61,7 @@
 
 
 
-                     Version 371: 26 Dec 2001                   1
+                     Version 381: 17 Jan 2003                   1
 
 
 
@@ -127,7 +127,7 @@
 
 
 
-                     Version 371: 26 Dec 2001                   2
+                     Version 381: 17 Jan 2003                   2
 
 
 
@@ -193,7 +193,7 @@
 
 
 
-                     Version 371: 26 Dec 2001                   3
+                     Version 381: 17 Jan 2003                   3
 
 
 
@@ -259,7 +259,7 @@
 
 
 
-                     Version 371: 26 Dec 2001                   4
+                     Version 381: 17 Jan 2003                   4
 
 
 
@@ -325,7 +325,7 @@
 
 
 
-                     Version 371: 26 Dec 2001                   5
+                     Version 381: 17 Jan 2003                   5
 
 
 
@@ -391,7 +391,7 @@
 
 
 
-                     Version 371: 26 Dec 2001                   6
+                     Version 381: 17 Jan 2003                   6
 
 
 
@@ -457,7 +457,7 @@
 
 
 
-                     Version 371: 26 Dec 2001                   7
+                     Version 381: 17 Jan 2003                   7
 
 
 
@@ -523,7 +523,7 @@
 
 
 
-                     Version 371: 26 Dec 2001                   8
+                     Version 381: 17 Jan 2003                   8
 
 
 
@@ -589,7 +589,7 @@
 
 
 
-                     Version 371: 26 Dec 2001                   9
+                     Version 381: 17 Jan 2003                   9
 
 
 
@@ -603,23 +603,27 @@
               the last found line; see the -j option).
 
        -b_n or --buffers=_n
-              Specifies the number of buffers _l_e_s_s will  use  for
-              each  file.   Buffers  are  1K,  and  by default 10
-              buffers are used for each file (except if the  file
-              is a pipe; see the -B option).  The number _n speci­
-              fies a different number of buffers to use.
+              Specifies the amount of buffer space _l_e_s_s will  use
+              for  each file, in units of kilobytes (1024 bytes).
+              By default 64K of buffer space  is  used  for  each
+              file  (unless  the  file  is  a  pipe;  see  the -B
+              option).  The -b option specifies  instead  that  _n
+              kilobytes  of  buffer space should be used for each
+              file.  If _n is -1, buffer space is unlimited;  that
+              is, the entire file is read into memory.
 
        -B or --auto-buffers
-              By default, when data is read from a pipe,  buffers
-              are  allocated automatically as needed.  If a large
-              amount of data is read  from  the  pipe,  this  can
-              cause  a  large  amount  of memory to be allocated.
+              By  default, when data is read from a pipe, buffers
+              are allocated automatically as needed.  If a  large
+              amount  of  data  is  read  from the pipe, this can
+              cause a large amount of  memory  to  be  allocated.
               The -B option disables this automatic allocation of
-              buffers  for  pipes,  so  that  only  the number of
-              buffers specified by the -b option are used.  Warn­
-              ing:  use  of  -B  can result in erroneous display,
-              since only the most recently  viewed  part  of  the
-              file is kept in memory; any earlier data is lost.
+              buffers for pipes, so that only 64K (or the  amount
+              of  space  specified  by the -b option) is used for
+              the pipe.  Warning: use of -B can result  in  erro­
+              neous  display, since only the most recently viewed
+              part of the file is kept  in  memory;  any  earlier
+              data is lost.
 
        -c or --clear-screen
               Causes  full screen repaints to be painted from the
@@ -637,7 +641,7 @@
               some  important  capability, such as the ability to
               clear the screen or scroll backward.  The -d option
               does not otherwise change the behavior of _l_e_s_s on a
-              dumb terminal).
+              dumb terminal.
 
        -Dxx_c_o_l_o_r or --color=xx_c_o_l_o_r
               [MS-DOS only] Sets the color of the text displayed.
@@ -649,13 +653,9 @@
               selects the background color of the text.  A single
               number _N is the same as _N_._0.
 
-       -e or --quit-at-eof
-              Causes  _l_e_s_s  to automatically exit the second time
-              it reaches end-of-file.  By default, the  only  way
 
 
-
-                     Version 371: 26 Dec 2001                  10
+                     Version 381: 17 Jan 2003                  10
 
 
 
@@ -664,6 +664,9 @@
 LESS(1)                                                   LESS(1)
 
 
+       -e or --quit-at-eof
+              Causes  _l_e_s_s  to automatically exit the second time
+              it reaches end-of-file.  By default, the  only  way
               to exit _l_e_s_s is via the "q" command.
 
        -E or --QUIT-AT-EOF
@@ -715,13 +718,10 @@
        -j_n or --jump-target=_n
               Specifies  a  line on the screen where the "target"
               line is to be positioned.  A  target  line  is  the
-              object of a text search, tag search, jump to a line
-              number, jump to a file percentage,  or  jump  to  a
-              marked position.  The screen line is specified by a
 
 
 
-                     Version 371: 26 Dec 2001                  11
+                     Version 381: 17 Jan 2003                  11
 
 
 
@@ -730,6 +730,9 @@
 LESS(1)                                                   LESS(1)
 
 
+              object of a text search, tag search, jump to a line
+              number, jump to a file percentage,  or  jump  to  a
+              marked position.  The screen line is specified by a
               number: the top line on the screen is 1,  the  next
               is  2,  and  so  on.  The number may be negative to
               specify a  line  relative  to  the  bottom  of  the
@@ -755,6 +758,13 @@
               found in a standard place (see KEY BINDINGS), it is
               also used as a _l_e_s_s_k_e_y file.
 
+       -L or --no-lessopen
+              Ignore  the  LESSOPEN environment variable (see the
+              INPUT PREPROCESSOR section below).  This option can
+              be  set from within _l_e_s_s, but it will apply only to
+              files opened subsequently, not to the file which is
+              currently open.
+
        -m or --long-prompt
               Causes  _l_e_s_s  to prompt verbosely (like _m_o_r_e), with
               the  percent  into  the  file.   By  default,  _l_e_s_s
@@ -775,19 +785,9 @@
               the current line number to the editor (see also the
               discussion of LESSEDIT in PROMPTS below).
 
-       -N or --LINE-NUMBERS
-              Causes a line number to be displayed at the  begin­
-              ning of each line in the display.
-
-       -o_f_i_l_e_n_a_m_e or --log-file=_f_i_l_e_n_a_m_e
-              Causes  _l_e_s_s to copy its input to the named file as
-              it is being viewed.  This  applies  only  when  the
-              input file is a pipe, not an ordinary file.  If the
-              file already exists, _l_e_s_s will ask for confirmation
-
 
 
-                     Version 371: 26 Dec 2001                  12
+                     Version 381: 17 Jan 2003                  12
 
 
 
@@ -796,6 +796,15 @@
 LESS(1)                                                   LESS(1)
 
 
+       -N or --LINE-NUMBERS
+              Causes a line number to be displayed at the  begin­
+              ning of each line in the display.
+
+       -o_f_i_l_e_n_a_m_e or --log-file=_f_i_l_e_n_a_m_e
+              Causes  _l_e_s_s to copy its input to the named file as
+              it is being viewed.  This  applies  only  when  the
+              input file is a pipe, not an ordinary file.  If the
+              file already exists, _l_e_s_s will ask for confirmation
               before overwriting it.
 
        -O_f_i_l_e_n_a_m_e or --LOG-FILE=_f_i_l_e_n_a_m_e
@@ -841,19 +850,10 @@
               The  default  is  to  ring the terminal bell in all
               such cases.
 
-       -Q or --QUIET or --SILENT
-              Causes totally "quiet" operation: the terminal bell
-              is never rung.
-
-       -r or --raw-control-chars
-              Causes  "raw"  control  characters to be displayed.
-              The default is to display control characters  using
-              the caret notation; for example, a control-A (octal
-              001) is displayed as "^A".  Warning:  when  the  -r
 
 
 
-                     Version 371: 26 Dec 2001                  13
+                     Version 381: 17 Jan 2003                  13
 
 
 
@@ -862,6 +862,15 @@
 LESS(1)                                                   LESS(1)
 
 
+       -Q or --QUIET or --SILENT
+              Causes totally "quiet" operation: the terminal bell
+              is never rung.
+
+       -r or --raw-control-chars
+              Causes  "raw"  control  characters to be displayed.
+              The default is to display control characters  using
+              the caret notation; for example, a control-A (octal
+              001) is displayed as "^A".  Warning:  when  the  -r
               option  is  used,  _l_e_s_s  cannot  keep  track of the
               actual appearance of the screen (since this depends
               on  how the screen responds to each type of control
@@ -895,31 +904,22 @@
 
        -S or --chop-long-lines
               Causes lines longer than the  screen  width  to  be
-              chopped rather than folded.  That is, the remainder
-              of a long line is simply discarded.  The default is
-              to  fold long lines; that is, display the remainder
-              on the next line.
+              chopped  rather  than folded.  That is, the portion
+              of a long line that does  not  fit  in  the  screen
+              width  is  not  shown.  The default is to fold long
+              lines; that is, display the remainder on  the  next
+              line.
 
        -t_t_a_g or --tag=_t_a_g
-              The -t option, followed immediately by a TAG,  will
-              edit  the  file  containing  that tag.  For this to
-              work, tag information must be available; for  exam­
-              ple,  there  may be a file in the current directory
-              called "tags", which was previously built by  _c_t_a_g_s
-              (1)  or  an equivalent command.  If the environment
-              variable LESSGLOBALTAGS is set, it is taken  to  be
-              the  name  of a command compatible with _g_l_o_b_a_l (1),
-              and that command is executed to find the tag.  (See
-              http://www.gnu.org/software/global/global.html).
-              The -t option may also  be  specified  from  within
-              _l_e_s_s  (using the - command) as a way of examining a
-              new file.  The command ":t" is equivalent to speci­
-              fying -t from within _l_e_s_s_.
-
+              The  -t option, followed immediately by a TAG, will
+              edit the file containing that  tag.   For  this  to
+              work,  tag information must be available; for exam­
+              ple, there may be a file in the  current  directory
+              called  "tags", which was previously built by _c_t_a_g_s
 
 
 
-                     Version 371: 26 Dec 2001                  14
+                     Version 381: 17 Jan 2003                  14
 
 
 
@@ -928,32 +928,42 @@
 LESS(1)                                                   LESS(1)
 
 
+              (1) or an equivalent command.  If  the  environment
+              variable  LESSGLOBALTAGS  is set, it is taken to be
+              the name of a command compatible with  _g_l_o_b_a_l  (1),
+              and that command is executed to find the tag.  (See
+              http://www.gnu.org/software/global/global.html).
+              The  -t  option  may  also be specified from within
+              _l_e_s_s (using the - command) as a way of examining  a
+              new file.  The command ":t" is equivalent to speci­
+              fying -t from within _l_e_s_s_.
+
        -T_t_a_g_s_f_i_l_e or --tag-file=_t_a_g_s_f_i_l_e
               Specifies a tags file to be used instead of "tags".
 
        -u or --underline-special
-              Causes  backspaces  and  carriage  returns  to   be
-              treated  as printable characters; that is, they are
+              Causes   backspaces  and  carriage  returns  to  be
+              treated as printable characters; that is, they  are
               sent to the terminal when they appear in the input.
 
        -U or --UNDERLINE-SPECIAL
-              Causes  backspaces, tabs and carriage returns to be
-              treated as control characters; that  is,  they  are
+              Causes backspaces, tabs and carriage returns to  be
+              treated  as  control  characters; that is, they are
               handled as specified by the -r option.
 
-              By   default,  if  neither  -u  nor  -U  is  given,
-              backspaces which appear adjacent to  an  underscore
-              character  are  treated  specially:  the underlined
-              text is displayed  using  the  terminal's  hardware
+              By  default,  if  neither  -u  nor  -U  is   given,
+              backspaces  which  appear adjacent to an underscore
+              character are  treated  specially:  the  underlined
+              text  is  displayed  using  the terminal's hardware
               underlining  capability.   Also,  backspaces  which
               appear between two identical characters are treated
               specially: the overstruck text is printed using the
               terminal's  hardware  boldface  capability.   Other
-              backspaces  are  deleted,  along with the preceding
-              character.  Carriage returns  immediately  followed
-              by  a  newline are deleted.  other carriage returns
-              are handled as specified by the  -r  option.   Text
-              which  is  overstruck or underlined can be searched
+              backspaces are deleted, along  with  the  preceding
+              character.   Carriage  returns immediately followed
+              by a newline are deleted.  other  carriage  returns
+              are  handled  as  specified by the -r option.  Text
+              which is overstruck or underlined can  be  searched
               for if neither -u nor -U is in effect.
 
        -V or --version
@@ -961,31 +971,21 @@
 
        -w or --hilite-unread
               Temporarily highlights the first "new" line after a
-              forward  movement  of a full page.  The first "new"
-              line is the line  immediately  following  the  line
+              forward movement of a full page.  The  first  "new"
+              line  is  the  line  immediately following the line
               previously at the bottom of the screen.  Also high­
               lights the target line after a g or p command.  The
-              highlight  is  removed  at  the  next command which
-              causes movement.  The entire line  is  highlighted,
-              unless  the  -J  option is in effect, in which case
+              highlight is removed  at  the  next  command  which
+              causes  movement.   The entire line is highlighted,
+              unless the -J option is in effect,  in  which  case
               only the status column is highlighted.
 
        -W or --HILITE-UNREAD
-              Like -w, but temporarily highlights the  first  new
-              line after any forward movement command larger than
-              one line.
-
-       -x_n,... or --tabs=_n,...
-              Sets tab stops.  If only one _n  is  specified,  tab
-              stops  are set at multiples of _n.  If multiple val­
-              ues separated by commas are  specified,  tab  stops
-              are  set at those positions, and then continue with
-              the same spacing as the  last  two.   For  example,
-              _-_x_9_,_1_7  will  set  tabs at positions 9, 17, 25, 33,
+              Like  -w,  but temporarily highlights the first new
 
 
 
-                     Version 371: 26 Dec 2001                  15
+                     Version 381: 17 Jan 2003                  15
 
 
 
@@ -994,64 +994,64 @@
 LESS(1)                                                   LESS(1)
 
 
+              line after any forward movement command larger than
+              one line.
+
+       -x_n,... or --tabs=_n,...
+              Sets  tab  stops.   If only one _n is specified, tab
+              stops are set at multiples of _n.  If multiple  val­
+              ues  separated  by  commas are specified, tab stops
+              are set at those positions, and then continue  with
+              the  same  spacing  as  the last two.  For example,
+              _-_x_9_,_1_7 will set tabs at positions 9,  17,  25,  33,
               etc.  The default for _n is 8.
 
        -X or --no-init
-              Disables sending  the  termcap  initialization  and
-              deinitialization  strings to the terminal.  This is
-              sometimes desirable if the deinitialization  string
-              does   something  unnecessary,  like  clearing  the
+              Disables  sending  the  termcap  initialization and
+              deinitialization strings to the terminal.  This  is
+              sometimes  desirable if the deinitialization string
+              does  something  unnecessary,  like  clearing   the
               screen.
 
        --no-keypad
               Disables  sending  the  keypad  initialization  and
-              deinitialization  strings to the terminal.  This is
-              sometimes useful if the  keypad  strings  make  the
+              deinitialization strings to the terminal.  This  is
+              sometimes  useful  if  the  keypad strings make the
               numeric keypad behave in an undesirable manner.
 
        -y_n or --max-forw-scroll=_n
-              Specifies  a maximum number of lines to scroll for­
-              ward.  If it is necessary to  scroll  forward  more
+              Specifies a maximum number of lines to scroll  for­
+              ward.   If  it  is necessary to scroll forward more
               than _n lines, the screen is repainted instead.  The
               -c or -C option may be used to repaint from the top
-              of  the screen if desired.  By default, any forward
+              of the screen if desired.  By default, any  forward
               movement causes scrolling.
 
        -[z]_n or --window=_n
-              Changes the default  scrolling  window  size  to  _n
-              lines.   The default is one screenful.  The z and w
-              commands can also be  used  to  change  the  window
-              size.   The  "z"  may  be omitted for compatibility
-              with _m_o_r_e_.  If the number _n is negative,  it  indi­
-              cates  _n  lines  less than the current screen size.
-              For example, if the screen is 24 lines,  _-_z_-_4  sets
+              Changes  the  default  scrolling  window  size to _n
+              lines.  The default is one screenful.  The z and  w
+              commands  can  also  be  used  to change the window
+              size.  The "z" may  be  omitted  for  compatibility
+              with  _m_o_r_e_.   If the number _n is negative, it indi­
+              cates _n lines less than the  current  screen  size.
+              For  example,  if the screen is 24 lines, _-_z_-_4 sets
               the scrolling window to 20 lines.  If the screen is
               resized to 40 lines, the scrolling window automati­
               cally changes to 36 lines.
 
-       -"_c_c or --quotes=_c_c
-              Changes  the  filename quoting character.  This may
+       -_"_c_c or --quotes=_c_c
+              Changes the filename quoting character.   This  may
               be necessary if you are trying to name a file which
-              contains  both  spaces  and quote characters.  Fol­
+              contains both spaces and  quote  characters.   Fol­
               lowed by a single character, this changes the quote
-              character  to that character.  Filenames containing
+              character to that character.  Filenames  containing
               a space should then be surrounded by that character
-              rather  than  by  double  quotes.   Followed by two
-              characters, changes the open  quote  to  the  first
-              character,  and the close quote to the second char­
-              acter.  Filenames containing a space should then be
-              preceded  by  the open quote character and followed
-              by the close quote character.  Note that even after
-              the  quote  characters  are  changed,  this  option
-              remains -" (a dash followed by a double quote).
-
-       -~ or --tilde
-              Normally lines after end of file are displayed as a
-              single  tilde  (~).  This option causes lines after
+              rather than by  double  quotes.   Followed  by  two
+              characters,  changes  the  open  quote to the first
 
 
 
-                     Version 371: 26 Dec 2001                  16
+                     Version 381: 17 Jan 2003                  16
 
 
 
@@ -1060,72 +1060,81 @@
 LESS(1)                                                   LESS(1)
 
 
+              character, and the close quote to the second  char­
+              acter.  Filenames containing a space should then be
+              preceded by the open quote character  and  followed
+              by the close quote character.  Note that even after
+              the  quote  characters  are  changed,  this  option
+              remains -" (a dash followed by a double quote).
+
+       -~ or --tilde
+              Normally lines after end of file are displayed as a
+              single tilde (~).  This option causes  lines  after
               end of file to be displayed as blank lines.
 
        -# or --shift
               Specifies the default number of positions to scroll
-              horizontally  in  the RIGHTARROW and LEFTARROW com­
-              mands.  If the number specified is  zero,  it  sets
-              the  default number of positions to one half of the
+              horizontally in the RIGHTARROW and  LEFTARROW  com­
+              mands.   If  the  number specified is zero, it sets
+              the default number of positions to one half of  the
               screen width.
 
-       --     A command line argument of "--" marks  the  end  of
+       --     A  command  line  argument of "--" marks the end of
               option arguments.  Any arguments following this are
-              interpreted as filenames.  This can be useful  when
+              interpreted  as filenames.  This can be useful when
               viewing a file whose name begins with a "-" or "+".
 
        +      If a command line option begins with ++, the remain­
-              der  of  that option is taken to be an initial com­
-              mand to _l_e_s_s_.  For example, +G tells _l_e_s_s to  start
-              at  the  end of the file rather than the beginning,
+              der of that option is taken to be an  initial  com­
+              mand  to _l_e_s_s_.  For example, +G tells _l_e_s_s to start
+              at the end of the file rather than  the  beginning,
               and +/xyz tells it to start at the first occurrence
               of "xyz" in the file.  As a special case, +<number>
-              acts like +<number>g; that is, it starts  the  dis­
+              acts  like  +<number>g; that is, it starts the dis­
               play at the specified line number (however, see the
               caveat under the "g" command above).  If the option
-              starts  with  ++,  the  initial  command applies to
-              every file being viewed, not just  the  first  one.
+              starts with ++,  the  initial  command  applies  to
+              every  file  being  viewed, not just the first one.
               The + command described previously may also be used
-              to set (or change) an  initial  command  for  every
+              to  set  (or  change)  an initial command for every
               file.
 
 
 LLIINNEE EEDDIITTIINNGG
-       When  entering  command  line  at the bottom of the screen
-       (for example, a filename for the :e command, or  the  pat­
-       tern  for  a  search command), certain keys can be used to
+       When entering command line at the  bottom  of  the  screen
+       (for  example,  a filename for the :e command, or the pat­
+       tern for a search command), certain keys can  be  used  to
        manipulate the command line.  Most commands have an alter­
-       nate  form in [ brackets ] which can be used if a key does
-       not exist on a particular keyboard.  (The bracketed  forms
-       do  not work in the MS-DOS version.)  Any of these special
-       keys may be entered literally by  preceding  it  with  the
-       "literal"  character, either ^V or ^A.  A backslash itself
+       nate form in [ brackets ] which can be used if a key  does
+       not  exist on a particular keyboard.  (The bracketed forms
+       do not work in the MS-DOS version.)  Any of these  special
+       keys  may  be  entered  literally by preceding it with the
+       "literal" character, either ^V or ^A.  A backslash  itself
        may also be entered literally by entering two backslashes.
 
        LEFTARROW [ ESC-h ]
               Move the cursor one space to the left.
 
-       RIGHTARROW [ ESC-l ]
-              Move the cursor one space to the right.
 
-       ^LEFTARROW [ ESC-b or ESC-LEFTARROW ]
-              (That  is,  CONTROL  and LEFTARROW simultaneously.)
-              Move the cursor one word to the left.
-
-       ^RIGHTARROW [ ESC-w or ESC-RIGHTARROW ]
-              (That is, CONTROL and  RIGHTARROW  simultaneously.)
 
+                     Version 381: 17 Jan 2003                  17
 
 
-                     Version 371: 26 Dec 2001                  17
 
 
 
+LESS(1)                                                   LESS(1)
 
 
-LESS(1)                                                   LESS(1)
+       RIGHTARROW [ ESC-l ]
+              Move the cursor one space to the right.
 
+       ^LEFTARROW [ ESC-b or ESC-LEFTARROW ]
+              (That is, CONTROL  and  LEFTARROW  simultaneously.)
+              Move the cursor one word to the left.
 
+       ^RIGHTARROW [ ESC-w or ESC-RIGHTARROW ]
+              (That  is,  CONTROL and RIGHTARROW simultaneously.)
               Move the cursor one word to the right.
 
        HOME [ ESC-0 ]
@@ -1135,18 +1144,18 @@
               Move the cursor to the end of the line.
 
        BACKSPACE
-              Delete  the character to the left of the cursor, or
+              Delete the character to the left of the cursor,  or
               cancel the command if the command line is empty.
 
        DELETE or [ ESC-x ]
               Delete the character under the cursor.
 
        ^BACKSPACE [ ESC-BACKSPACE ]
-              (That is, CONTROL  and  BACKSPACE  simultaneously.)
+              (That  is,  CONTROL  and BACKSPACE simultaneously.)
               Delete the word to the left of the cursor.
 
        ^DELETE [ ESC-X or ESC-DELETE ]
-              (That   is,  CONTROL  and  DELETE  simultaneously.)
+              (That  is,  CONTROL  and  DELETE   simultaneously.)
               Delete the word under the cursor.
 
        UPARROW [ ESC-k ]
@@ -1155,35 +1164,26 @@
        DOWNARROW [ ESC-j ]
               Retrieve the next command line.
 
-       TAB    Complete the partial filename to the  left  of  the
-              cursor.   If it matches more than one filename, the
-              first match  is  entered  into  the  command  line.
-              Repeated  TABs  will  cycle thru the other matching
-              filenames.  If the completed filename is  a  direc­
-              tory,  a  "/" is appended to the filename.  (On MS-
-              DOS systems, a "\" is appended.)   The  environment
-              variable  LESSSEPARATOR  can  be  used to specify a
-              different character to append to a directory  name.
+       TAB    Complete  the  partial  filename to the left of the
+              cursor.  If it matches more than one filename,  the
+              first  match  is  entered  into  the  command line.
+              Repeated TABs will cycle thru  the  other  matching
+              filenames.   If  the completed filename is a direc­
+              tory, a "/" is appended to the filename.   (On  MS-
+              DOS  systems,  a "\" is appended.)  The environment
+              variable LESSSEPARATOR can be  used  to  specify  a
+              different  character to append to a directory name.
 
        BACKTAB [ ESC-TAB ]
               Like, TAB, but cycles in the reverse direction thru
               the matching filenames.
 
-       ^L     Complete the partial filename to the  left  of  the
-              cursor.   If it matches more than one filename, all
-              matches are entered into the command line (if  they
-              fit).
+       ^L     Complete  the  partial  filename to the left of the
+              cursor.  If it matches more than one filename,  all
 
-       ^U (Unix and OS/2) or ESC (MS-DOS)
-              Delete  the entire command line, or cancel the com­
-              mand if the command line is  empty.   If  you  have
-              changed  your  line-kill character in Unix to some­
-              thing other than ^U, that character is used instead
-              of ^U.
 
 
-
-                     Version 371: 26 Dec 2001                  18
+                     Version 381: 17 Jan 2003                  18
 
 
 
@@ -1192,64 +1192,64 @@
 LESS(1)                                                   LESS(1)
 
 
+              matches  are entered into the command line (if they
+              fit).
+
+       ^U (Unix and OS/2) or ESC (MS-DOS)
+              Delete the entire command line, or cancel the  com­
+              mand  if  the  command  line is empty.  If you have
+              changed your line-kill character in Unix  to  some­
+              thing other than ^U, that character is used instead
+              of ^U.
+
+
 KKEEYY BBIINNDDIINNGGSS
        You may define your own _l_e_s_s commands by using the program
        _l_e_s_s_k_e_y (1) to create a lesskey file.  This file specifies
-       a  set  of command keys and an action associated with each
-       key.  You may also use _l_e_s_s_k_e_y to change the  line-editing
+       a set of command keys and an action associated  with  each
+       key.   You may also use _l_e_s_s_k_e_y to change the line-editing
        keys (see LINE EDITING), and to set environment variables.
        If the environment variable LESSKEY is set, _l_e_s_s uses that
        as the name of the lesskey file.  Otherwise, _l_e_s_s looks in
-       a standard place for the lesskey file:  On  Unix  systems,
-       _l_e_s_s  looks  for  a lesskey file called "$HOME/.less".  On
-       MS-DOS and Windows systems, _l_e_s_s looks for a lesskey  file
-       called  "$HOME/_less",  and if it is not found there, then
-       looks for a lesskey file called "_less" in  any  directory
-       specified  in the PATH environment variable.  On OS/2 sys­
-       tems,   _l_e_s_s   looks   for   a   lesskey    file    called
+       a  standard  place  for the lesskey file: On Unix systems,
+       _l_e_s_s looks for a lesskey file  called  "$HOME/.less".   On
+       MS-DOS  and Windows systems, _l_e_s_s looks for a lesskey file
+       called "$HOME/_less", and if it is not found  there,  then
+       looks  for  a lesskey file called "_less" in any directory
+       specified in the PATH environment variable.  On OS/2  sys­
+       tems,    _l_e_s_s    looks   for   a   lesskey   file   called
        "$HOME/less.ini", and if it is not found, then looks for a
-       lesskey file called "less.ini" in any directory  specified
-       in  the  INIT  environment  variable,  and if it not found
-       there, then looks for a lesskey file called "less.ini"  in
-       any  directory specified in the PATH environment variable.
+       lesskey  file called "less.ini" in any directory specified
+       in the INIT environment variable,  and  if  it  not  found
+       there,  then looks for a lesskey file called "less.ini" in
+       any directory specified in the PATH environment  variable.
        See the _l_e_s_s_k_e_y manual page for more details.
 
-       A system-wide lesskey file may also be set up  to  provide
+       A  system-wide  lesskey file may also be set up to provide
        key bindings.  If a key is defined in both a local lesskey
-       file and in the system-wide  file,  key  bindings  in  the
-       local  file  take precedence over those in the system-wide
-       file.  If the environment variable LESSKEY_SYSTEM is  set,
-       _l_e_s_s  uses  that  as  the  name of the system-wide lesskey
-       file.  Otherwise, _l_e_s_s looks in a standard place  for  the
+       file  and  in  the  system-wide  file, key bindings in the
+       local file take precedence over those in  the  system-wide
+       file.   If the environment variable LESSKEY_SYSTEM is set,
+       _l_e_s_s uses that as the  name  of  the  system-wide  lesskey
+       file.   Otherwise,  _l_e_s_s looks in a standard place for the
        system-wide lesskey file: On Unix systems, the system-wide
        lesskey file is /usr/local/etc/sysless.  (However, if _l_e_s_s
-       was   built   with  a  different  sysconf  directory  than
-       /usr/local/etc, that directory is where the  sysless  file
+       was  built  with  a  different  sysconf   directory   than
+       /usr/local/etc,  that  directory is where the sysless file
        is found.)  On MS-DOS and Windows systems, the system-wide
        lesskey file is c:\_sysless.  On OS/2 systems, the system-
        wide lesskey file is c:\sysless.ini.
 
 
 IINNPPUUTT PPRREEPPRROOCCEESSSSOORR
-       You  may  define an "input preprocessor" for _l_e_s_s_.  Before
-       _l_e_s_s opens a file, it first gives your input  preprocessor
-       a  chance  to  modify the way the contents of the file are
-       displayed.  An input preprocessor is simply an  executable
-       program  (or  shell  script), which writes the contents of
-       the file to a different file, called the replacement file.
-       The contents of the replacement file are then displayed in
-       place of the contents of the original file.   However,  it
-       will appear to the user as if the original file is opened;
-       that is, _l_e_s_s will display the original  filename  as  the
-       name of the current file.
-
-       An  input preprocessor receives one command line argument,
-       the original filename, as entered by the user.  It  should
-       create  the replacement file, and when finished, print the
+       You may define an "input preprocessor" for  _l_e_s_s_.   Before
+       _l_e_s_s  opens a file, it first gives your input preprocessor
+       a chance to modify the way the contents of  the  file  are
+       displayed.   An input preprocessor is simply an executable
 
 
 
-                     Version 371: 26 Dec 2001                  19
+                     Version 381: 17 Jan 2003                  19
 
 
 
@@ -1258,32 +1258,43 @@
 LESS(1)                                                   LESS(1)
 
 
-       name of the replacement file to its standard  output.   If
+       program (or shell script), which writes  the  contents  of
+       the file to a different file, called the replacement file.
+       The contents of the replacement file are then displayed in
+       place  of  the contents of the original file.  However, it
+       will appear to the user as if the original file is opened;
+       that  is,  _l_e_s_s  will display the original filename as the
+       name of the current file.
+
+       An input preprocessor receives one command line  argument,
+       the  original filename, as entered by the user.  It should
+       create the replacement file, and when finished, print  the
+       name  of  the replacement file to its standard output.  If
        the input preprocessor does not output a replacement file­
-       name, _l_e_s_s uses the original file, as normal.   The  input
-       preprocessor  is  not  called when viewing standard input.
+       name,  _l_e_s_s  uses the original file, as normal.  The input
+       preprocessor is not called when  viewing  standard  input.
        To set up an input preprocessor, set the LESSOPEN environ­
-       ment  variable  to  a  command line which will invoke your
-       input preprocessor.  This command line should include  one
-       occurrence  of  the string "%s", which will be replaced by
+       ment variable to a command line  which  will  invoke  your
+       input  preprocessor.  This command line should include one
+       occurrence of the string "%s", which will be  replaced  by
        the  filename  when  the  input  preprocessor  command  is
        invoked.
 
        When _l_e_s_s closes a file opened in such a way, it will call
        another program, called the input postprocessor, which may
-       perform  any desired clean-up action (such as deleting the
+       perform any desired clean-up action (such as deleting  the
        replacement  file  created  by  LESSOPEN).   This  program
        receives two command line arguments, the original filename
-       as entered by the user, and the name  of  the  replacement
+       as  entered  by  the user, and the name of the replacement
        file.  To set up an input postprocessor, set the LESSCLOSE
-       environment variable to a command line which  will  invoke
-       your  input postprocessor.  It may include two occurrences
-       of the string "%s"; the first is replaced with the  origi­
-       nal  name  of the file and the second with the name of the
+       environment  variable  to a command line which will invoke
+       your input postprocessor.  It may include two  occurrences
+       of  the string "%s"; the first is replaced with the origi­
+       nal name of the file and the second with the name  of  the
        replacement file, which was output by LESSOPEN.
 
-       For example, on many Unix systems, these two scripts  will
-       allow  you  to  keep files in compressed format, but still
+       For  example, on many Unix systems, these two scripts will
+       allow you to keep files in compressed  format,  but  still
        let _l_e_s_s view them directly:
 
        lessopen.sh:
@@ -1302,20 +1313,9 @@
             #! /bin/sh
             rm $2
 
-       To use these scripts, put them both where they can be exe­
-       cuted     and     set    LESSOPEN="lessopen.sh %s",    and
-       LESSCLOSE="lessclose.sh %s %s".  More complex LESSOPEN and
-       LESSCLOSE  scripts may be written to accept other types of
-       compressed files, and so on.
-
-       It is also possible to set up  an  input  preprocessor  to
-       pipe  the  file data directly to _l_e_s_s_, rather than putting
-       the data into a replacement file.  This avoids the need to
-       decompress the entire file before starting to view it.  An
-
 
 
-                     Version 371: 26 Dec 2001                  20
+                     Version 381: 17 Jan 2003                  20
 
 
 
@@ -1324,18 +1324,28 @@
 LESS(1)                                                   LESS(1)
 
 
-       input preprocessor that works this way is called an  input
-       pipe.   An  input  pipe,  instead of writing the name of a
+       To use these scripts, put them both where they can be exe­
+       cuted    and    set     LESSOPEN="lessopen.sh %s",     and
+       LESSCLOSE="lessclose.sh %s %s".  More complex LESSOPEN and
+       LESSCLOSE scripts may be written to accept other types  of
+       compressed files, and so on.
+
+       It  is  also  possible  to set up an input preprocessor to
+       pipe the file data directly to _l_e_s_s_, rather  than  putting
+       the data into a replacement file.  This avoids the need to
+       decompress the entire file before starting to view it.  An
+       input  preprocessor that works this way is called an input
+       pipe.  An input pipe, instead of writing  the  name  of  a
        replacement file on its standard output, writes the entire
-       contents  of  the replacement file on its standard output.
-       If the input pipe does not write  any  characters  on  its
-       standard  output,  then  there  is no replacement file and
-       _l_e_s_s uses the original file, as normal.  To use  an  input
+       contents of the replacement file on its  standard  output.
+       If  the  input  pipe  does not write any characters on its
+       standard output, then there is  no  replacement  file  and
+       _l_e_s_s  uses  the original file, as normal.  To use an input
        pipe, make the first character in the LESSOPEN environment
        variable a vertical bar (|) to signify that the input pre­
        processor is an input pipe.
 
-       For  example,  on many Unix systems, this script will work
+       For example, on many Unix systems, this script  will  work
        like the previous example scripts:
 
        lesspipe.sh:
@@ -1345,11 +1355,11 @@
                  ;;
             esac
 
-       To use this script, put it where it can  be  executed  and
-       set  LESSOPEN="|lesspipe.sh  %s".   When  an input pipe is
-       used, a LESSCLOSE postprocessor can be  used,  but  it  is
-       usually  not  necessary since there is no replacement file
-       to clean up.  In this  case,  the  replacement  file  name
+       To  use  this  script, put it where it can be executed and
+       set LESSOPEN="|lesspipe.sh %s".  When  an  input  pipe  is
+       used,  a  LESSCLOSE  postprocessor  can be used, but it is
+       usually not necessary since there is no  replacement  file
+       to  clean  up.   In  this  case, the replacement file name
        passed to the LESSCLOSE postprocessor is "-".
 
 
@@ -1360,7 +1370,7 @@
               can be displayed directly to the screen.
 
        control characters
-              should  not be displayed directly, but are expected
+              should not be displayed directly, but are  expected
               to  be  found  in  ordinary  text  files  (such  as
               backspace and tab).
 
@@ -1368,31 +1378,30 @@
               should  not  be  displayed  directly  and  are  not
               expected to be found in text files.
 
-       A "character set" is simply a description of which charac­
-       ters  are  to  be  considered normal, control, and binary.
-       The LESSCHARSET environment variable may be used to select
-       a character set.  Possible values for LESSCHARSET are:
-
-       ascii  BS,  TAB,  NL, CR, and formfeed are control charac­
-              ters, all chars with values between 32 and 126  are
-              normal, and all others are binary.
 
 
 
+                     Version 381: 17 Jan 2003                  21
 
 
-                     Version 371: 26 Dec 2001                  21
 
 
 
+LESS(1)                                                   LESS(1)
 
 
-LESS(1)                                                   LESS(1)
+       A "character set" is simply a description of which charac­
+       ters are to be considered  normal,  control,  and  binary.
+       The LESSCHARSET environment variable may be used to select
+       a character set.  Possible values for LESSCHARSET are:
 
+       ascii  BS, TAB, NL, CR, and formfeed are  control  charac­
+              ters,  all chars with values between 32 and 126 are
+              normal, and all others are binary.
 
        iso8859
-              Selects  an  ISO  8859  character set.  This is the
-              same as ASCII, except characters  between  160  and
+              Selects an ISO 8859 character  set.   This  is  the
+              same  as  ASCII,  except characters between 160 and
               255 are treated as normal characters.
 
        latin1 Same as iso8859.
@@ -1405,49 +1414,40 @@
 
        IBM-1047
               Selects an EBCDIC character set used by OS/390 Unix
-              Services.  This is the EBCDIC analogue  of  latin1.
-              You  get  similar  results  by setting either LESS­
+              Services.   This  is the EBCDIC analogue of latin1.
+              You get similar results  by  setting  either  LESS­
               CHARSET=IBM-1047 or LC_CTYPE=en_US in your environ­
               ment.
 
        koi8-r Selects a Russian character set.
 
-       next   Selects  a  character set appropriate for NeXT com­
+       next   Selects a character set appropriate for  NeXT  com­
               puters.
 
        utf-8  Selects the UTF-8 encoding of the ISO 10646 charac­
               ter set.
 
-       In  special cases, it may be desired to tailor _l_e_s_s to use
-       a character set other than the  ones  definable  by  LESS­
-       CHARSET.   In  this  case,  the environment variable LESS­
-       CHARDEF can be used to define a character set.  It  should
+       In special cases, it may be desired to tailor _l_e_s_s to  use
+       a  character  set  other  than the ones definable by LESS­
+       CHARSET.  In this case,  the  environment  variable  LESS­
+       CHARDEF  can be used to define a character set.  It should
        be set to a string where each character in the string rep­
        resents one character in the character set.  The character
-       "."  is  used for a normal character, "c" for control, and
-       "b" for binary.  A decimal number may be used for  repeti­
-       tion.   For  example,  "bccc4b." would mean character 0 is
-       binary, 1, 2 and 3 are control, 4, 5, 6 and 7 are  binary,
-       and  8 is normal.  All characters after the last are taken
-       to be the same as the last, so characters  9  through  255
+       "." is used for a normal character, "c" for  control,  and
+       "b"  for binary.  A decimal number may be used for repeti­
+       tion.  For example, "bccc4b." would mean  character  0  is
+       binary,  1, 2 and 3 are control, 4, 5, 6 and 7 are binary,
+       and 8 is normal.  All characters after the last are  taken
+       to  be  the  same as the last, so characters 9 through 255
        would be normal.  (This is an example, and does not neces­
        sarily represent any real character set.)
 
        This table shows the value of LESSCHARDEF which is equiva­
        lent to each of the possible values for LESSCHARSET:
 
-            ascii     8bcccbcc18b95.b
-            dos       8bcccbcc12bc5b95.b.
-            ebcdic    5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b
-                      9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b.
-            IBM-1047  4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc
-                      191.b
-            iso8859   8bcccbcc18b95.33b.
-            koi8-r    8bcccbcc18b95.b128.
 
 
-
-                     Version 371: 26 Dec 2001                  22
+                     Version 381: 17 Jan 2003                  22
 
 
 
@@ -1456,6 +1456,14 @@
 LESS(1)                                                   LESS(1)
 
 
+            ascii     8bcccbcc18b95.b
+            dos       8bcccbcc12bc5b95.b.
+            ebcdic    5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b
+                      9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b.
+            IBM-1047  4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc
+                      191.b
+            iso8859   8bcccbcc18b95.33b.
+            koi8-r    8bcccbcc18b95.b128.
             latin1    8bcccbcc18b95.33b.
             next      8bcccbcc18b95.bb125.bb
 
@@ -1503,17 +1511,9 @@
        A  percent sign followed by a single character is expanded
        according to what the following character is:
 
-       %b_X    Replaced by the byte offset into the current  input
-              file.   The  b  is  followed  by a single character
-              (shown as _X above) which specifies the  line  whose
-              byte  offset  is to be used.  If the character is a
-              "t", the byte offset of the top line in the display
-              is  used,  an  "m" means use the middle line, a "b"
-              means use the bottom line, a "B" means use the line
 
 
-
-                     Version 371: 26 Dec 2001                  23
+                     Version 381: 17 Jan 2003                  23
 
 
 
@@ -1522,6 +1522,13 @@
 LESS(1)                                                   LESS(1)
 
 
+       %b_X    Replaced by the byte offset into the current  input
+              file.   The  b  is  followed  by a single character
+              (shown as _X above) which specifies the  line  whose
+              byte  offset  is to be used.  If the character is a
+              "t", the byte offset of the top line in the display
+              is  used,  an  "m" means use the middle line, a "b"
+              means use the bottom line, a "B" means use the line
               just after the bottom line, and a "j" means use the
               "target" line, as specified by the -j option.
 
@@ -1568,25 +1575,26 @@
        %s     Same as %B.
 
        %t     Causes any trailing spaces to be removed.   Usually
-              used  at the end of the string, but may appear any­
-              where.
+              used  at  the  end  of  the  string, but may appear
 
-       %x     Replaced by the name of the next input file in  the
-              list.
 
-       If  any  item  is  unknown  (for example, the file size if
-       input is a pipe), a question mark is printed instead.
 
+                     Version 381: 17 Jan 2003                  24
 
 
-                     Version 371: 26 Dec 2001                  24
 
 
 
+LESS(1)                                                   LESS(1)
 
 
-LESS(1)                                                   LESS(1)
+              anywhere.
 
+       %x     Replaced by the name of the next input file in  the
+              list.
+
+       If  any  item  is  unknown  (for example, the file size if
+       input is a pipe), a question mark is printed instead.
 
        The format of the prompt string can be  changed  depending
        on certain conditions.  A question mark followed by a sin­
@@ -1634,25 +1642,25 @@
 
        ?p_X    True if the percent into the  current  input  file,
               based  on  byte  offsets,  of the specified line is
-              known.
 
-       ?P_X    True if the percent into the  current  input  file,
-              based  on  line  numbers,  of the specified line is
-              known.
 
-       ?s     Same as "?B".
 
+                     Version 381: 17 Jan 2003                  25
 
 
 
-                     Version 371: 26 Dec 2001                  25
 
 
+LESS(1)                                                   LESS(1)
 
 
+              known.
 
-LESS(1)                                                   LESS(1)
+       ?P_X    True if the percent into the  current  input  file,
+              based  on  line  numbers,  of the specified line is
+              known.
 
+       ?s     Same as "?B".
 
        ?x     True if there is a next input file (that is, if the
               current input file is not the last one).
@@ -1700,18 +1708,10 @@
        And here is the default message produced by the = command:
 
        ?f%f .?m(file %i of %m) .?ltlines %lt-%lb?L/%L. .
-            byte %bB?s/%s. ?e(END) :?pB%pB\%..%t
-
-       The prompt expansion features are also  used  for  another
-       purpose:  if  an environment variable LESSEDIT is defined,
-       it is used as the command to be executed when the  v  com­
-       mand  is  invoked.  The LESSEDIT string is expanded in the
-       same way as the prompt strings.   The  default  value  for
-       LESSEDIT is:
 
 
 
-                     Version 371: 26 Dec 2001                  26
+                     Version 381: 17 Jan 2003                  26
 
 
 
@@ -1720,6 +1720,15 @@
 LESS(1)                                                   LESS(1)
 
 
+            byte %bB?s/%s. ?e(END) :?pB%pB\%..%t
+
+       The prompt expansion features are also  used  for  another
+       purpose:  if  an environment variable LESSEDIT is defined,
+       it is used as the command to be executed when the  v  com­
+       mand  is  invoked.  The LESSEDIT string is expanded in the
+       same way as the prompt strings.   The  default  value  for
+       LESSEDIT is:
+
             %E ?lm+%lm. %f
 
        Note that this expands to the editor name, followed by a +
@@ -1765,19 +1774,10 @@
        take  precedence over variables defined in the system-wide
        lesskey file.
 
-       COLUMNS
-              Sets the number of columns on  the  screen.   Takes
-              precedence  over the number of columns specified by
-              the TERM variable.  (But if you  have  a  windowing
-              system  which  supports TIOCGWINSZ or WIOCGETD, the
-              window system's  idea  of  the  screen  size  takes
-              precedence  over  the LINES and COLUMNS environment
-              variables.)
-
 
 
 
-                     Version 371: 26 Dec 2001                  27
+                     Version 381: 17 Jan 2003                  27
 
 
 
@@ -1786,6 +1786,15 @@
 LESS(1)                                                   LESS(1)
 
 
+       COLUMNS
+              Sets the number of columns on  the  screen.   Takes
+              precedence  over the number of columns specified by
+              the TERM variable.  (But if you  have  a  windowing
+              system  which  supports TIOCGWINSZ or WIOCGETD, the
+              window system's  idea  of  the  screen  size  takes
+              precedence  over  the LINES and COLUMNS environment
+              variables.)
+
        EDITOR The name of the editor (used for the v command).
 
        HOME   Name of the user's home directory (used to  find  a
@@ -1831,19 +1840,10 @@
               acters, such as * and ?, in filenames on Unix  sys­
               tems.
 
-       LESSEDIT
-              Editor  prototype  string (used for the v command).
-              See discussion under PROMPTS.
-
-       LESSGLOBALTAGS
-              Name of the command used by the -t option  to  find
-              global tags.  Normally should be set to "global" if
-              your system has the _g_l_o_b_a_l  (1)  command.   If  not
-              set, global tags are not used.
 
 
 
-                     Version 371: 26 Dec 2001                  28
+                     Version 381: 17 Jan 2003                  28
 
 
 
@@ -1852,6 +1852,16 @@
 LESS(1)                                                   LESS(1)
 
 
+       LESSEDIT
+              Editor  prototype  string (used for the v command).
+              See discussion under PROMPTS.
+
+       LESSGLOBALTAGS
+              Name of the command used by the -t option  to  find
+              global tags.  Normally should be set to "global" if
+              your system has the _g_l_o_b_a_l  (1)  command.   If  not
+              set, global tags are not used.
+
        LESSKEY
               Name of the default lesskey(1) file.
 
@@ -1896,28 +1906,28 @@
 
        TERM   The type of terminal on which _l_e_s_s is being run.
 
-       VISUAL The name of the editor (used for the v command).
 
 
-SSEEEE AALLSSOO
-       lesskey(1)
 
+                     Version 381: 17 Jan 2003                  29
 
-WWAARRNNIINNGGSS
-       The = command and prompts (unless changed  by  -P)  report
-       the line numbers of the lines at the top and bottom of the
 
 
 
-                     Version 371: 26 Dec 2001                  29
 
+LESS(1)                                                   LESS(1)
 
 
+       VISUAL The name of the editor (used for the v command).
 
 
-LESS(1)                                                   LESS(1)
+SSEEEE AALLSSOO
+       lesskey(1)
 
 
+WWAARRNNIINNGGSS
+       The = command and prompts (unless changed  by  -P)  report
+       the line numbers of the lines at the top and bottom of the
        screen, but the byte and percent of the line after the one
        at the bottom of the screen.
 
@@ -1954,7 +1964,7 @@
 
 
 CCOOPPYYRRIIGGHHTT
-       Copyright (C) 2001  Mark Nudelman
+       Copyright (C) 2002  Mark Nudelman
 
        less is part of the GNU project and is free software.  You
        can redistribute it and/or modify it under  the  terms  of
@@ -1962,20 +1972,10 @@
        the Free Software Foundation; or  (2)  the  Less  License.
        See  the  file  README  in  the less distribution for more
        details  regarding  redistribution.    You   should   have
-       received  a  copy  of the GNU General Public License along
-       with the source for less; see the file COPYING.   If  not,
-       write  to  the  Free Software Foundation, 59 Temple Place,
-       Suite 330, Boston, MA  02111-1307, USA.  You  should  also
-       have  received  a  copy  of the Less License; see the file
-       LICENSE.
 
-       less is distributed in the hope that it  will  be  useful,
-       but  WITHOUT  ANY  WARRANTY; without even the implied war­
-       ranty of  MERCHANTABILITY  or  FITNESS  FOR  A  PARTICULAR
 
 
-
-                     Version 371: 26 Dec 2001                  30
+                     Version 381: 17 Jan 2003                  30
 
 
 
@@ -1984,7 +1984,17 @@
 LESS(1)                                                   LESS(1)
 
 
-       PURPOSE.   See  the  GNU  General  Public License for more
+       received  a  copy  of the GNU General Public License along
+       with the source for less; see the file COPYING.   If  not,
+       write  to  the  Free Software Foundation, 59 Temple Place,
+       Suite 330, Boston, MA  02111-1307, USA.  You  should  also
+       have  received  a  copy  of the Less License; see the file
+       LICENSE.
+
+       less is distributed in the hope that it  will  be  useful,
+       but  WITHOUT  ANY  WARRANTY; without even the implied war­
+       ranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR  PUR­
+       POSE.   See  the  GNU  General  Public  License  for  more
        details.
 
 
@@ -2031,16 +2041,6 @@
 
 
 
-
-
-
-
-
-
-
-
-
-
-                     Version 371: 26 Dec 2001                  31
+                     Version 381: 17 Jan 2003                  31
 
 
Index: contrib/less/less.nro
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/less.nro,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 less.nro
--- contrib/less/less.nro	7 Jan 2002 20:29:26 -0000	1.1.1.3
+++ contrib/less/less.nro	3 Jul 2003 19:03:04 -0000
@@ -1,4 +1,4 @@
-.TH LESS 1 "Version 371: 26 Dec 2001"
+.TH LESS 1 "Version 381: 17 Jan 2003"
 .SH NAME
 less \- opposite of more
 .SH SYNOPSIS
@@ -10,15 +10,15 @@
 .br
 .B "less --version"
 .br
-.B "less [-[+]aBcCdeEfFgGiIJmMnNqQrRsSuUVwWX]"
+.B "less [-[+]aBcCdeEfFgGiIJLmMnNqQrRsSuUVwWX~]"
 .br
-.B "     [-b \fIbufs\fP] [-h \fIlines\fP] [-j \fIline\fP] [-k \fIkeyfile\fP]"
+.B "     [-b \fIspace\fP] [-h \fIlines\fP] [-j \fIline\fP] [-k \fIkeyfile\fP]"
 .br
 .B "     [-{oO} \fIlogfile\fP] [-p \fIpattern\fP] [-P \fIprompt\fP] [-t \fItag\fP]"
 .br
 .B "     [-T \fItagsfile\fP] [-x \fItab\fP,...] [-y \fIlines\fP] [-[z] \fIlines\fP]"
 .br
-.B "     [+[+]\fIcmd\fP] [--] [\fIfilename\fP]..."
+.B "     [-# \fIshift\fP] [+[+]\fIcmd\fP] [--] [\fIfilename\fP]..."
 .br
 (See the OPTIONS section for alternate option syntax with long option names.)
 
@@ -444,7 +444,7 @@
 .I less
 (the same as the h command).
 (Depending on how your shell interprets the question mark,
-it may be necessary to quote the question mark, thus: "-\\?".)
+it may be necessary to quote the question mark, thus: "-\e?".)
 .IP "-a or --search-skip-screen"
 Causes searches to start after the last line
 displayed on the screen, 
@@ -452,19 +452,24 @@
 By default, searches start at the second line on the screen
 (or after the last found line; see the -j option).
 .IP "-b\fIn\fP or --buffers=\fIn\fP"
-Specifies the number of buffers
+Specifies the amount of buffer space
 .I less
-will use for each file.
-Buffers are 1K, and by default 10 buffers are used for each file
-(except if the file is a pipe; see the -B option).
-The number \fIn\fP specifies a different number of buffers to use.
+will use for each file, in units of kilobytes (1024 bytes).
+By default 64K of buffer space is used for each file
+(unless the file is a pipe; see the -B option).
+The -b option specifies instead that \fIn\fP kilobytes of 
+buffer space should be used for each file.
+If \fIn\fP is -1, buffer space is unlimited; that is,
+the entire file is read into memory.
 .IP "-B or --auto-buffers"
 By default, when data is read from a pipe,
 buffers are allocated automatically as needed.
 If a large amount of data is read from the pipe, this can cause
 a large amount of memory to be allocated.
 The -B option disables this automatic allocation of buffers for pipes,
-so that only the number of buffers specified by the -b option are used.
+so that only 64K 
+(or the amount of space specified by the -b option)
+is used for the pipe.
 Warning: use of -B can result in erroneous display, since only the
 most recently viewed part of the file is kept in memory; 
 any earlier data is lost.
@@ -481,7 +486,7 @@
 such as the ability to clear the screen or scroll backward.
 The -d option does not otherwise change the behavior of
 .I less
-on a dumb terminal).
+on a dumb terminal.
 .IP "-D\fBx\fP\fIcolor\fP or --color=\fBx\fP\fIcolor\fP"
 [MS-DOS only]
 Sets the color of the text displayed.
@@ -574,6 +579,12 @@
 it is also used as a 
 .I lesskey
 file.
+.IP "-L or --no-lessopen"
+Ignore the LESSOPEN environment variable
+(see the INPUT PREPROCESSOR section below).
+This option can be set from within \fIless\fP, 
+but it will apply only to files opened subsequently, not to the 
+file which is currently open.
 .IP "-m or --long-prompt"
 Causes 
 .I less
@@ -692,7 +703,8 @@
 .IP "-S or --chop-long-lines"
 Causes lines longer than the screen width to be
 chopped rather than folded.
-That is, the remainder of a long line is simply discarded.
+That is, the portion of a long line that does not fit in
+the screen width is not shown.
 The default is to fold long lines; that is, display the remainder
 on the next line.
 .IP "-t\fItag\fP or --tag=\fItag\fP"
@@ -791,7 +803,7 @@
 For example, if the screen is 24 lines, \fI-z-4\fP sets the 
 scrolling window to 20 lines.  If the screen is resized to 40 lines,
 the scrolling window automatically changes to 36 lines.
-.IP -"\fIcc\fP\ or\ --quotes=\fIcc\fP
+.IP "-\fI\(dqcc\fP\ or\ --quotes=\fIcc\fP"
 Changes the filename quoting character.
 This may be necessary if you are trying to name a file
 which contains both spaces and quote characters.
@@ -879,7 +891,7 @@
 is entered into the command line.
 Repeated TABs will cycle thru the other matching filenames.
 If the completed filename is a directory, a "/" is appended to the filename.
-(On MS-DOS systems, a "\\" is appended.)
+(On MS-DOS systems, a "\e" is appended.)
 The environment variable LESSSEPARATOR can be used to specify a 
 different character to append to a directory name.
 .IP "BACKTAB [ ESC-TAB ]"
@@ -947,8 +959,8 @@
 .I less 
 was built with a different sysconf directory than /usr/local/etc,
 that directory is where the sysless file is found.)
-On MS-DOS and Windows systems, the system-wide lesskey file is c:\\_sysless.
-On OS/2 systems, the system-wide lesskey file is c:\\sysless.ini.
+On MS-DOS and Windows systems, the system-wide lesskey file is c:\e_sysless.
+On OS/2 systems, the system-wide lesskey file is c:\esysless.ini.
 
 .SH "INPUT PREPROCESSOR"
 You may define an "input preprocessor" for 
@@ -1149,6 +1161,7 @@
 	\ \ \ \ \ \ 	9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b.
 .br
 	IBM-1047	4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc
+.br
 	\ \ \ \ \ \ 	191.b
 .br
 	iso8859	8bcccbcc18b95.33b.
@@ -1317,7 +1330,7 @@
 This prompt prints the filename, if known;
 otherwise the string "Standard input".
 .sp
-?f%f .?ltLine %lt:?pt%pt\\%:?btByte %bt:-...
+?f%f .?ltLine %lt:?pt%pt\e%:?btByte %bt:-...
 .sp
 This prompt would print the filename, if known.
 The filename is followed by the line number, if known,
@@ -1327,7 +1340,7 @@
 and how the % after the %pt
 is included literally by escaping it with a backslash.
 .sp
-?n?f%f\ .?m(file\ %i\ of\ %m)\ ..?e(END)\ ?x-\ Next\\:\ %x..%t
+?n?f%f\ .?m(file\ %i\ of\ %m)\ ..?e(END)\ ?x-\ Next\e:\ %x..%t
 .sp
 This prints the filename if this is the first prompt in a file,
 followed by the "file N of N" message if there is more
@@ -1341,18 +1354,18 @@
 Each is broken into two lines here for readability only.
 .nf
 .sp
-?n?f%f\ .?m(file\ %i\ of\ %m)\ ..?e(END)\ ?x-\ Next\\:\ %x.:
-	?pB%pB\\%:byte\ %bB?s/%s...%t
+?n?f%f\ .?m(file\ %i\ of\ %m)\ ..?e(END)\ ?x-\ Next\e:\ %x.:
+	?pB%pB\e%:byte\ %bB?s/%s...%t
 .sp
 ?f%f\ .?n?m(file\ %i\ of\ %m)\ ..?ltlines\ %lt-%lb?L/%L.\ :
-	byte\ %bB?s/%s.\ .?e(END)\ ?x-\ Next\\:\ %x.:?pB%pB\\%..%t
+	byte\ %bB?s/%s.\ .?e(END)\ ?x-\ Next\e:\ %x.:?pB%pB\e%..%t
 .sp
 .fi
 And here is the default message produced by the = command:
 .nf
 .sp
 ?f%f\ .?m(file\ %i\ of\ %m)\ .?ltlines\ %lt-%lb?L/%L.\ .
-	byte\ %bB?s/%s.\ ?e(END)\ :?pB%pB\\%..%t
+	byte\ %bB?s/%s.\ ?e(END)\ :?pB%pB\e%..%t
 .fi
 .PP
 The prompt expansion features are also used for another purpose:
@@ -1534,7 +1547,7 @@
 version of less.
 
 .SH COPYRIGHT
-Copyright (C) 2001  Mark Nudelman
+Copyright (C) 2002  Mark Nudelman
 .PP
 less is part of the GNU project and is free software.
 You can redistribute it and/or modify it
Index: contrib/less/lessecho.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/lessecho.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 lessecho.c
--- contrib/less/lessecho.c	22 May 2000 09:53:22 -0000	1.1.1.1
+++ contrib/less/lessecho.c	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
@@ -18,23 +18,31 @@
  * -cx	Specifies "x" to be the close quote character.
  * -pn	Specifies "n" to be the open quote character, as an integer.
  * -dn	Specifies "n" to be the close quote character, as an integer.
+ * -mx  Specifies "x" to be a metachar.
+ * -nn  Specifies "n" to be a metachar, as an integer.
+ * -ex  Specifies "x" to be the escape char for metachars.
+ * -fn  Specifies "x" to be the escape char for metachars, as an integer.
  * -a	Specifies that all arguments are to be quoted.
  *	The default is that only arguments containing spaces are quoted.
  */
 
 #include "less.h"
 
-static char *version = "$Revision: 1.6 $";
+static char *version = "$Revision: 1.9 $";
 
 static int quote_all = 0;
 static char openquote = '"';
 static char closequote = '"';
+static char *meta_escape = "\\";
+static char meta_escape_buf[2];
+static char metachars[64] = "";
+static int num_metachars = 0;
 
 	static void
 pr_usage()
 {
 	fprintf(stderr,
-		"usage: lessecho [-ox] [-cx] [-pn] [-dn] [-a] file ...\n");
+		"usage: lessecho [-ox] [-cx] [-pn] [-dn] [-mx] [-nn] [-ex] [-fn] [-a] file ...\n");
 }
 
 	static void
@@ -169,21 +177,43 @@
 		case 'a':
 			quote_all = 1;
 			break;
-		case 'o':
-			openquote = *++arg;
-			break;
 		case 'c':
 			closequote = *++arg;
 			break;
+		case 'd':
+			closequote = lstrtol(++arg, 0, &s);
+			if (s == arg)
+				pr_error("Missing number after -d");
+			break;
+		case 'e':
+			if (strcmp(++arg, "-") == 0)
+				meta_escape = "";
+			else
+				meta_escape = arg;
+			break;
+		case 'f':
+			meta_escape_buf[0] = lstrtol(++arg, 0, &s);
+			meta_escape = meta_escape_buf;
+			if (s == arg)
+				pr_error("Missing number after -f");
+			break;
+		case 'o':
+			openquote = *++arg;
+			break;
 		case 'p':
 			openquote = lstrtol(++arg, 0, &s);
 			if (s == arg)
-				pr_error("Missing number after -O");
+				pr_error("Missing number after -p");
 			break;
-		case 'd':
-			closequote = lstrtol(++arg, 0, &s);
+		case 'm':
+			metachars[num_metachars++] = *++arg;
+			metachars[num_metachars] = '\0';
+			break;
+		case 'n':
+			metachars[num_metachars++] = lstrtol(++arg, 0, &s);
 			if (s == arg)
-				pr_error("Missing number after -C");
+				pr_error("Missing number after -n");
+			metachars[num_metachars] = '\0';
 			break;
 		case '?':
 			pr_usage();
@@ -212,11 +242,27 @@
 
 	while (argc-- > 0)
 	{
+		int has_meta = 0;
 		arg = *argv++;
-		if (quote_all || strchr(arg, ' ') != NULL)
+		for (s = arg;  *s != '\0';  s++)
+		{
+			if (strchr(metachars, *s) != NULL)
+			{
+				has_meta = 1;
+				break;
+			}
+		}
+		if (quote_all || (has_meta && strlen(meta_escape) == 0))
 			printf("%c%s%c", openquote, arg, closequote);
-		else
-			printf("%s", arg);
+		else 
+		{
+			for (s = arg;  *s != '\0';  s++)
+			{
+				if (strchr(metachars, *s) != NULL)
+					printf("%s", meta_escape);
+				printf("%c", *s);
+			}
+		}
 		if (argc > 0)
 			printf(" ");
 		else
Index: contrib/less/lesskey.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/lesskey.c,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 lesskey.c
--- contrib/less/lesskey.c	7 Jan 2002 20:29:18 -0000	1.1.1.3
+++ contrib/less/lesskey.c	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
@@ -93,87 +93,87 @@
 
 struct cmdname cmdnames[] = 
 {
-	"back-bracket",		A_B_BRACKET,
-	"back-line",		A_B_LINE,
-	"back-line-force",	A_BF_LINE,
-	"back-screen",		A_B_SCREEN,
-	"back-scroll",		A_B_SCROLL,
-	"back-search",		A_B_SEARCH,
-	"back-window",		A_B_WINDOW,
-	"debug",		A_DEBUG,
-	"digit",		A_DIGIT,
-	"display-flag",		A_DISP_OPTION,
-	"display-option",	A_DISP_OPTION,
-	"end",			A_GOEND,
-	"examine",		A_EXAMINE,
-	"first-cmd",		A_FIRSTCMD,
-	"firstcmd",		A_FIRSTCMD,
-	"flush-repaint",	A_FREPAINT,
-	"forw-bracket",		A_F_BRACKET,
-	"forw-forever",		A_F_FOREVER,
-	"forw-line",		A_F_LINE,
-	"forw-line-force",	A_FF_LINE,
-	"forw-screen",		A_F_SCREEN,
-	"forw-screen-force",	A_FF_SCREEN,
-	"forw-scroll",		A_F_SCROLL,
-	"forw-search",		A_F_SEARCH,
-	"forw-window",		A_F_WINDOW,
-	"goto-end",		A_GOEND,
-	"goto-line",		A_GOLINE,
-	"goto-mark",		A_GOMARK,
-	"help",			A_HELP,
-	"index-file",		A_INDEX_FILE,
-	"invalid",		A_UINVALID,
-	"left-scroll",		A_LSHIFT,
-	"next-file",		A_NEXT_FILE,
-	"next-tag",		A_NEXT_TAG,
-	"noaction",		A_NOACTION,
-	"percent",		A_PERCENT,
-	"pipe",			A_PIPE,
-	"prev-file",		A_PREV_FILE,
-	"prev-tag",		A_PREV_TAG,
-	"quit",			A_QUIT,
-	"remove-file",		A_REMOVE_FILE,
-	"repaint",		A_REPAINT,
-	"repaint-flush",	A_FREPAINT,
-	"repeat-search",	A_AGAIN_SEARCH,
-	"repeat-search-all",	A_T_AGAIN_SEARCH,
-	"reverse-search",	A_REVERSE_SEARCH,
-	"reverse-search-all",	A_T_REVERSE_SEARCH,
-	"right-scroll",		A_RSHIFT,
-	"set-mark",		A_SETMARK,
-	"shell",		A_SHELL,
-	"status",		A_STAT,
-	"toggle-flag",		A_OPT_TOGGLE,
-	"toggle-option",	A_OPT_TOGGLE,
-	"undo-hilite",		A_UNDO_SEARCH,
-	"version",		A_VERSION,
-	"visual",		A_VISUAL,
-	NULL,			0
+	{ "back-bracket",	A_B_BRACKET },
+	{ "back-line",		A_B_LINE },
+	{ "back-line-force",	A_BF_LINE },
+	{ "back-screen",	A_B_SCREEN },
+	{ "back-scroll",	A_B_SCROLL },
+	{ "back-search",	A_B_SEARCH },
+	{ "back-window",	A_B_WINDOW },
+	{ "debug",		A_DEBUG },
+	{ "digit",		A_DIGIT },
+	{ "display-flag",	A_DISP_OPTION },
+	{ "display-option",	A_DISP_OPTION },
+	{ "end",		A_GOEND },
+	{ "examine",		A_EXAMINE },
+	{ "first-cmd",		A_FIRSTCMD },
+	{ "firstcmd",		A_FIRSTCMD },
+	{ "flush-repaint",	A_FREPAINT },
+	{ "forw-bracket",	A_F_BRACKET },
+	{ "forw-forever",	A_F_FOREVER },
+	{ "forw-line",		A_F_LINE },
+	{ "forw-line-force",	A_FF_LINE },
+	{ "forw-screen",	A_F_SCREEN },
+	{ "forw-screen-force",	A_FF_SCREEN },
+	{ "forw-scroll",	A_F_SCROLL },
+	{ "forw-search",	A_F_SEARCH },
+	{ "forw-window",	A_F_WINDOW },
+	{ "goto-end",		A_GOEND },
+	{ "goto-line",		A_GOLINE },
+	{ "goto-mark",		A_GOMARK },
+	{ "help",		A_HELP },
+	{ "index-file",		A_INDEX_FILE },
+	{ "invalid",		A_UINVALID },
+	{ "left-scroll",	A_LSHIFT },
+	{ "next-file",		A_NEXT_FILE },
+	{ "next-tag",		A_NEXT_TAG },
+	{ "noaction",		A_NOACTION },
+	{ "percent",		A_PERCENT },
+	{ "pipe",		A_PIPE },
+	{ "prev-file",		A_PREV_FILE },
+	{ "prev-tag",		A_PREV_TAG },
+	{ "quit",		A_QUIT },
+	{ "remove-file",	A_REMOVE_FILE },
+	{ "repaint",		A_REPAINT },
+	{ "repaint-flush",	A_FREPAINT },
+	{ "repeat-search",	A_AGAIN_SEARCH },
+	{ "repeat-search-all",	A_T_AGAIN_SEARCH },
+	{ "reverse-search",	A_REVERSE_SEARCH },
+	{ "reverse-search-all",	A_T_REVERSE_SEARCH },
+	{ "right-scroll",	A_RSHIFT },
+	{ "set-mark",		A_SETMARK },
+	{ "shell",		A_SHELL },
+	{ "status",		A_STAT },
+	{ "toggle-flag",	A_OPT_TOGGLE },
+	{ "toggle-option",	A_OPT_TOGGLE },
+	{ "undo-hilite",	A_UNDO_SEARCH },
+	{ "version",		A_VERSION },
+	{ "visual",		A_VISUAL },
+	{ NULL, 0 }
 };
 
 struct cmdname editnames[] = 
 {
-	"back-complete",	EC_B_COMPLETE,
-	"backspace",		EC_BACKSPACE,
-	"delete",		EC_DELETE,
-	"down",			EC_DOWN,
-	"end",			EC_END,
-	"expand",		EC_EXPAND,
-	"forw-complete",	EC_F_COMPLETE,
-	"home",			EC_HOME,
-	"insert",		EC_INSERT,
-	"invalid",		EC_UINVALID,
-	"kill-line",		EC_LINEKILL,
-	"left",			EC_LEFT,
-	"literal",		EC_LITERAL,
-	"right",		EC_RIGHT,
-	"up",			EC_UP,
-	"word-backspace",	EC_W_BACKSPACE,
-	"word-delete",		EC_W_DELETE,
-	"word-left",		EC_W_LEFT,
-	"word-right",		EC_W_RIGHT,
-	NULL,			0
+	{ "back-complete",	EC_B_COMPLETE },
+	{ "backspace",		EC_BACKSPACE },
+	{ "delete",		EC_DELETE },
+	{ "down",		EC_DOWN },
+	{ "end",		EC_END },
+	{ "expand",		EC_EXPAND },
+	{ "forw-complete",	EC_F_COMPLETE },
+	{ "home",		EC_HOME },
+	{ "insert",		EC_INSERT },
+	{ "invalid",		EC_UINVALID },
+	{ "kill-line",		EC_LINEKILL },
+	{ "left",		EC_LEFT },
+	{ "literal",		EC_LITERAL },
+	{ "right",		EC_RIGHT },
+	{ "up",			EC_UP },
+	{ "word-backspace",	EC_W_BACKSPACE },
+	{ "word-delete",	EC_W_DELETE },
+	{ "word-left",		EC_W_LEFT },
+	{ "word-right",		EC_W_RIGHT },
+	{ NULL, 0 }
 };
 
 struct table
@@ -352,8 +352,9 @@
  * Parse one character of a string.
  */
 	char *
-tstr(pp)
+tstr(pp, xlate)
 	char **pp;
+	int xlate;
 {
 	register char *p;
 	register char ch;
@@ -380,7 +381,7 @@
 				ch = 8*ch + (*p - '0');
 			while (*++p >= '0' && *p <= '7' && ++i < 3);
 			*pp = p;
-			if (ch == CONTROL('K'))
+			if (xlate && ch == CONTROL('K'))
 				return tstr_control_k;
 			buf[0] = ch;
 			buf[1] = '\0';
@@ -403,31 +404,35 @@
 			*pp = p+1;
 			return ("\t");
 		case 'k':
-			switch (*++p)
+			if (xlate)
 			{
-			case 'u': ch = SK_UP_ARROW; break;
-			case 'd': ch = SK_DOWN_ARROW; break;
-			case 'r': ch = SK_RIGHT_ARROW; break;
-			case 'l': ch = SK_LEFT_ARROW; break;
-			case 'U': ch = SK_PAGE_UP; break;
-			case 'D': ch = SK_PAGE_DOWN; break;
-			case 'h': ch = SK_HOME; break;
-			case 'e': ch = SK_END; break;
-			case 'x': ch = SK_DELETE; break;
-			default:
-				error("illegal char after \\k");
+				switch (*++p)
+				{
+				case 'u': ch = SK_UP_ARROW; break;
+				case 'd': ch = SK_DOWN_ARROW; break;
+				case 'r': ch = SK_RIGHT_ARROW; break;
+				case 'l': ch = SK_LEFT_ARROW; break;
+				case 'U': ch = SK_PAGE_UP; break;
+				case 'D': ch = SK_PAGE_DOWN; break;
+				case 'h': ch = SK_HOME; break;
+				case 'e': ch = SK_END; break;
+				case 'x': ch = SK_DELETE; break;
+				default:
+					error("illegal char after \\k");
+					*pp = p+1;
+					return ("");
+				}
 				*pp = p+1;
-				return ("");
+				buf[0] = SK_SPECIAL_KEY;
+				buf[1] = ch;
+				buf[2] = 6;
+				buf[3] = 1;
+				buf[4] = 1;
+				buf[5] = 1;
+				buf[6] = '\0';
+				return (buf);
 			}
-			*pp = p+1;
-			buf[0] = SK_SPECIAL_KEY;
-			buf[1] = ch;
-			buf[2] = 6;
-			buf[3] = 1;
-			buf[4] = 1;
-			buf[5] = 1;
-			buf[6] = '\0';
-			return (buf);
+			/* FALLTHRU */
 		default:
 			/*
 			 * Backslash followed by any other char 
@@ -436,7 +441,7 @@
 			*pp = p+1;
 			buf[0] = *p;
 			buf[1] = '\0';
-			if (buf[0] == CONTROL('K'))
+			if (xlate && buf[0] == CONTROL('K'))
 				return tstr_control_k;
 			return (buf);
 		}
@@ -454,7 +459,7 @@
 	*pp = p+1;
 	buf[0] = *p;
 	buf[1] = '\0';
-	if (buf[0] == CONTROL('K'))
+	if (xlate && buf[0] == CONTROL('K'))
 		return tstr_control_k;
 	return (buf);
 }
@@ -639,7 +644,7 @@
 	cmdlen = 0;
 	do
 	{
-		s = tstr(&p);
+		s = tstr(&p, 1);
 		cmdlen += strlen(s);
 		if (cmdlen > MAX_CMDLEN)
 			error("command too long");
@@ -688,7 +693,7 @@
 		 */
 		add_cmd_char(action | A_EXTRA);
 		while (*p != '\0')
-			add_cmd_str(tstr(&p));
+			add_cmd_str(tstr(&p, 0));
 		add_cmd_char('\0');
 	}
 }
@@ -701,7 +706,7 @@
 
 	do
 	{
-		s = tstr(&p);
+		s = tstr(&p, 0);
 		add_cmd_str(s);
 	} while (*p != ' ' && *p != '\t' && *p != '=' && *p != '\0');
 	/*
@@ -721,7 +726,7 @@
 	p = skipsp(p);
 	while (*p != '\0')
 	{
-		s = tstr(&p);
+		s = tstr(&p, 0);
 		add_cmd_str(s);
 	}
 	add_cmd_char('\0');
@@ -763,7 +768,7 @@
 {
 	FILE *desc;
 	FILE *out;
-	char line[200];
+	char line[1024];
 
 #ifdef WIN32
 	if (getenv("HOME") == NULL)
Index: contrib/less/lesskey.h
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/lesskey.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 lesskey.h
--- contrib/less/lesskey.h	22 May 2000 09:53:22 -0000	1.1.1.1
+++ contrib/less/lesskey.h	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
Index: contrib/less/lesskey.man
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/lesskey.man,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 lesskey.man
--- contrib/less/lesskey.man	7 Jan 2002 20:29:34 -0000	1.1.1.3
+++ contrib/less/lesskey.man	3 Jul 2003 19:03:04 -0000
@@ -61,7 +61,7 @@
 
 
 
-                     Version 371: 26 Dec 2001                   1
+                     Version 381: 17 Jan 2003                   1
 
 
 
@@ -127,7 +127,7 @@
 
 
 
-                     Version 371: 26 Dec 2001                   2
+                     Version 381: 17 Jan 2003                   2
 
 
 
@@ -193,7 +193,7 @@
 
 
 
-                     Version 371: 26 Dec 2001                   3
+                     Version 381: 17 Jan 2003                   3
 
 
 
@@ -259,7 +259,7 @@
 
 
 
-                     Version 371: 26 Dec 2001                   4
+                     Version 381: 17 Jan 2003                   4
 
 
 
@@ -325,7 +325,7 @@
 
 
 
-                     Version 371: 26 Dec 2001                   5
+                     Version 381: 17 Jan 2003                   5
 
 
 
@@ -391,7 +391,7 @@
 
 
 
-                     Version 371: 26 Dec 2001                   6
+                     Version 381: 17 Jan 2003                   6
 
 
 
@@ -414,7 +414,7 @@
        It  is not possible to specify special keys, such as upar­
        row, in a keyboard-independent manner.  The  only  way  to
        specify  such keys is to specify the escape sequence which
-       a particular keyboard sends when such a keys is pressed.
+       a particular keyboard sends when such a key is pressed.
 
        On MS-DOS and OS/2 systems, certain keys send  a  sequence
        of  characters which start with a NUL character (0).  This
@@ -457,6 +457,6 @@
 
 
 
-                     Version 371: 26 Dec 2001                   7
+                     Version 381: 17 Jan 2003                   7
 
 
Index: contrib/less/lesskey.nro
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/lesskey.nro,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 lesskey.nro
--- contrib/less/lesskey.nro	7 Jan 2002 20:29:27 -0000	1.1.1.3
+++ contrib/less/lesskey.nro	3 Jul 2003 19:03:04 -0000
@@ -1,4 +1,4 @@
-.TH LESSKEY 1 "Version 371: 26 Dec 2001"
+.TH LESSKEY 1 "Version 381: 17 Jan 2003"
 .SH NAME
 lesskey \- specify key bindings for less
 .SH SYNOPSIS
@@ -351,7 +351,7 @@
 It is not possible to specify special keys, such as uparrow, 
 in a keyboard-independent manner.
 The only way to specify such keys is to specify the escape sequence
-which a particular keyboard sends when such a keys is pressed.
+which a particular keyboard sends when such a key is pressed.
 .PP
 On MS-DOS and OS/2 systems, certain keys send a sequence of characters
 which start with a NUL character (0).
Index: contrib/less/lglob.h
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/lglob.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 lglob.h
--- contrib/less/lglob.h	22 May 2000 09:53:22 -0000	1.1.1.1
+++ contrib/less/lglob.h	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
Index: contrib/less/line.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/line.c,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 line.c
--- contrib/less/line.c	7 Jan 2002 20:28:51 -0000	1.1.1.3
+++ contrib/less/line.c	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
@@ -18,7 +18,6 @@
 #include "less.h"
 
 #define IS_CONT(c)  (((c) & 0xC0) == 0x80)
-#define LINENUM_WIDTH   8       /* Chars to use for line number */
 
 public char *linebuf = NULL;	/* Buffer which holds the current output line */
 static char *attr = NULL;	/* Extension of linebuf to hold attributes */
@@ -34,6 +33,7 @@
 static int column;		/* Printable length, accounting for
 				   backspaces, etc. */
 static int overstrike;		/* Next char should overstrike previous char */
+static int last_overstrike = AT_NORMAL;
 static int is_null_line;	/* There is no current line */
 static int lmargin;		/* Left margin */
 static int hilites;		/* Number of hilites in this line */
@@ -92,6 +92,8 @@
 	}
 	memcpy(new_buf, linebuf, size_linebuf * sizeof(char));
 	memcpy(new_attr, attr, size_linebuf * sizeof(char));
+	free(attr);
+	free(linebuf);
 	linebuf = new_buf;
 	attr = new_attr;
 	size_linebuf = new_size;
@@ -110,13 +112,11 @@
 	is_null_line = 0;
 	pendc = '\0';
 	lmargin = 0;
+	if (status_col)
+		lmargin += 1;
 #if HILITE_SEARCH
 	hilites = 0;
 #endif
-	if (status_col)
-		lmargin += 1;
-	if (linenums == OPT_ONPLUS)
-		lmargin += LINENUM_WIDTH+1;
 }
 
 /*
@@ -126,7 +126,7 @@
 plinenum(pos)
 	POSITION pos;
 {
-	register int lno;
+	register LINENUM linenum = 0;
 	register int i;
 
 	if (linenums == OPT_ONPLUS)
@@ -139,7 +139,7 @@
 		 * {{ Since forw_raw_line modifies linebuf, we must
 		 *    do this first, before storing anything in linebuf. }}
 		 */
-		lno = find_linenum(pos);
+		linenum = find_linenum(pos);
 	}
 
 	/*
@@ -162,11 +162,22 @@
 	 */
 	if (linenums == OPT_ONPLUS)
 	{
-		sprintf(&linebuf[curr], "%*d", LINENUM_WIDTH, lno);
-		column += LINENUM_WIDTH;
-		for (i = 0;  i < LINENUM_WIDTH;  i++)
-			attr[curr++] = 0;
+		char buf[INT_STRLEN_BOUND(pos) + 2];
+		int n;
+
+		linenumtoa(linenum, buf);
+		n = strlen(buf);
+		if (n < MIN_LINENUM_WIDTH)
+			n = MIN_LINENUM_WIDTH;
+		sprintf(linebuf+curr, "%*s ", n, buf);
+		n++;  /* One space after the line number. */
+		for (i = 0; i < n; i++)
+			attr[curr+i] = AT_NORMAL;
+		curr += n;
+		column += n;
+		lmargin += n;
 	}
+
 	/*
 	 * Append enough spaces to bring us to the lmargin.
 	 */
@@ -401,6 +412,8 @@
 {
 	register int w;
 
+	if (a != AT_NORMAL)
+		last_overstrike = a;
 #if HILITE_SEARCH
 	if (is_hilited(pos, pos+1, 0))
 	{
@@ -553,6 +566,11 @@
 	return (r);
 }
 
+#define IS_UTF8_4BYTE(c) ( ((c) & 0xf8) == 0xf0 )
+#define IS_UTF8_3BYTE(c) ( ((c) & 0xf0) == 0xe0 )
+#define IS_UTF8_2BYTE(c) ( ((c) & 0xe0) == 0xc0 )
+#define IS_UTF8_TRAIL(c) ( ((c) & 0xc0) == 0x80 )
+
 	static int
 do_append(c, pos)
 	int c;
@@ -590,37 +608,64 @@
 		 * or just deletion of the character in the buffer.
 		 */
 		overstrike--;
-		if (utf_mode && curr > 1 && (char)c == linebuf[curr-2])
+		if (utf_mode && IS_UTF8_4BYTE(c) && curr > 2 && (char)c == linebuf[curr-3])
+		{
+			backc();
+			backc();
+			backc();
+			STORE_CHAR(linebuf[curr], AT_BOLD, pos);
+			overstrike = 3;
+		} else if (utf_mode && (IS_UTF8_3BYTE(c) || (overstrike==2 && IS_UTF8_TRAIL(c))) && curr > 1 && (char)c == linebuf[curr-2])
 		{
 			backc();
 			backc();
+			STORE_CHAR(linebuf[curr], AT_BOLD, pos);
 			overstrike = 2;
-		} else if (utf_mode && curr > 0 && (char)c == linebuf[curr-1])
+		} else if (utf_mode && curr > 0 && (IS_UTF8_2BYTE(c) || (overstrike==1 && IS_UTF8_TRAIL(c))) && (char)c == linebuf[curr-1])
 		{
 			backc();
 			STORE_CHAR(linebuf[curr], AT_BOLD, pos);
 			overstrike = 1;
+		} else if (utf_mode && curr > 0 && IS_UTF8_TRAIL(c) && attr[curr-1] == AT_UNDERLINE)
+		{
+			STOREC(c, AT_UNDERLINE);
 		} else if ((char)c == linebuf[curr])
 		{
-			STOREC(c, AT_BOLD);
+			/*
+			 * Overstriking a char with itself means make it bold.
+			 * But overstriking an underscore with itself is
+			 * ambiguous.  It could mean make it bold, or
+			 * it could mean make it underlined.
+			 * Use the previous overstrike to resolve it.
+			 */
+			if (c == '_' && last_overstrike != AT_NORMAL)
+				STOREC(c, last_overstrike);
+			else
+				STOREC(c, AT_BOLD);
 		} else if (c == '_')
 		{
 			if (utf_mode)
 			{
-				if (curr > 0 && IS_CONT(linebuf[curr]))
-					attr[curr-1] = AT_UNDERLINE;
-				if (curr > 1 && IS_CONT(linebuf[curr-1]))
-					attr[curr-2] = AT_UNDERLINE;
-				if (curr > 2 && IS_CONT(linebuf[curr-2]))
-					attr[curr-3] = AT_UNDERLINE;
-				if (curr > 3 && IS_CONT(linebuf[curr-3]))
-					attr[curr-4] = AT_UNDERLINE;
-				if (curr > 4 && IS_CONT(linebuf[curr-4]))
-					attr[curr-5] = AT_UNDERLINE;
+				int i;
+				for (i = 0;  i < 5;  i++)
+				{
+					if (curr <= i || !IS_CONT(linebuf[curr-i]))
+						break;
+					attr[curr-i-1] = AT_UNDERLINE;
+				}
 			}
 			STOREC(linebuf[curr], AT_UNDERLINE);
 		} else if (linebuf[curr] == '_')
 		{
+			if (utf_mode)
+			{
+				if (IS_UTF8_2BYTE(c))
+					overstrike = 1;
+				else if (IS_UTF8_3BYTE(c))
+					overstrike = 2;
+				else if (IS_UTF8_4BYTE(c))
+					overstrike = 3;
+			}
 			STOREC(c, AT_UNDERLINE);
 		} else if (control_char(c))
 			goto do_control_char;
Index: contrib/less/linenum.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/linenum.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 linenum.c
--- contrib/less/linenum.c	7 Jan 2002 20:28:52 -0000	1.1.1.2
+++ contrib/less/linenum.c	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
@@ -39,13 +39,13 @@
  * Structure to keep track of a line number and the associated file position.
  * A doubly-linked circular list of line numbers is kept ordered by line number.
  */
-struct linenum
+struct linenum_info
 {
-	struct linenum *next;		/* Link to next in the list */
-	struct linenum *prev;		/* Line to previous in the list */
+	struct linenum_info *next;	/* Link to next in the list */
+	struct linenum_info *prev;	/* Line to previous in the list */
 	POSITION pos;			/* File position */
 	POSITION gap;			/* Gap between prev and next */
-	int line;			/* Line number */
+	LINENUM line;			/* Line number */
 };
 /*
  * "gap" needs some explanation: the gap of any particular line number
@@ -62,10 +62,10 @@
 
 public int lnloop = 0;			/* Are we in the line num loop? */
 
-static struct linenum anchor;		/* Anchor of the list */
-static struct linenum *freelist;	/* Anchor of the unused entries */
-static struct linenum pool[NPOOL];	/* The pool itself */
-static struct linenum *spare;		/* We always keep one spare entry */
+static struct linenum_info anchor;	/* Anchor of the list */
+static struct linenum_info *freelist;	/* Anchor of the unused entries */
+static struct linenum_info pool[NPOOL];	/* The pool itself */
+static struct linenum_info *spare;		/* We always keep one spare entry */
 
 extern int linenums;
 extern int sigs;
@@ -77,7 +77,7 @@
 	public void
 clr_linenum()
 {
-	register struct linenum *p;
+	register struct linenum_info *p;
 
 	/*
 	 * Put all the entries on the free list.
@@ -104,7 +104,7 @@
  */
 	static void
 calcgap(p)
-	register struct linenum *p;
+	register struct linenum_info *p;
 {
 	/*
 	 * Don't bother to compute a gap for the anchor.
@@ -123,14 +123,14 @@
  * FIRST character in the specified line.
  */
 	public void
-add_lnum(lno, pos)
-	int lno;
+add_lnum(linenum, pos)
+	LINENUM linenum;
 	POSITION pos;
 {
-	register struct linenum *p;
-	register struct linenum *new;
-	register struct linenum *nextp;
-	register struct linenum *prevp;
+	register struct linenum_info *p;
+	register struct linenum_info *new;
+	register struct linenum_info *nextp;
+	register struct linenum_info *prevp;
 	register POSITION mingap;
 
 	/*
@@ -138,7 +138,7 @@
 	 * The entries are sorted by position.
 	 */
 	for (p = anchor.next;  p != &anchor && p->pos < pos;  p = p->next)
-		if (p->line == lno)
+		if (p->line == linenum)
 			/* We already have this one. */
 			return;
 	nextp = p;
@@ -169,7 +169,7 @@
 	new->next = nextp;
 	new->prev = prevp;
 	new->pos = pos;
-	new->line = lno;
+	new->line = linenum;
 
 	nextp->prev = new;
 	prevp->next = new;
@@ -253,12 +253,12 @@
  * Find the line number associated with a given position.
  * Return 0 if we can't figure it out.
  */
-	public int
+	public LINENUM
 find_linenum(pos)
 	POSITION pos;
 {
-	register struct linenum *p;
-	register int lno;
+	register struct linenum_info *p;
+	register LINENUM linenum;
 	POSITION cpos;
 
 	if (!linenums)
@@ -309,7 +309,7 @@
 		if (ch_seek(p->pos))
 			return (0);
 		loopcount = 0;
-		for (lno = p->line, cpos = p->pos;  cpos < pos;  lno++)
+		for (linenum = p->line, cpos = p->pos;  cpos < pos;  linenum++)
 		{
 			/*
 			 * Allow a signal to abort this loop.
@@ -323,13 +323,13 @@
 		/*
 		 * We might as well cache it.
 		 */
-		add_lnum(lno, cpos);
+		add_lnum(linenum, cpos);
 		/*
 		 * If the given position is not at the start of a line,
 		 * make sure we return the correct line number.
 		 */
 		if (cpos > pos)
-			lno--;
+			linenum--;
 	} else
 	{
 		/*
@@ -338,7 +338,7 @@
 		if (ch_seek(p->pos))
 			return (0);
 		loopcount = 0;
-		for (lno = p->line, cpos = p->pos;  cpos > pos;  lno--)
+		for (linenum = p->line, cpos = p->pos;  cpos > pos;  linenum--)
 		{
 			/*
 			 * Allow a signal to abort this loop.
@@ -352,10 +352,10 @@
 		/*
 		 * We might as well cache it.
 		 */
-		add_lnum(lno, cpos);
+		add_lnum(linenum, cpos);
 	}
 
-	return (lno);
+	return (linenum);
 }
 
 /*
@@ -363,14 +363,14 @@
  * Return NULL_POSITION if we can't figure it out.
  */
 	public POSITION
-find_pos(lno)
-	int lno;
+find_pos(linenum)
+	LINENUM linenum;
 {
-	register struct linenum *p;
+	register struct linenum_info *p;
 	POSITION cpos;
-	int clno;
+	LINENUM clinenum;
 
-	if (lno <= 1)
+	if (linenum <= 1)
 		/*
 		 * Line number 1 is beginning of file.
 		 */
@@ -379,13 +379,13 @@
 	/*
 	 * Find the entry nearest to the line number we want.
 	 */
-	for (p = anchor.next;  p != &anchor && p->line < lno;  p = p->next)
+	for (p = anchor.next;  p != &anchor && p->line < linenum;  p = p->next)
 		continue;
-	if (p->line == lno)
+	if (p->line == linenum)
 		/* Found it exactly. */
 		return (p->pos);
 
-	if (p == &anchor || lno - p->prev->line < p->line - lno)
+	if (p == &anchor || linenum - p->prev->line < p->line - linenum)
 	{
 		/*
 		 * Go forward.
@@ -393,7 +393,7 @@
 		p = p->prev;
 		if (ch_seek(p->pos))
 			return (NULL_POSITION);
-		for (clno = p->line, cpos = p->pos;  clno < lno;  clno++)
+		for (clinenum = p->line, cpos = p->pos;  clinenum < linenum;  clinenum++)
 		{
 			/*
 			 * Allow a signal to abort this loop.
@@ -409,7 +409,7 @@
 		 */
 		if (ch_seek(p->pos))
 			return (NULL_POSITION);
-		for (clno = p->line, cpos = p->pos;  clno > lno;  clno--)
+		for (clinenum = p->line, cpos = p->pos;  clinenum > linenum;  clinenum--)
 		{
 			/*
 			 * Allow a signal to abort this loop.
@@ -422,7 +422,7 @@
 	/*
 	 * We might as well cache it.
 	 */
-	add_lnum(clno, cpos);
+	add_lnum(clinenum, cpos);
 	return (cpos);
 }
 
@@ -431,13 +431,13 @@
  * The argument "where" tells which line is to be considered
  * the "current" line (e.g. TOP, BOTTOM, MIDDLE, etc).
  */
-	public int
+	public LINENUM
 currline(where)
 	int where;
 {
 	POSITION pos;
 	POSITION len;
-	int lnum;
+	LINENUM linenum;
 
 	pos = position(where);
 	len = ch_length();
@@ -445,8 +445,8 @@
 		pos = position(++where);
 	if (pos == NULL_POSITION)
 		pos = len;
-	lnum = find_linenum(pos);
+	linenum = find_linenum(pos);
 	if (pos == len)
-		lnum--;
-	return (lnum);
+		linenum--;
+	return (linenum);
 }
Index: contrib/less/lsystem.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/lsystem.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 lsystem.c
--- contrib/less/lsystem.c	7 Jan 2002 20:28:52 -0000	1.1.1.2
+++ contrib/less/lsystem.c	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
@@ -130,17 +130,12 @@
 			p = save(shell);
 		else
 		{
-			char *esccmd;
-			if ((esccmd = esc_metachars(cmd)) == NULL)
-			{
-				p = (char *) ecalloc(strlen(shell) +
-					strlen(cmd) + 7, sizeof(char));
-				sprintf(p, "%s -c \"%s\"", shell, cmd);
-			} else
+			char *esccmd = shell_quote(cmd);
+			if (esccmd != NULL)
 			{
 				p = (char *) ecalloc(strlen(shell) +
 					strlen(esccmd) + 5, sizeof(char));
-				sprintf(p, "%s -c %s", shell, esccmd);
+				sprintf(p, "%s %s %s", shell, shell_coption(), esccmd);
 				free(esccmd);
 			}
 		}
@@ -152,7 +147,6 @@
 		else
 			p = save(cmd);
 	}
-
 	system(p);
 	free(p);
 #else
Index: contrib/less/main.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/main.c,v
retrieving revision 1.3
diff -u -r1.3 main.c
--- contrib/less/main.c	7 Jan 2002 20:37:09 -0000	1.3
+++ contrib/less/main.c	3 Jul 2003 19:20:57 -0000
@@ -1,6 +1,6 @@
 /* $FreeBSD: src/contrib/less/main.c,v 1.3 2002/01/07 20:37:09 ps Exp $ */
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
@@ -33,7 +33,6 @@
 public int	quitting;
 public int	secure;
 public int	dohelp;
-public int	more_mode = 0;
 
 #if LOGFILE
 public int	logfile = -1;
@@ -70,7 +69,6 @@
 {
 	IFILE ifile;
 	char *s;
-	extern char *__progname;
 
 #ifdef __EMX__
 	_response(&argc, &argv);
@@ -111,9 +109,6 @@
 	 * Process command line arguments and LESS environment arguments.
 	 * Command line arguments override environment arguments.
 	 */
-	if (strcmp(__progname, "more") == 0)
-		more_mode = 1;
-
 	is_tty = isatty(1);
 	get_term();
 	init_cmds();
@@ -121,16 +116,7 @@
 	init_charset();
 	init_line();
 	init_option();
-	
-	if (more_mode) {
-		scan_option("-E");
-		scan_option("-m");
-		scan_option("-G");
-		scan_option("-f");
-		s = lgetenv("MORE");
-	} else {
-		s = lgetenv("LESS");
-	}
+	s = lgetenv("LESS");
 	if (s != NULL)
 		scan_option(save(s));
 
@@ -177,6 +163,7 @@
 		ifile = get_ifile(FAKE_HELPFILE, ifile);
 	while (argc-- > 0)
 	{
+		char *filename;
 #if (MSDOS_COMPILER && MSDOS_COMPILER != DJGPPC)
 		/*
 		 * Because the "shell" doesn't expand filename patterns,
@@ -186,16 +173,23 @@
 		 */
 		struct textlist tlist;
 		char *gfilename;
-		char *filename;
 		
 		gfilename = lglob(*argv++);
 		init_textlist(&tlist, gfilename);
 		filename = NULL;
 		while ((filename = forw_textlist(&tlist, filename)) != NULL)
-			ifile = get_ifile(filename, ifile);
+		{
+			(void) get_ifile(filename, ifile);
+			ifile = prev_ifile(NULL_IFILE);
+		}
 		free(gfilename);
 #else
-		ifile = get_ifile(*argv++, ifile);
+		filename = shell_quote(*argv);
+		if (filename == NULL)
+			filename = *argv;
+		argv++;
+		(void) get_ifile(filename, ifile);
+		ifile = prev_ifile(NULL_IFILE);
 #endif
 	}
 	/*
@@ -221,14 +215,13 @@
 		quit(QUIT_OK);
 	}
 
-	if (missing_cap && !know_dumb && !more_mode)
+	if (missing_cap && !know_dumb)
 		error("WARNING: terminal is not fully functional", NULL_PARG);
 	init_mark();
-	raw_mode(1);
 	open_getchr();
+	raw_mode(1);
 	init_signals(1);
 
-
 	/*
 	 * Select the first file to examine.
 	 */
@@ -273,6 +266,7 @@
 	commands();
 	quit(QUIT_OK);
 	/*NOTREACHED*/
+	return (0);
 }
 
 /*
@@ -307,6 +301,7 @@
 	error("Cannot allocate memory", NULL_PARG);
 	quit(QUIT_ERROR);
 	/*NOTREACHED*/
+	return (NULL);
 }
 
 /*
Index: contrib/less/mark.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/mark.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 mark.c
--- contrib/less/mark.c	22 May 2000 09:53:22 -0000	1.1.1.1
+++ contrib/less/mark.c	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
Index: contrib/less/mkhelp.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/mkhelp.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 mkhelp.c
--- contrib/less/mkhelp.c	22 May 2000 09:53:22 -0000	1.1.1.1
+++ contrib/less/mkhelp.c	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
Index: contrib/less/optfunc.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/optfunc.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 optfunc.c
--- contrib/less/optfunc.c	7 Jan 2002 20:28:53 -0000	1.1.1.2
+++ contrib/less/optfunc.c	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
@@ -29,7 +29,7 @@
 #include "option.h"
 
 extern int nbufs;
-extern int cbufs;
+extern int bufspace;
 extern int pr_type;
 extern int plusoption;
 extern int swindow;
@@ -106,9 +106,8 @@
 			error("No log file", NULL_PARG);
 		else
 		{
-			parg.p_string = unquote_file(namelogfile);
+			parg.p_string = namelogfile;
 			error("Log file \"%s\"", &parg);
-			free(parg.p_string);
 		}
 		break;
 	}
@@ -143,7 +142,7 @@
 	{
 	case INIT:
 		t = s;
-		n = getnum(&t, 'l', &err);
+		n = getnum(&t, "l", &err);
 		if (err || n <= 0)
 		{
 			error("Line number is required after -l", NULL_PARG);
@@ -168,9 +167,8 @@
 	case INIT:
 		if (lesskey(s, 0))
 		{
-			parg.p_string = unquote_file(s);
+			parg.p_string = s;
 			error("Cannot use lesskey file \"%s\"", &parg);
-			free(parg.p_string);
 		}
 		break;
 	}
@@ -236,9 +234,8 @@
 		tags = lglob(s);
 		break;
 	case QUERY:
-		parg.p_string = unquote_file(tags);
+		parg.p_string = tags;
 		error("Tags file \"%s\"", &parg);
-		free(parg.p_string);
 		break;
 	}
 }
@@ -316,14 +313,14 @@
 {
 	switch (type)
 	{
+	case INIT:
 	case TOGGLE:
-	case QUERY:
 		/*
-		 * Allocate the new number of buffers.
+		 * Set the new number of buffers.
 		 */
-		cbufs = ch_nbuf(cbufs);
+		ch_setbufspace(bufspace);
 		break;
-	case INIT:
+	case QUERY:
 		break;
 	}
 }
@@ -370,7 +367,7 @@
 		any_display = 1;
 		putstr("less ");
 		putstr(version);
-		putstr("\nCopyright (C) 2001 Mark Nudelman\n\n");
+		putstr("\nCopyright (C) 2002 Mark Nudelman\n\n");
 		putstr("less comes with NO WARRANTY, to the extent permitted by law.\n");
 		putstr("For information about the terms of redistribution,\n");
 		putstr("see the file named README in the less distribution.\n");
@@ -393,7 +390,7 @@
 	int fg, bg;
 	int err;
 	
-	fg = getnum(&s, 'D', &err);
+	fg = getnum(&s, "D", &err);
 	if (err)
 	{
 		error("Missing fg color in -D", NULL_PARG);
@@ -404,7 +401,7 @@
 	else
 	{
 		s++;
-		bg = getnum(&s, 'D', &err);
+		bg = getnum(&s, "D", &err);
 		if (err)
 		{
 			error("Missing fg color in -D", NULL_PARG);
@@ -486,10 +483,12 @@
 		for (i = 1;  i < TABSTOP_MAX;  )
 		{
 			int n = 0;
+			s = skipsp(s);
 			while (*s >= '0' && *s <= '9')
 				n = (10 * n) + (*s++ - '0');
 			if (n > tabstops[i-1])
 				tabstops[i++] = n;
+			s = skipsp(s);
 			if (*s++ != ',')
 				break;
 		}
@@ -534,6 +533,11 @@
 	{
 	case INIT:
 	case TOGGLE:
+		if (s[0] == '\0')
+		{
+			openquote = closequote = '\0';
+			break;
+		}
 		if (s[1] != '\0' && s[2] != '\0')
 		{
 			error("-\" must be followed by 1 or 2 chars", NULL_PARG);
Index: contrib/less/option.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/option.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 option.c
--- contrib/less/option.c	7 Jan 2002 20:28:55 -0000	1.1.1.2
+++ contrib/less/option.c	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
@@ -21,7 +21,7 @@
 #include "less.h"
 #include "option.h"
 
-static struct option *pendopt;
+static struct loption *pendopt;
 public int plusoption = FALSE;
 
 static char *propt();
@@ -39,7 +39,7 @@
 scan_option(s)
 	char *s;
 {
-	register struct option *o;
+	register struct loption *o;
 	register int optc;
 	char *optname;
 	char *printopt;
@@ -116,8 +116,7 @@
 			 * EVERY input file.
 			 */
 			plusoption = TRUE;
-			str = s;
-			s = optstring(s, propt('+'), NULL);
+			s = optstring(s, &str, propt('+'), NULL);
 			if (*str == '+')
 				every_first_cmd = save(++str);
 			else
@@ -225,8 +224,9 @@
 			 * All processing of STRING options is done by 
 			 * the handling function.
 			 */
-			str = s;
-			s = optstring(s, printopt, o->odesc[1]);
+			while (*s == ' ')
+				s++;
+			s = optstring(s, &str, printopt, o->odesc[1]);
 			break;
 		case NUMBER:
 			if (*s == '\0')
@@ -260,7 +260,7 @@
 	char *s;
 	int how_toggle;
 {
-	register struct option *o;
+	register struct loption *o;
 	register int num;
 	int no_prompt;
 	int err;
@@ -382,7 +382,7 @@
 			switch (how_toggle)
 			{
 			case OPT_TOGGLE:
-				num = getnum(&s, '\0', &err);
+				num = getnum(&s, NULL, &err);
 				if (!err)
 					*(o->ovar) = num;
 				break;
@@ -480,7 +480,7 @@
 single_char_option(c)
 	int c;
 {
-	register struct option *o;
+	register struct loption *o;
 
 	o = findopt(c);
 	if (o == NULL)
@@ -496,7 +496,7 @@
 opt_prompt(c)
 	int c;
 {
-	register struct option *o;
+	register struct loption *o;
 
 	o = findopt(c);
 	if (o == NULL || (o->otype & (STRING|NUMBER)) == 0)
@@ -544,20 +544,22 @@
  * Return a pointer to the remainder of the string, if any.
  */
 	static char *
-optstring(s, printopt, validchars)
+optstring(s, p_str, printopt, validchars)
 	char *s;
+	char **p_str;
 	char *printopt;
 	char *validchars;
 {
 	register char *p;
-	PARG parg;
 
 	if (*s == '\0')
 	{
 		nostring(printopt);
 		quit(QUIT_ERROR);
 	}
+	*p_str = s;
 	for (p = s;  *p != '\0';  p++)
+	{
 		if (*p == END_OPTION_STRING ||
 		    (validchars != NULL && strchr(validchars, *p) == NULL))
 		{
@@ -565,15 +567,19 @@
 			{
 			case END_OPTION_STRING:
 			case ' ':  case '\t':  case '-':
+				/* Replace the char with a null to terminate string. */
+				*p++ = '\0';
 				break;
 			default:
-				parg.p_string = p;
-				error("Option string needs delimiter before %s", &parg);
+				/* 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';
 				break;
 			}
-			*p = '\0';
-			return (p+1);
+			break;
 		}
+	}
 	return (p);
 }
 
@@ -607,8 +613,11 @@
 			*errp = TRUE;
 			return (-1);
 		}
-		parg.p_string = printopt;
-		error("Number is required after %s", &parg);
+		if (printopt != NULL)
+		{
+			parg.p_string = printopt;
+			error("Number is required after %s", &parg);
+		}
 		quit(QUIT_ERROR);
 	}
 
Index: contrib/less/option.h
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/option.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 option.h
--- contrib/less/option.h	22 May 2000 09:53:22 -0000	1.1.1.1
+++ contrib/less/option.h	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
@@ -23,6 +23,7 @@
 #define	NO_TOGGLE	0100	/* Option cannot be toggled with "-" cmd */
 #define	HL_REPAINT	0200	/* Repaint hilites after toggling option */
 #define	NO_QUERY	0400	/* Option cannot be queried with "_" cmd */
+#define	INIT_HANDLER	01000	/* Call option handler function at startup */
 
 #define	OTYPE		(BOOL|TRIPLE|NUMBER|STRING|NOVAR)
 
@@ -49,7 +50,7 @@
 	struct optname *onext;  /* List of synonymous option names */
 };
 
-struct option
+struct loption
 {
 	char oletter;		/* The controlling letter (a-z) */
 	struct optname *onames; /* Long (GNU-style) option name */
Index: contrib/less/opttbl.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/opttbl.c,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 opttbl.c
--- contrib/less/opttbl.c	7 Jan 2002 20:28:55 -0000	1.1.1.3
+++ contrib/less/opttbl.c	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
@@ -34,8 +34,8 @@
 public int forw_scroll;		/* Repaint screen on forward movement */
 public int caseless;		/* Do "caseless" searches */
 public int linenums;		/* Use line numbers */
-public int cbufs;		/* Current number of buffers */
 public int autobuf;		/* Automatically allocate buffers as needed */
+public int bufspace;		/* Max buffer space per file (K) */
 public int ctldisp;		/* Send control chars to screen untranslated */
 public int force_open;		/* Open the file even if not regular file */
 public int swindow;		/* Size of scrolling window */
@@ -47,6 +47,7 @@
 public int show_attn;		/* Hilite first unread line */
 public int shift_count;		/* Number of positions to shift horizontally */
 public int status_col;		/* Display a status column */
+public int use_lessopen;	/* Use the LESSOPEN filter */
 #if HILITE_SEARCH
 public int hilite_search;	/* Highlight matched search patterns? */
 #endif
@@ -75,6 +76,7 @@
 #if USERFILE
 static struct optname k_optname      = { "lesskey-file",         NULL };
 #endif
+static struct optname L__optname     = { "no-lessopen",          NULL };
 static struct optname m_optname      = { "long-prompt",          NULL };
 static struct optname n_optname      = { "line-numbers",         NULL };
 #if LOGFILE
@@ -118,238 +120,304 @@
  * a new value, and odesc[1], if not NULL, is the set of characters
  * that are valid in the string.
  */
-static struct option option[] =
+static struct loption option[] =
 {
 	{ 'a', &a_optname,
 		BOOL, OPT_OFF, &how_search, NULL,
-		"Search includes displayed screen",
-		"Search skips displayed screen",
-		NULL
+		{
+			"Search includes displayed screen",
+			"Search skips displayed screen",
+			NULL
+		}
 	},
 
 	{ 'b', &b_optname,
-		NUMBER, 10, &cbufs, opt_b, 
-		"Buffers: ",
-		"%d buffers",
-		NULL
+		NUMBER|INIT_HANDLER, 64, &bufspace, opt_b, 
+		{
+			"Max buffer space per file (K): ",
+			"Max buffer space per file: %dK",
+			NULL
+		}
 	},
 	{ 'B', &B__optname,
 		BOOL, OPT_ON, &autobuf, NULL,
-		"Don't automatically allocate buffers",
-		"Automatically allocate buffers when needed",
-		NULL
+		{
+			"Don't automatically allocate buffers",
+			"Automatically allocate buffers when needed",
+			NULL
+		}
 	},
 	{ 'c', &c_optname,
 		TRIPLE, OPT_OFF, &top_scroll, NULL,
-		"Repaint by scrolling from bottom of screen",
-		"Repaint by clearing each line",
-		"Repaint by painting from top of screen"
+		{
+			"Repaint by scrolling from bottom of screen",
+			"Repaint by clearing each line",
+			"Repaint by painting from top of screen"
+		}
 	},
 	{ 'd', &d_optname,
 		BOOL|NO_TOGGLE, OPT_OFF, &know_dumb, NULL,
-		"Assume intelligent terminal",
-		"Assume dumb terminal",
-		NULL
+		{
+			"Assume intelligent terminal",
+			"Assume dumb terminal",
+			NULL
+		}
 	},
 #if MSDOS_COMPILER
 	{ 'D', &D__optname,
 		STRING|REPAINT|NO_QUERY, 0, NULL, opt_D,
-		"color desc: ", 
-		"Ddknsu0123456789.",
-		NULL
+		{
+			"color desc: ", 
+			"Ddknsu0123456789.",
+			NULL
+		}
 	},
 #endif
 	{ 'e', &e_optname,
 		TRIPLE, OPT_OFF, &quit_at_eof, NULL,
-		"Don't quit at end-of-file",
-		"Quit at end-of-file",
-		"Quit immediately at end-of-file"
+		{
+			"Don't quit at end-of-file",
+			"Quit at end-of-file",
+			"Quit immediately at end-of-file"
+		}
 	},
 	{ 'f', &f_optname,
 		BOOL, OPT_OFF, &force_open, NULL,
-		"Open only regular files",
-		"Open even non-regular files",
-		NULL
+		{
+			"Open only regular files",
+			"Open even non-regular files",
+			NULL
+		}
 	},
 	{ 'F', &F__optname,
 		BOOL, OPT_OFF, &quit_if_one_screen, NULL,
-		"Don't quit if end-of-file on first screen",
-		"Quit if end-of-file on first screen",
-		NULL
+		{
+			"Don't quit if end-of-file on first screen",
+			"Quit if end-of-file on first screen",
+			NULL
+		}
 	},
 #if HILITE_SEARCH
 	{ 'g', &g_optname,
 		TRIPLE|HL_REPAINT, OPT_ONPLUS, &hilite_search, NULL,
-		"Don't highlight search matches",
-		"Highlight matches for previous search only",
-		"Highlight all matches for previous search pattern",
+		{
+			"Don't highlight search matches",
+			"Highlight matches for previous search only",
+			"Highlight all matches for previous search pattern",
+		}
 	},
 #endif
 	{ 'h', &h_optname,
 		NUMBER, -1, &back_scroll, NULL,
-		"Backwards scroll limit: ",
-		"Backwards scroll limit is %d lines",
-		NULL
+		{
+			"Backwards scroll limit: ",
+			"Backwards scroll limit is %d lines",
+			NULL
+		}
 	},
 	{ 'i', &i_optname,
 		TRIPLE|HL_REPAINT, OPT_OFF, &caseless, opt_i,
-		"Case is significant in searches",
-		"Ignore case in searches",
-		"Ignore case in searches and in patterns"
+		{
+			"Case is significant in searches",
+			"Ignore case in searches",
+			"Ignore case in searches and in patterns"
+		}
 	},
 	{ 'j', &j_optname,
 		NUMBER, 1, &jump_sline, NULL,
-		"Target line: ",
-		"Position target at screen line %d",
-		NULL
+		{
+			"Target line: ",
+			"Position target at screen line %d",
+			NULL
+		}
 	},
 	{ 'J', &J__optname,
 		BOOL|REPAINT, OPT_OFF, &status_col, NULL,
-		"Don't display a status column",
-		"Display a status column",
-		NULL
+		{
+			"Don't display a status column",
+			"Display a status column",
+			NULL
+		}
 	},
 #if USERFILE
 	{ 'k', &k_optname,
 		STRING|NO_TOGGLE|NO_QUERY, 0, NULL, opt_k,
-		NULL, NULL, NULL
+		{ NULL, NULL, NULL }
 	},
 #endif
 	{ 'l', NULL,
 		STRING|NO_TOGGLE|NO_QUERY, 0, NULL, opt_l,
-		NULL, NULL, NULL
+		{ NULL, NULL, NULL }
+	},
+	{ 'L', &L__optname,
+		BOOL, OPT_ON, &use_lessopen, NULL,
+		{
+			"Don't use the LESSOPEN filter",
+			"Use the LESSOPEN filter",
+			NULL
+		}
 	},
 	{ 'm', &m_optname,
 		TRIPLE, OPT_OFF, &pr_type, NULL,
-		"Short prompt",
-		"Medium prompt",
-		"Long prompt"
+		{
+			"Short prompt",
+			"Medium prompt",
+			"Long prompt"
+		}
 	},
 	{ 'n', &n_optname,
 		TRIPLE|REPAINT, OPT_ON, &linenums, NULL,
-		"Don't use line numbers",
-		"Use line numbers",
-		"Constantly display line numbers"
+		{
+			"Don't use line numbers",
+			"Use line numbers",
+			"Constantly display line numbers"
+		}
 	},
 #if LOGFILE
 	{ 'o', &o_optname,
 		STRING, 0, NULL, opt_o,
-		"log file: ", NULL, NULL
+		{ "log file: ", NULL, NULL }
 	},
 	{ 'O', &O__optname,
 		STRING, 0, NULL, opt__O,
-		"Log file: ", NULL, NULL
+		{ "Log file: ", NULL, NULL }
 	},
 #endif
 	{ 'p', &p_optname,
 		STRING|NO_TOGGLE|NO_QUERY, 0, NULL, opt_p,
-		NULL, NULL, NULL
+		{ NULL, NULL, NULL }
 	},
 	{ 'P', &P__optname,
 		STRING, 0, NULL, opt__P,
-		"prompt: ", NULL, NULL
+		{ "prompt: ", NULL, NULL }
 	},
 	{ 'q', &q_optname,
 		TRIPLE, OPT_OFF, &quiet, NULL,
-		"Ring the bell for errors AND at eof/bof",
-		"Ring the bell for errors but not at eof/bof",
-		"Never ring the bell"
+		{
+			"Ring the bell for errors AND at eof/bof",
+			"Ring the bell for errors but not at eof/bof",
+			"Never ring the bell"
+		}
 	},
 	{ 'r', &r_optname,
 		TRIPLE|REPAINT, OPT_OFF, &ctldisp, NULL,
-		"Display control characters as ^X",
-		"Display control characters directly",
-		"Display control characters directly, processing ANSI sequences"
+		{
+			"Display control characters as ^X",
+			"Display control characters directly",
+			"Display control characters directly, processing ANSI sequences"
+		}
 	},
 	{ 's', &s_optname,
 		BOOL|REPAINT, OPT_OFF, &squeeze, NULL,
-		"Display all blank lines",
-		"Squeeze multiple blank lines",
-		NULL
+		{
+			"Display all blank lines",
+			"Squeeze multiple blank lines",
+			NULL
+		}
 	},
 	{ 'S', &S__optname,
 		BOOL|REPAINT, OPT_OFF, &chopline, NULL,
-		"Fold long lines",
-		"Chop long lines",
-		NULL
+		{
+			"Fold long lines",
+			"Chop long lines",
+			NULL
+		}
 	},
 #if TAGS
 	{ 't', &t_optname,
 		STRING|NO_QUERY, 0, NULL, opt_t,
-		"tag: ", NULL, NULL
+		{ "tag: ", NULL, NULL }
 	},
 	{ 'T', &T__optname,
 		STRING, 0, NULL, opt__T,
-		"tags file: ", NULL, NULL
+		{ "tags file: ", NULL, NULL }
 	},
 #endif
 	{ 'u', &u_optname,
 		TRIPLE|REPAINT, OPT_OFF, &bs_mode, NULL,
-		"Display underlined text in underline mode",
-		"Backspaces cause overstrike",
-		"Print backspace as ^H"
+		{
+			"Display underlined text in underline mode",
+			"Backspaces cause overstrike",
+			"Print backspace as ^H"
+		}
 	},
 	{ 'V', &V__optname,
 		NOVAR, 0, NULL, opt__V,
-		NULL, NULL, NULL
+		{ NULL, NULL, NULL }
 	},
 	{ 'w', &w_optname,
 		TRIPLE|REPAINT, OPT_OFF, &show_attn, NULL,
-		"Don't highlight first unread line",
-		"Highlight first unread line after forward-screen",
-		"Highlight first unread line after any forward movement",
+		{
+			"Don't highlight first unread line",
+			"Highlight first unread line after forward-screen",
+			"Highlight first unread line after any forward movement",
+		}
 	},
 	{ 'x', &x_optname,
 		STRING|REPAINT, 0, NULL, opt_x,
-		"Tab stops: ",
-		"0123456789,",
-		NULL
+		{
+			"Tab stops: ",
+			"0123456789,",
+			NULL
+		}
 	},
 	{ 'X', &X__optname,
 		BOOL|NO_TOGGLE, OPT_OFF, &no_init, NULL,
-		"Send init/deinit strings to terminal",
-		"Don't use init/deinit strings",
-		NULL
+		{
+			"Send init/deinit strings to terminal",
+			"Don't use init/deinit strings",
+			NULL
+		}
 	},
 	{ 'y', &y_optname,
 		NUMBER, -1, &forw_scroll, NULL,
-		"Forward scroll limit: ",
-		"Forward scroll limit is %d lines",
-		NULL
+		{
+			"Forward scroll limit: ",
+			"Forward scroll limit is %d lines",
+			NULL
+		}
 	},
 	{ 'z', &z_optname,
 		NUMBER, -1, &swindow, NULL,
-		"Scroll window size: ",
-		"Scroll window size is %d lines",
-		NULL
+		{
+			"Scroll window size: ",
+			"Scroll window size is %d lines",
+			NULL
+		}
 	},
 	{ '"', &quote_optname,
 		STRING, 0, NULL, opt_quote,
-		"quotes: ", NULL, NULL
+		{ "quotes: ", NULL, NULL }
 	},
 	{ '~', &tilde_optname,
 		BOOL|REPAINT, OPT_ON, &twiddle, NULL,
-		"Don't show tildes after end of file",
-		"Show tildes after end of file",
-		NULL
+		{
+			"Don't show tildes after end of file",
+			"Show tildes after end of file",
+			NULL
+		}
 	},
 	{ '?', &query_optname,
 		NOVAR, 0, NULL, opt_query,
-		NULL, NULL, NULL
+		{ NULL, NULL, NULL }
 	},
 	{ '#', &pound_optname,
 		NUMBER, 0, &shift_count, NULL,
-		"Horizontal shift: ",
-		"Horizontal shift %d positions",
-		NULL
+		{
+			"Horizontal shift: ",
+			"Horizontal shift %d positions",
+			NULL
+		}
 	},
 	{ '.', &keypad_optname,
 		BOOL|NO_TOGGLE, OPT_OFF, &no_keypad, NULL,
-		"Use keypad mode",
-		"Don't use keypad mode",
-		NULL
+		{
+			"Use keypad mode",
+			"Don't use keypad mode",
+			NULL
+		}
 	},
-	{ '\0', NULL, NOVAR, 0, NULL, NULL, NULL, NULL, NULL }
+	{ '\0', NULL, NOVAR, 0, NULL, NULL, { NULL, NULL, NULL } }
 };
 
 
@@ -359,7 +427,7 @@
 	public void
 init_option()
 {
-	register struct option *o;
+	register struct loption *o;
 
 	for (o = option;  o->oletter != '\0';  o++)
 	{
@@ -368,17 +436,19 @@
 		 */
 		if (o->ovar != NULL)
 			*(o->ovar) = o->odefault;
+		if (o->otype & INIT_HANDLER)
+			(*(o->ofunc))(INIT, (char *) NULL);
 	}
 }
 
 /*
  * Find an option in the option table, given its option letter.
  */
-	public struct option *
+	public struct loption *
 findopt(c)
 	int c;
 {
-	register struct option *o;
+	register struct loption *o;
 
 	for (o = option;  o->oletter != '\0';  o++)
 	{
@@ -391,27 +461,44 @@
 }
 
 /*
+ *
+ */
+	static int
+is_optchar(c)
+	char c;
+{
+	if (SIMPLE_IS_UPPER(c))
+		return 1;
+	if (SIMPLE_IS_LOWER(c))
+		return 1;
+	if (c == '-')
+		return 1;
+	return 0;
+}
+
+/*
  * Find an option in the option table, given its option name.
  * p_optname is the (possibly partial) name to look for, and
  * is updated to point after the matched name.
  * p_oname if non-NULL is set to point to the full option name.
  */
-	public struct option *
+	public struct loption *
 findopt_name(p_optname, p_oname, p_err)
 	char **p_optname;
 	char **p_oname;
 	int *p_err;
 {
 	char *optname = *p_optname;
-	register struct option *o;
+	register struct loption *o;
 	register struct optname *oname;
 	register int len;
 	int uppercase;
-	struct option *maxo = NULL;
+	struct loption *maxo = NULL;
 	struct optname *maxoname = NULL;
 	int maxlen = 0;
 	int ambig = 0;
 	int exact = 0;
+	char *eq;
 
 	/*
 	 * Check all options.
@@ -431,6 +518,13 @@
 			for (uppercase = 0;  uppercase <= 1;  uppercase++)
 			{
 				len = sprefix(optname, oname->oname, uppercase);
+				if (len <= 0 || is_optchar(optname[len]))
+				{
+					/*
+					 * We didn't use all of the option name.
+					 */
+					continue;
+				}
 				if (!exact && len == maxlen)
 					/*
 					 * Already had a partial match,
@@ -466,6 +560,6 @@
 	}
 	*p_optname = optname + maxlen;
 	if (p_oname != NULL)
-		*p_oname = maxoname->oname;
+		*p_oname = maxoname == NULL ? NULL : maxoname->oname;
 	return (maxo);
 }
Index: contrib/less/os.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/os.c,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 os.c
--- contrib/less/os.c	7 Jan 2002 20:28:56 -0000	1.1.1.3
+++ contrib/less/os.c	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
Index: contrib/less/output.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/output.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 output.c
--- contrib/less/output.c	7 Jan 2002 20:28:56 -0000	1.1.1.2
+++ contrib/less/output.c	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
@@ -29,6 +29,15 @@
 extern int any_display;
 extern int is_tty;
 
+#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC
+extern int ctldisp;
+extern int nm_fg_color, nm_bg_color;
+extern int bo_fg_color, bo_bg_color;
+extern int ul_fg_color, ul_bg_color;
+extern int so_fg_color, so_bg_color;
+extern int bl_fg_color, bl_bg_color;
+#endif
+
 /*
  * Display the line which is in the line buffer.
  */
@@ -149,6 +158,9 @@
 			{
 				col = 0;
 				row++;
+			} else if (*op == '\r')
+			{
+				col = 0;
 			} else
 			{
 				col++;
@@ -179,7 +191,156 @@
 	if (is_tty && any_display)
 	{
 		*ob = '\0';
-		cputs(obuf);
+		if (ctldisp != OPT_ONPLUS)
+			cputs(obuf);
+		else
+		{
+			/*
+			 * Look for SGR escape sequences, and convert them
+			 * to color commands.  Replace bold, underline,
+			 * and italic escapes into colors specified via
+			 * the -D command-line option.
+			 */
+			char *anchor, *p, *p_next;
+			int buflen = ob - obuf;
+			unsigned char fg, bg, norm_attr;
+			/*
+			 * Only dark colors mentioned here, so that
+			 * bold has visible effect.
+			 */
+			static enum COLORS screen_color[] = {
+				BLACK, RED, GREEN, BROWN,
+				BLUE, MAGENTA, CYAN, LIGHTGRAY
+			};
+
+			/* Normal text colors are used as baseline. */
+			bg = nm_bg_color & 0xf;
+			fg = nm_fg_color & 0xf;
+			norm_attr = (bg << 4) | fg;
+			for (anchor = p_next = obuf;
+			     (p_next = memchr (p_next, ESC,
+					       buflen - (p_next - obuf)))
+			       != NULL; )
+			{
+				p = p_next;
+
+				/*
+				 * Handle the null escape sequence
+				 * (ESC-[m), which is used to restore
+				 * the original color.
+				 */
+				if (p[1] == '[' && is_ansi_end(p[2]))
+				{
+					textattr(norm_attr);
+					p += 3;
+					anchor = p_next = p;
+					continue;
+				}
+
+				if (p[1] == '[')	/* "Esc-[" sequence */
+				{
+					/*
+					 * If some chars seen since
+					 * the last escape sequence,
+					 * write it out to the screen
+					 * using current text attributes.
+					 */
+					if (p > anchor)
+					{
+						*p = '\0';
+						cputs (anchor);
+						*p = ESC;
+						anchor = p;
+					}
+					p += 2;
+					p_next = p;
+					while (!is_ansi_end(*p))
+					{
+						char *q;
+						long code = strtol(p, &q, 10);
+
+						if (!*q)
+						{
+							/*
+							 * Incomplete sequence.
+							 * Leave it unprocessed
+							 * in the buffer.
+							 */
+							int slop = q - anchor;
+							strcpy(obuf, anchor);
+							ob = &obuf[slop];
+							return;
+						}
+
+						if (q == p
+						    || code > 49 || code < 0
+						    || (!is_ansi_end(*q)
+							&& *q != ';'))
+						{
+							p_next = q;
+							break;
+						}
+						if (*q == ';')
+							q++;
+
+						switch (code)
+						{
+						case 1:	/* bold on */
+							fg = bo_fg_color;
+							bg = bo_bg_color;
+							break;
+						case 3:	/* italic on */
+							fg = so_fg_color;
+							bg = so_bg_color;
+							break;
+						case 4:	/* underline on */
+							fg = ul_fg_color;
+							bg = ul_bg_color;
+							break;
+						case 8:	/* concealed on */
+							fg = (bg & 7) | 8;
+							break;
+						case 0:	/* all attrs off */
+						case 22:/* bold off */
+						case 23:/* italic off */
+						case 24:/* underline off */
+							fg = nm_fg_color;
+							bg = nm_bg_color;
+							break;
+						case 30: case 31: case 32:
+						case 33: case 34: case 35:
+						case 36: case 37:
+							fg = (fg & 8) | (screen_color[code - 30]);
+							break;
+						case 39: /* default fg */
+							fg = nm_fg_color;
+							break;
+						case 40: case 41: case 42:
+						case 43: case 44: case 45:
+						case 46: case 47:
+							bg = (bg & 8) | (screen_color[code - 40]);
+							break;
+						case 49: /* default fg */
+							bg = nm_bg_color;
+							break;
+						}
+						p = q;
+					}
+					if (is_ansi_end(*p) && p > p_next)
+					{
+						bg &= 15;
+						fg &= 15;
+						textattr ((bg << 4)| fg);
+						p_next = anchor = p + 1;
+					} else
+						break;
+				} else
+					p_next++;
+			}
+
+			/* Output what's left in the buffer.  */
+			cputs (anchor);
+		}
 		ob = obuf;
 		return;
 	}
@@ -239,35 +400,55 @@
 
 
 /*
+ * Convert an integral type to a string.
+ */
+#define TYPE_TO_A_FUNC(funcname, type) \
+void funcname(num, buf) \
+	type num; \
+	char *buf; \
+{ \
+	int neg = (num < 0); \
+	char tbuf[INT_STRLEN_BOUND(num)+2]; \
+	register char *s = tbuf + sizeof(tbuf); \
+	if (neg) num = -num; \
+	*--s = '\0'; \
+	do { \
+		*--s = (num % 10) + '0'; \
+	} while ((num /= 10) != 0); \
+	if (neg) *--s = '-'; \
+	strcpy(buf, s); \
+}
+
+TYPE_TO_A_FUNC(postoa, POSITION)
+TYPE_TO_A_FUNC(linenumtoa, LINENUM)
+TYPE_TO_A_FUNC(inttoa, int)
+
+/*
  * Output an integer in a given radix.
  */
 	static int
-iprintnum(num, radix)
+iprint_int(num)
 	int num;
-	int radix;
 {
-	register char *s;
-	int r;
-	int neg;
 	char buf[INT_STRLEN_BOUND(num)];
 
-	neg = (num < 0);
-	if (neg)
-		num = -num;
+	inttoa(num, buf);
+	putstr(buf);
+	return (strlen(buf));
+}
 
-	s = buf;
-	do
-	{
-		*s++ = (num % radix) + '0';
-	} while ((num /= radix) != 0);
+/*
+ * Output a line number in a given radix.
+ */
+	static int
+iprint_linenum(num)
+	LINENUM num;
+{
+	char buf[INT_STRLEN_BOUND(num)];
 
-	if (neg)
-		*s++ = '-';
-	r = s - buf;
-
-	while (s > buf)
-		putchr(*--s);
-	return (r);
+	linenumtoa(num, buf);
+	putstr(buf);
+	return (strlen(buf));
 }
 
 /*
@@ -280,7 +461,6 @@
 	PARG *parg;
 {
 	register char *s;
-	register int n;
 	register int col;
 
 	col = 0;
@@ -293,7 +473,8 @@
 		} else
 		{
 			++fmt;
-			switch (*fmt++) {
+			switch (*fmt++)
+			{
 			case 's':
 				s = parg->p_string;
 				parg++;
@@ -304,9 +485,12 @@
 				}
 				break;
 			case 'd':
-				n = parg->p_int;
+				col += iprint_int(parg->p_int);
+				parg++;
+				break;
+			case 'n':
+				col += iprint_linenum(parg->p_linenum);
 				parg++;
-				col += iprintnum(n, 10);
 				break;
 			}
 		}
Index: contrib/less/pckeys.h
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/pckeys.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 pckeys.h
--- contrib/less/pckeys.h	22 May 2000 09:53:22 -0000	1.1.1.1
+++ contrib/less/pckeys.h	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
Index: contrib/less/position.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/position.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 position.c
--- contrib/less/position.c	22 May 2000 09:53:22 -0000	1.1.1.1
+++ contrib/less/position.c	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
Index: contrib/less/position.h
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/position.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 position.h
--- contrib/less/position.h	22 May 2000 09:53:22 -0000	1.1.1.1
+++ contrib/less/position.h	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
Index: contrib/less/prompt.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/prompt.c,v
retrieving revision 1.3
diff -u -r1.3 prompt.c
--- contrib/less/prompt.c	7 Jan 2002 20:37:09 -0000	1.3
+++ contrib/less/prompt.c	3 Jul 2003 19:21:09 -0000
@@ -1,6 +1,6 @@
 /* $FreeBSD: src/contrib/less/prompt.c,v 1.3 2002/01/07 20:37:09 ps Exp $ */
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
@@ -114,31 +114,35 @@
 ap_pos(pos)
 	POSITION pos;
 {
-	char buf[INT_STRLEN_BOUND(pos) + 1]; 
-	char *p = buf + sizeof(buf) - 1;
-	int neg = (pos < 0);
- 
-	if (neg)
-		pos = -pos;
-	*p = '\0';
-	do
-		*--p = '0' + (pos % 10);
-	while ((pos /= 10) != 0);
-	if (neg)
-		*--p = '-';
-	ap_str(p);
+	char buf[INT_STRLEN_BOUND(pos) + 2];
+
+	postoa(pos, buf);
+	ap_str(buf);
+}
+
+/*
+ * Append a line number to the end of the message.
+ */
+ 	static void
+ap_linenum(linenum)
+	LINENUM linenum;
+{
+	char buf[INT_STRLEN_BOUND(linenum) + 2];
+
+	linenumtoa(linenum, buf);
+	ap_str(buf);
 }
 
 /*
  * Append an integer to the end of the message.
  */
 	static void
-ap_int(n)
-	int n;
+ap_int(num)
+	int num;
 {
-	char buf[INT_STRLEN_BOUND(n) + 1];
+	char buf[INT_STRLEN_BOUND(num) + 2];
 
-	sprintf(buf, "%d", n);
+	inttoa(num, buf);
 	ap_str(buf);
 }
 
@@ -200,9 +204,17 @@
 	case 'D':	/* Same as L */
 		return (linenums && ch_length() != NULL_POSITION);
 	case 'm':	/* More than one file? */
+#if TAGS
 		return (ntags() ? (ntags() > 1) : (nifile() > 1));
+#else
+		return (nifile() > 1);
+#endif
 	case 'n':	/* First prompt in a new file? */
+#if TAGS
 		return (ntags() ? 1 : new_file);
+#else
+		return (new_file);
+#endif
 	case 'p':	/* Percent into file (bytes) known? */
 		return (curr_byte(where) != NULL_POSITION && 
 				ch_length() > 0);
@@ -214,8 +226,10 @@
 	case 'B':
 		return (ch_length() != NULL_POSITION);
 	case 'x':	/* Is there a "next" file? */
+#if TAGS
 		if (ntags())
 			return (0);
+#endif
 		return (next_ifile(curr_ifile) != NULL_IFILE);
 	}
 	return (0);
@@ -237,9 +251,9 @@
 	POSITION pos;
 	POSITION len;
 	int n;
+	LINENUM linenum;
+	LINENUM last_linenum;
 	IFILE h;
-	char *s;
-	char *escs;
 
 	switch (c)
 	{
@@ -254,19 +268,19 @@
 		ap_int(hshift);
 		break;
 	case 'd':	/* Current page number */
-		n = currline(where);
-		if (n > 0 && sc_height > 1)
-			ap_int(((n - 1) / (sc_height - 1)) + 1);
+		linenum = currline(where);
+		if (linenum > 0 && sc_height > 1)
+			ap_linenum(((linenum - 1) / (sc_height - 1)) + 1);
 		else
 			ap_quest();
 		break;
 	case 'D':	/* Last page number */
 		len = ch_length();
 		if (len == NULL_POSITION || len == ch_zero() ||
-		    (n = find_linenum(len)) <= 0)
+		    (linenum = find_linenum(len)) <= 0)
 			ap_quest();
 		else
-			ap_int(((n - 1) / (sc_height - 1)) + 1);
+			ap_linenum(((linenum - 1) / (sc_height - 1)) + 1);
 		break;
 #if EDITOR
 	case 'E':	/* Editor name */
@@ -274,45 +288,38 @@
 		break;
 #endif
 	case 'f':	/* File name */
-		s = unquote_file(get_filename(curr_ifile));
-		/*
-		 * If we are expanding editproto then we escape metachars.
-		 * This allows us to run the editor on files with funny names.
-		 */
-		if (iseditproto && (escs = esc_metachars(s)) != NULL)
-		{
-			free(s);
-			s = escs;
-		}
-		ap_str(s);
-		free(s);
+		ap_str(get_filename(curr_ifile));
 		break;
 	case 'i':	/* Index into list of files */
+#if TAGS
 		if (ntags())
 			ap_int(curr_tag());
 		else
+#endif
 			ap_int(get_index(curr_ifile));
 		break;
 	case 'l':	/* Current line number */
-		n = currline(where);
-		if (n != 0)
-			ap_int(n);
+		linenum = currline(where);
+		if (linenum != 0)
+			ap_linenum(linenum);
 		else
 			ap_quest();
 		break;
 	case 'L':	/* Final line number */
 		len = ch_length();
 		if (len == NULL_POSITION || len == ch_zero() ||
-		    (n = find_linenum(len)) <= 0)
+		    (linenum = find_linenum(len)) <= 0)
 			ap_quest();
 		else
-			ap_int(n-1);
+			ap_linenum(linenum-1);
 		break;
 	case 'm':	/* Number of files */
+#if TAGS
 		n = ntags();
 		if (n)
 			ap_int(n);
 		else
+#endif
 			ap_int(nifile());
 		break;
 	case 'p':	/* Percent into file (bytes) */
@@ -324,13 +331,13 @@
 			ap_quest();
 		break;
 	case 'P':	/* Percent into file (lines) */
-		pos = (POSITION) currline(where);
-		if (pos == 0 ||
+		linenum = currline(where);
+		if (linenum == 0 ||
 		    (len = ch_length()) == NULL_POSITION || len == ch_zero() ||
-		    (n = find_linenum(len)) <= 0)
+		    (last_linenum = find_linenum(len)) <= 0)
 			ap_quest();
 		else
-			ap_int(percentage(pos, (POSITION)n));
+			ap_int(percentage(linenum, last_linenum));
 		break;
 	case 's':	/* Size of file */
 	case 'B':
@@ -345,19 +352,18 @@
 			mp--;
 		break;
 	case 'T':	/* Type of list */
+#if TAGS
 		if (ntags())
 			ap_str("tag");
 		else
+#endif
 			ap_str("file");
 		break;
 	case 'x':	/* Name of next file */
 		h = next_ifile(curr_ifile);
 		if (h != NULL_IFILE)
-		{
-			s = unquote_file(get_filename(h));
-			ap_str(s);
-			free(s);
-		} else
+			ap_str(get_filename(h));
+		else
 			ap_quest();
 		break;
 	}
Index: contrib/less/screen.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/screen.c,v
retrieving revision 1.3
diff -u -r1.3 screen.c
--- contrib/less/screen.c	7 Jan 2002 20:37:09 -0000	1.3
+++ contrib/less/screen.c	3 Jul 2003 19:21:21 -0000
@@ -1,6 +1,6 @@
 /* $FreeBSD: src/contrib/less/screen.c,v 1.3 2002/01/07 20:37:09 ps Exp $ */
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
@@ -226,12 +226,11 @@
 extern int no_back_scroll;
 extern int swindow;
 extern int no_init;
-extern int quit_at_eof;
-extern int more_mode;
 extern int no_keypad;
 extern int sigs;
 extern int wscroll;
 extern int screen_trashed;
+extern int tty;
 #if HILITE_SEARCH
 extern int hilite_search;
 #endif
@@ -270,7 +269,7 @@
 		/*
 		 * Get terminal modes.
 		 */
-		tcgetattr(2, &s);
+		tcgetattr(tty, &s);
 
 		/*
 		 * Save modes and set certain variables dependent on modes.
@@ -426,9 +425,9 @@
 		s = save_term;
 	}
 #if HAVE_FSYNC
-	fsync(2);
+	fsync(tty);
 #endif
-	tcsetattr(2, TCSADRAIN, &s);
+	tcsetattr(tty, TCSADRAIN, &s);
 #if MUST_SET_LINE_DISCIPLINE
 	if (!on)
 	{
@@ -438,7 +437,7 @@
 		 * is therefore not restored, yet.  Restore the old
 		 * line discipline by hand.
 		 */
-		ioctl(2, TIOCSETD, &save_term.c_line);
+		ioctl(tty, TIOCSETD, &save_term.c_line);
 	}
 #endif
     }
@@ -454,7 +453,7 @@
 		/*
 		 * Get terminal modes.
 		 */
-		ioctl(2, TCGETA, &s);
+		ioctl(tty, TCGETA, &s);
 
 		/*
 		 * Save modes and set certain variables dependent on modes.
@@ -490,7 +489,7 @@
 		 */
 		s = save_term;
 	}
-	ioctl(2, TCSETAW, &s);
+	ioctl(tty, TCSETAW, &s);
     }
 #else
 #ifdef TIOCGETP
@@ -504,7 +503,7 @@
 		/*
 		 * Get terminal modes.
 		 */
-		ioctl(2, TIOCGETP, &s);
+		ioctl(tty, TIOCGETP, &s);
 
 		/*
 		 * Save modes and set certain variables dependent on modes.
@@ -533,7 +532,7 @@
 		 */
 		s = save_term;
 	}
-	ioctl(2, TIOCSETN, &s);
+	ioctl(tty, TIOCSETN, &s);
     }
 #else
 #ifdef _OSK
@@ -547,7 +546,7 @@
 		/*
 		 * Get terminal modes.
 		 */
-		_gs_opt(2, &s);
+		_gs_opt(tty, &s);
 
 		/*
 		 * Save modes and set certain variables dependent on modes.
@@ -575,7 +574,7 @@
 		 */
 		s = save_term;
 	}
-	_ss_opt(2, &s);
+	_ss_opt(tty, &s);
     }
 #else
 	/* MS-DOS, Windows, or OS2 */
@@ -1184,19 +1183,11 @@
 	if (sc_e_keypad == NULL)
 		sc_e_keypad = "";
 		
-	/*
-	 * This loses for terminals with termcap entries with ti/te strings
-	 * that switch to/from an alternate screen, and we're in quit_at_eof
-	 * (eg, more(1)).
- 	 */
-	if (!quit_at_eof && !more_mode) {
-		sc_init = ltgetstr("ti", &sp);
-		sc_deinit = ltgetstr("te", &sp);
-	}
-
+	sc_init = ltgetstr("ti", &sp);
 	if (sc_init == NULL)
 		sc_init = "";
 
+	sc_deinit= ltgetstr("te", &sp);
 	if (sc_deinit == NULL)
 		sc_deinit = "";
 
Index: contrib/less/scrsize.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/scrsize.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 scrsize.c
--- contrib/less/scrsize.c	7 Jan 2002 20:29:19 -0000	1.1.1.1
+++ contrib/less/scrsize.c	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2001  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
Index: contrib/less/search.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/search.c,v
retrieving revision 1.4
diff -u -r1.4 search.c
--- contrib/less/search.c	7 Jan 2002 20:37:09 -0000	1.4
+++ contrib/less/search.c	3 Jul 2003 19:21:31 -0000
@@ -1,6 +1,6 @@
 /* $FreeBSD: src/contrib/less/search.c,v 1.4 2002/01/07 20:37:09 ps Exp $ */
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
@@ -23,7 +23,7 @@
 #if HAVE_POSIX_REGCOMP
 #include <regex.h>
 #ifdef REG_EXTENDED
-#define	REGCOMP_FLAG	(more_mode ? 0 : REG_EXTENDED)
+#define	REGCOMP_FLAG	REG_EXTENDED
 #else
 #define	REGCOMP_FLAG	0
 #endif
@@ -53,7 +53,7 @@
 extern int sc_height;
 extern int jump_sline;
 extern int bs_mode;
-extern int more_mode;
+extern int ctldisp;
 extern int status_col;
 extern POSITION start_attnpos;
 extern POSITION end_attnpos;
@@ -108,6 +108,7 @@
 #define	CVT_TO_LC	01	/* Convert upper-case to lower-case */
 #define	CVT_BS		02	/* Do backspace processing */
 #define	CVT_CRLF	04	/* Remove CR after LF */
+#define	CVT_ANSI	010	/* Remove ANSI escape sequences */
 
 	static void
 cvt_text(odst, osrc, ops)
@@ -118,17 +119,23 @@
 	register char *dst;
 	register char *src;
 
-	for (src = osrc, dst = odst;  *src != '\0';  src++, dst++)
+	for (src = osrc, dst = odst;  *src != '\0';  src++)
 	{
 		if ((ops & CVT_TO_LC) && isupper((unsigned char) *src))
 			/* Convert uppercase to lowercase. */
-			*dst = tolower((unsigned char) *src);
+			*dst++ = tolower((unsigned char) *src);
 		else if ((ops & CVT_BS) && *src == '\b' && dst > odst)
 			/* Delete BS and preceding char. */
-			dst -= 2;
-		else 
+			dst--;
+		else if ((ops & CVT_ANSI) && *src == ESC)
+		{
+			/* Skip to end of ANSI escape sequence. */
+			while (src[1] != '\0')
+				if (is_ansi_end(*++src))
+					break;
+		} else 
 			/* Just copy. */
-			*dst = *src;
+			*dst++ = *src;
 	}
 	if ((ops & CVT_CRLF) && dst > odst && dst[-1] == '\r')
 		dst--;
@@ -136,6 +143,30 @@
 }
 
 /*
+ * Determine which conversions to perform.
+ */
+	static int
+get_cvt_ops()
+{
+	int ops = 0;
+	if (is_caseless || bs_mode == BS_SPECIAL)
+	{
+		if (is_caseless) 
+			ops |= CVT_TO_LC;
+		if (bs_mode == BS_SPECIAL)
+			ops |= CVT_BS;
+		if (bs_mode != BS_CONTROL)
+			ops |= CVT_CRLF;
+	} else if (bs_mode != BS_CONTROL)
+	{
+		ops |= CVT_CRLF;
+	}
+	if (ctldisp == OPT_ONPLUS)
+		ops |= CVT_ANSI;
+	return (ops);
+}
+
+/*
  * Are there any uppercase letters in this string?
  */
 	static int
@@ -589,9 +620,10 @@
  * Adjust hl_startpos & hl_endpos to account for backspace processing.
  */
 	static void
-adj_hilite(anchor, linepos)
+adj_hilite(anchor, linepos, cvt_ops)
 	struct hilite *anchor;
 	POSITION linepos;
+	int cvt_ops;
 {
 	char *line;
 	struct hilite *hl;
@@ -633,18 +665,39 @@
 		}
 		if (*line == '\0')
 			break;
+		if (cvt_ops & CVT_ANSI)
+		{
+			while (line[0] == ESC)
+			{
+				/*
+				 * Found an ESC.  The file position moves
+				 * forward past the entire ANSI escape sequence.
+				 */
+				line++;
+				npos++;
+				while (*line != '\0')
+				{
+					npos++;
+					if (is_ansi_end(*line++))
+						break;
+				}
+			}
+		}
 		opos++;
 		npos++;
 		line++;
-		while (line[0] == '\b' && line[1] != '\0')
+		if (cvt_ops & CVT_BS)
 		{
-			/*
-			 * Found a backspace.  The file position moves
-			 * forward by 2 relative to the processed line
-			 * which was searched in hilite_line.
-			 */
-			npos += 2;
-			line += 2;
+			while (line[0] == '\b' && line[1] != '\0')
+			{
+				/*
+				 * Found a backspace.  The file position moves
+				 * forward by 2 relative to the processed line
+				 * which was searched in hilite_line.
+				 */
+				npos += 2;
+				line += 2;
+			}
 		}
 	}
 }
@@ -655,11 +708,12 @@
  * sp,ep delimit the first match already found.
  */
 	static void
-hilite_line(linepos, line, sp, ep)
+hilite_line(linepos, line, sp, ep, cvt_ops)
 	POSITION linepos;
 	char *line;
 	char *sp;
 	char *ep;
+	int cvt_ops;
 {
 	char *searchp;
 	struct hilite *hl;
@@ -708,15 +762,13 @@
 			break;
 	} while (match_pattern(searchp, &sp, &ep, 1));
 
-	if (bs_mode == BS_SPECIAL) 
-	{
-		/*
-		 * If there were backspaces in the original line, they
-		 * were removed, and hl_startpos/hl_endpos are not correct.
-		 * {{ This is very ugly. }}
-		 */
-		adj_hilite(&hilites, linepos);
-	}
+	/*
+	 * If there were backspaces in the original line, they
+	 * were removed, and hl_startpos/hl_endpos are not correct.
+	 * {{ This is very ugly. }}
+	 */
+	adj_hilite(&hilites, linepos, cvt_ops);
+
 	/*
 	 * Now put the hilites into the real list.
 	 */
@@ -873,9 +925,10 @@
 	POSITION *pendpos;
 {
 	char *line;
-	int linenum;
+	LINENUM linenum;
 	char *sp, *ep;
 	int line_match;
+	int cvt_ops;
 	POSITION linepos, oldpos;
 
 	linenum = find_linenum(pos);
@@ -955,20 +1008,8 @@
 		 * If it's a caseless search, convert the line to lowercase.
 		 * If we're doing backspace processing, delete backspaces.
 		 */
-		if (is_caseless || bs_mode == BS_SPECIAL)
-		{
-			int ops = 0;
-			if (is_caseless) 
-				ops |= CVT_TO_LC;
-			if (bs_mode == BS_SPECIAL)
-				ops |= CVT_BS;
-			if (bs_mode != BS_CONTROL)
-				ops |= CVT_CRLF;
-			cvt_text(line, line, ops);
-		} else if (bs_mode != BS_CONTROL)
-		{
-			cvt_text(line, line, CVT_CRLF);
-		}
+		cvt_ops = get_cvt_ops();
+		cvt_text(line, line, cvt_ops);
 
 		/*
 		 * Test the next line to see if we have a match.
@@ -992,7 +1033,7 @@
 			 * hilite list and keep searching.
 			 */
 			if (line_match)
-				hilite_line(linepos, line, sp, ep);
+				hilite_line(linepos, line, sp, ep, cvt_ops);
 #endif
 		} else if (--matches <= 0)
 		{
@@ -1009,7 +1050,7 @@
 				 */
 				clr_hilite();
 				if (line_match)
-					hilite_line(linepos, line, sp, ep);
+					hilite_line(linepos, line, sp, ep, cvt_ops);
 			}
 #endif
 			if (plinepos != NULL)
Index: contrib/less/signal.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/signal.c,v
retrieving revision 1.2
diff -u -r1.2 signal.c
--- contrib/less/signal.c	14 Jul 2000 09:13:35 -0000	1.2
+++ contrib/less/signal.c	3 Jul 2003 19:21:48 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
@@ -34,7 +34,6 @@
 extern int linenums;
 extern int wscroll;
 extern int reading;
-extern int more_mode;
 
 /*
  * Interrupt signal handler.
@@ -58,8 +57,6 @@
 	if (kbhit())
 		getkey();
 #endif
-	if (more_mode)
-		quit(0);
 	if (reading)
 		intread();
 }
Index: contrib/less/tags.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/tags.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 tags.c
--- contrib/less/tags.c	7 Jan 2002 20:29:01 -0000	1.1.1.2
+++ contrib/less/tags.c	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
@@ -68,7 +68,7 @@
 struct tag {
 	struct tag *next, *prev; /* List links */
 	char *tag_file;		/* Source file containing the tag */
-	int tag_linenum;	/* Appropriate line number in source file */
+	LINENUM tag_linenum;	/* Appropriate line number in source file */
 	char *tag_pattern;	/* Pattern used to find the tag */
 	char tag_endline;	/* True if the pattern includes '$' */
 };
@@ -113,7 +113,7 @@
 maketagent(name, file, linenum, pattern, endline)
 	char *name;
 	char *file;
-	int linenum;
+	LINENUM linenum;
 	char *pattern;
 	int endline;
 {
@@ -217,7 +217,7 @@
 nexttag(n)
 	int n;
 {
-	char *tagfile;
+	char *tagfile = (char *) NULL;
 
 	while (n-- > 0)
 		tagfile = nextgtag();
@@ -231,7 +231,7 @@
 prevtag(n)
 	int n;
 {
-	char *tagfile;
+	char *tagfile = (char *) NULL;
 
 	while (n-- > 0)
 		tagfile = prevgtag();
@@ -271,7 +271,7 @@
 	char *p;
 	register FILE *f;
 	register int taglen;
-	register int taglinenum;
+	LINENUM taglinenum;
 	char *tagfile;
 	char *tagpattern;
 	int tagendline;
@@ -280,7 +280,7 @@
 	char tline[TAGLINE_SIZE];
 	struct tag *tp;
 
-	p = unquote_file(tags);
+	p = shell_unquote(tags);
 	f = fopen(p, "r");
 	free(p);
 	if (f == NULL)
@@ -335,6 +335,7 @@
 		/*
 		 * First see if it is a line number. 
 		 */
+		tagendline = 0;
 		taglinenum = getnum(&p, 0, &err);
 		if (err)
 		{
@@ -396,7 +397,7 @@
 ctagsearch()
 {
 	POSITION pos, linepos;
-	int linenum;
+	LINENUM linenum;
 	int len;
 	char *line;
 
@@ -499,6 +500,7 @@
 #else
 		char command[512];
 		char *flag;
+		char *qtag;
 		char *cmd = lgetenv("LESSGLOBALTAGS");
 
 		if (cmd == NULL || *cmd == '\0')
@@ -523,9 +525,12 @@
 		}
 
 		/* Get our data from global(1). */
-		tag = esc_metachars(tag);
-		sprintf(command, "%s -x%s %s", cmd, flag, tag);
-		free(tag);
+		qtag = shell_quote(tag);
+		if (qtag == NULL)
+			qtag = tag;
+		sprintf(command, "%s -x%s %s", cmd, flag, qtag);
+		if (qtag != tag)
+			free(qtag);
 		fp = popen(command, "r");
 #endif
 	}
@@ -563,7 +568,7 @@
 			}
 
 			/* Make new entry and add to list. */
-			tp = maketagent(name, file, atoi(line), NULL, 0);
+			tp = maketagent(name, file, (LINENUM) atoi(line), NULL, 0);
 			TAG_INS(tp);
 			total++;
 		}
Index: contrib/less/ttyin.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/ttyin.c,v
retrieving revision 1.1.1.2
diff -u -r1.1.1.2 ttyin.c
--- contrib/less/ttyin.c	7 Jan 2002 20:29:01 -0000	1.1.1.2
+++ contrib/less/ttyin.c	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
@@ -24,7 +24,7 @@
 static DWORD console_mode;
 #endif
 
-static int tty;
+public int tty;
 extern int sigs;
 
 /*
Index: contrib/less/version.c
===================================================================
RCS file: /usr/local/bsdcvs/src/contrib/less/version.c,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 version.c
--- contrib/less/version.c	7 Jan 2002 20:29:04 -0000	1.1.1.3
+++ contrib/less/version.c	3 Jul 2003 19:03:04 -0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1984-2000  Mark Nudelman
+ * Copyright (C) 1984-2002  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.
@@ -624,7 +624,26 @@
 -----------------------------------------------------------------
 v371 12/26/01	Fix new_file bug; use popen in Windows version;
 		fix some compiler warnings.
-
+v372 12/29/01	Make -b be in units of 1K.
+v373  1/14/02	Improve handling of filenames containing shell metachars.
+v374   2/7/02	Fix memory leak; fix bug in -x argument parsing.
+v375   4/7/02	Fix searching for SGR sequences; fix SECURE build;
+		add SGR support to DJGPP version (thanks to Eli Zaretskii).
+v376  6/10/02	Fix bug in overstriking mulitbyte UTF-8 characters
+		(thanks to Jungshik Shin).
+		Posted to Web page.
+-----------------------------------------------------------------
+v377  9/10/02	Fix bug in Windows version when file contains CR;
+		fix bug in search highlights with -R;
+		make initial buffer limit really be 64K not unlimited.
+v378  9/30/02	Misc bug fixes and compiler warning cleanup.
+		Posted to Web page.
+-----------------------------------------------------------------
+v379 11/23/02	Add -L option; fix bug with ctrl-K in lesskey files;
+		improve UTF-8 overstriking and underscore overstriking;
+		fix minor man page problems; change to autoconf 2.54.
+v380 11/24/02	Make LINENUM same as POSITION.
+v381 11/28/02	Make -N use 7 columns for line number if possible.
 */
 
-char version[] = "371";
+char version[] = "381";
Index: usr.bin/less/defines.h
===================================================================
RCS file: /usr/local/bsdcvs/src/usr.bin/less/defines.h,v
retrieving revision 1.3
diff -u -r1.3 defines.h
--- usr.bin/less/defines.h	7 Jan 2002 20:37:33 -0000	1.3
+++ usr.bin/less/defines.h	3 Jul 2003 19:08:47 -0000
@@ -1,6 +1,8 @@
 /* $FreeBSD: src/usr.bin/less/defines.h,v 1.3 2002/01/07 20:37:33 ps Exp $ */
-/* defines.h.  Generated automatically by configure.  */
-/* defines.h.in.  Generated automatically from configure.in by autoheader.  */
+/* defines.h.  Generated by configure.  */
+/* defines.h.in.  Generated from configure.ac by autoheader.  */
+
+
 /* Unix definition file for less.  -*- C -*-
  *
  * This file has 3 sections:
@@ -12,7 +14,7 @@
  * If you edit defines.h by hand, do "touch stamp-h" before you run make
  * so config.status doesn't overwrite your changes.
  */
-
+
 /* User preferences.  */
 
 /*
@@ -45,7 +47,7 @@
 #define	CMD_HISTORY	1
 
 /*
- * HILITE_SEARCH is 1 if you wish to have search targets to be 
+ * HILITE_SEARCH is 1 if you wish to have search targets to be
  * displayed in standout mode.
  */
 #define	HILITE_SEARCH	1
@@ -63,7 +65,7 @@
 #define	TAGS		(!SECURE)
 
 /*
- * USERFILE is 1 if you wish to allow a .less file to specify 
+ * USERFILE is 1 if you wish to allow a .less file to specify
  * user-defined key bindings.
  */
 #define	USERFILE	(!SECURE)
@@ -100,17 +102,17 @@
 #define	ONLY_RETURN	0
 
 /*
- * LESSKEYFILE is the filename of the default lesskey output file 
+ * LESSKEYFILE is the filename of the default lesskey output file
  * (in the HOME directory).
  * LESSKEYFILE_SYS is the filename of the system-wide lesskey output file.
- * DEF_LESSKEYINFILE is the filename of the default lesskey input 
+ * DEF_LESSKEYINFILE is the filename of the default lesskey input
  * (in the HOME directory).
  */
 #define	LESSKEYFILE		".less"
 #define	LESSKEYFILE_SYS		"/etc/lesskey"
 #define	DEF_LESSKEYINFILE	".lesskey"
 
-
+
 /* Settings always true on Unix.  */
 
 /*
@@ -126,7 +128,7 @@
 /*
  * HAVE_SYS_TYPES_H is 1 if your system has <sys/types.h>.
  */
-#define HAVE_SYS_TYPES_H	1
+#define HAVE_SYS_TYPES_H 1
 
 /*
  * Define if you have the <sgstat.h> header file.
@@ -152,10 +154,10 @@
 /*
  * Default shell metacharacters and meta-escape character.
  */
-#define	DEF_METACHARS	"; \t\n'\"()<>|&^`\\"
+#define	DEF_METACHARS	"; *?\t\n'\"()<>|&^`#\\"
 #define	DEF_METAESCAPE	"\\"
 
-/* 
+/*
  * HAVE_DUP is 1 if your system has the dup() call.
  */
 #define	HAVE_DUP	1
@@ -172,170 +174,174 @@
 #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 */
-
-/* Settings automatically determined by configure.  */
 
-/* Define to `long' if <sys/types.h> doesn't define.  */
-/* #undef off_t */
-
-/* Define if you need to in order for stat and other things to work.  */
-/* #undef _POSIX_SOURCE */
-
-/* Define as the return type of signal handlers (int or void).  */
-#define RETSIGTYPE void
-
-/* Define if you have the ANSI C header files.  */
-#define STDC_HEADERS 1
+/* Settings automatically determined by configure.  */
 
-/*
- * Regular expression library.
- * Define exactly one of the following to be 1:
- * HAVE_POSIX_REGCOMP: POSIX regcomp() and regex.h
- * HAVE_PCRE: PCRE (Perl-compatible regular expression) library
- * HAVE_RE_COMP: BSD re_comp()
- * HAVE_REGCMP: System V regcmp()
- * HAVE_V8_REGCOMP: Henry Spencer V8 regcomp() and regexp.h
- * NO_REGEX: pattern matching is supported, but without metacharacters.
- */
-#define HAVE_POSIX_REGCOMP 1
-/* #undef HAVE_PCRE */
-/* #undef HAVE_RE_COMP */
-/* #undef HAVE_REGCMP */
-/* #undef HAVE_V8_REGCOMP */
-/* #undef NO_REGEX */
-/* #undef HAVE_REGEXEC2 */
 
-/* Define HAVE_VOID if your compiler supports the "void" type. */
-#define HAVE_VOID 1
+/* Define EDIT_PGM to your editor. */
+#define EDIT_PGM "vi"
 
 /* Define HAVE_CONST if your compiler supports the "const" modifier. */
 #define HAVE_CONST 1
 
-/* Define HAVE_TIME_T if your system supports the "time_t" type. */
-#define HAVE_TIME_T 1
+/* Define to 1 if you have the <ctype.h> header file. */
+#define HAVE_CTYPE_H 1
 
-/* Define HAVE_STRERROR if you have the strerror() function. */
-#define HAVE_STRERROR 1
+/* Define HAVE_ERRNO if you have the errno variable. */
+#define HAVE_ERRNO 1
+
+/* Define to 1 if you have the <errno.h> header file. */
+#define HAVE_ERRNO_H 1
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#define HAVE_FCNTL_H 1
 
 /* Define HAVE_FILENO if you have the fileno() macro. */
 #define HAVE_FILENO 1
 
-/* Define HAVE_ERRNO if you have the errno variable */
-/* Define MUST_DEFINE_ERRNO if you have errno but it is not define 
- * in errno.h */
-#define HAVE_ERRNO 1
-/* #undef MUST_DEFINE_ERRNO */
+/* Define to 1 if you have the `fsync' function. */
+#define HAVE_FSYNC 1
 
-/* Define HAVE_SYS_ERRLIST if you have the sys_errlist[] variable */
-#define HAVE_SYS_ERRLIST 1
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
 
-/* Define HAVE_OSPEED if your termcap library has the ospeed variable */
-/* Define MUST_DEFINE_OSPEED if you have ospeed but it is not defined
- * in termcap.h. */
-#define HAVE_OSPEED 1
-/* #undef MUST_DEFINE_OSPEED */
+/* Define to 1 if you have the <limits.h> header file. */
+#define HAVE_LIMITS_H 1
 
 /* Define HAVE_LOCALE if you have locale.h and setlocale. */
 #define HAVE_LOCALE 1
 
-/* Define HAVE_TERMIOS_FUNCS if you have tcgetattr/tcsetattr */
-#define HAVE_TERMIOS_FUNCS 1
-
-/* Define HAVE_UPPER_LOWER if you have isupper, islower, toupper, tolower */
-#define HAVE_UPPER_LOWER 1
-
-/* Define HAVE_SIGSET_T you have the sigset_t type */
-/* #undef HAVE_SIGSET_T */
-
-/* Define HAVE_SIGEMPTYSET if you have the sigemptyset macro */
-#define HAVE_SIGEMPTYSET 1
+/* Define to 1 if you have the `memcpy' function. */
+#define HAVE_MEMCPY 1
 
-/* Define EDIT_PGM to your editor. */
-#define EDIT_PGM "vi"
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
 
-/* Define if you have the _setjmp function.  */
-#define HAVE__SETJMP 1
+/* Define HAVE_OSPEED if your termcap library has the ospeed variable. */
+#define HAVE_OSPEED 1
 
-/* Define if you have the fsync function.  */
-#define HAVE_FSYNC 1
+/* Define to 1 if you have the `popen' function. */
+#define HAVE_POPEN 1
 
-/* Define if you have the memcpy function.  */
-#define HAVE_MEMCPY 1
+/* POSIX regcomp() and regex.h */
+#define HAVE_POSIX_REGCOMP 1
 
-/* Define if you have the popen function.  */
-#define HAVE_POPEN 1
+/* Define HAVE_SIGEMPTYSET if you have the sigemptyset macro. */
+#define HAVE_SIGEMPTYSET 1
 
-/* Define if you have the sigprocmask function.  */
+/* Define to 1 if you have the `sigprocmask' function. */
 #define HAVE_SIGPROCMASK 1
 
-/* Define if you have the sigsetmask function.  */
+/* Define to 1 if you have the `sigsetmask' function. */
 #define HAVE_SIGSETMASK 1
 
-/* Define if you have the stat function.  */
+/* Define to 1 if you have the `stat' function. */
 #define HAVE_STAT 1
 
-/* Define if you have the strchr function.  */
-#define HAVE_STRCHR 1
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
 
-/* Define if you have the strstr function.  */
-#define HAVE_STRSTR 1
+/* Define to 1 if you have the <stdio.h> header file. */
+#define HAVE_STDIO_H 1
 
-/* Define if you have the system function.  */
-#define HAVE_SYSTEM 1
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
 
-/* Define if you have the <ctype.h> header file.  */
-#define HAVE_CTYPE_H 1
+/* Define to 1 if you have the `strchr' function. */
+#define HAVE_STRCHR 1
 
-/* Define if you have the <errno.h> header file.  */
-#define HAVE_ERRNO_H 1
+/* Define HAVE_STRERROR if you have the strerror() function. */
+#define HAVE_STRERROR 1
 
-/* Define if you have the <fcntl.h> header file.  */
-#define HAVE_FCNTL_H 1
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
 
-/* Define if you have the <limits.h> header file.  */
-#define HAVE_LIMITS_H 1
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
 
-/* Define if you have the <stdio.h> header file.  */
-#define HAVE_STDIO_H 1
+/* Define to 1 if you have the `strstr' function. */
+#define HAVE_STRSTR 1
 
-/* Define if you have the <stdlib.h> header file.  */
-#define HAVE_STDLIB_H 1
+/* Define to 1 if you have the `system' function. */
+#define HAVE_SYSTEM 1
 
-/* Define if you have the <string.h> header file.  */
-#define HAVE_STRING_H 1
+/* Define HAVE_SYS_ERRLIST if you have the sys_errlist[] variable. */
+#define HAVE_SYS_ERRLIST 1
 
-/* Define if you have the <sys/ioctl.h> header file.  */
+/* Define to 1 if you have the <sys/ioctl.h> header file. */
 #define HAVE_SYS_IOCTL_H 1
 
-/* Define if you have the <sys/ptem.h> header file.  */
-/* #undef HAVE_SYS_PTEM_H */
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
 
-/* Define if you have the <sys/stream.h> header file.  */
-/* #undef HAVE_SYS_STREAM_H */
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
 
-/* Define if you have the <termcap.h> header file.  */
+/* Define to 1 if you have the <termcap.h> header file. */
 #define HAVE_TERMCAP_H 1
 
-/* Define if you have the <termio.h> header file.  */
-/* #undef HAVE_TERMIO_H */
+/* Define HAVE_TERMIOS_FUNCS if you have tcgetattr/tcsetattr. */
+#define HAVE_TERMIOS_FUNCS 1
 
-/* Define if you have the <termios.h> header file.  */
+/* Define to 1 if you have the <termios.h> header file. */
 #define HAVE_TERMIOS_H 1
 
-/* Define if you have the <time.h> header file.  */
+/* Define to 1 if you have the <time.h> header file. */
 #define HAVE_TIME_H 1
 
-/* Define if you have the <unistd.h> header file.  */
+/* Define HAVE_TIME_T if your system supports the "time_t" type. */
+#define HAVE_TIME_T 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
 #define HAVE_UNISTD_H 1
 
-/* Define if you have the <values.h> header file.  */
-/* #undef HAVE_VALUES_H */
+/* Define HAVE_UPPER_LOWER if you have isupper, islower, toupper, tolower. */
+#define HAVE_UPPER_LOWER 1
+
+/* Define to 1 if you have the <values.h> header file. */
+#define HAVE_VALUES_H 1
+
+/* Define HAVE_VOID if your compiler supports the "void" type. */
+#define HAVE_VOID 1
+
+/* Define to 1 if you have the `_setjmp' function. */
+#define HAVE__SETJMP 1
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT ""
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "less"
 
-/* Define if you have the PW library (-lPW).  */
-/* #undef HAVE_LIBPW */
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "less 1"
 
-/* Define if you have the gen library (-lgen).  */
-/* #undef HAVE_LIBGEN */
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "less"
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "1"
+
+/* Define as the return type of signal handlers (`int' or `void'). */
+#define RETSIGTYPE void
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
+#define TIME_WITH_SYS_TIME 1
+
+/* Number of bits in a file offset, on hosts where this is settable. */
+/* #undef _FILE_OFFSET_BITS */
+
+/* Define for large files, on AIX-style hosts. */
+/* #undef _LARGE_FILES */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+/* Define to `long' if <sys/types.h> does not define. */
+/* #undef off_t */
 
-/* Define if you have the intl library (-lintl).  */
-/* #undef HAVE_LIBINTL */
+/* Define to `unsigned' if <sys/types.h> does not define. */
+/* #undef size_t */
--- less.diff ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list