------------
Less
-Copyright (C) 1984-2011 Mark Nudelman
+Copyright (C) 1984-2012 Mark Nudelman
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
# Makefile for authoring less.
-EMAIL = markn@greenwoodsoftware.com
+EMAIL = bug-less@gnu.org
HOMEPAGE = http://www.greenwoodsoftware.com/less
SHELL = /bin/sh
RCS = rcs
echo "Preparing $$REL"; \
rm -rf $$REL; mkdir $$REL; \
for file in ${DISTFILES}; do \
- cp -p $$file $$REL; \
- chmod -w $$REL/$$file; \
+ ./add_copyright $$file $$REL; \
done; \
cd $$REL; chmod +w ${DISTFILES_W}; cd ..; \
echo "Creating release/$$REL/$$REL.tar.gz"; \
/*
- * Copyright (C) 2005-2011 Mark Nudelman
+ * Copyright (C) 1984-2012 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
*
- * For more information about less, or for information on how to
- * contact the author, see the README file.
+ * For more information, see the README file.
*/
#define IS_ASCII_OCTET(c) (((c) & 0x80) == 0)
AC_CHECK_LIB(curses, initscr, [have_curses=yes], [have_curses=no])
AC_CHECK_LIB(termcap, tgetent, [have_termcap=yes], [have_termcap=no])
AC_CHECK_LIB(termlib, tgetent, [have_termlib=yes], [have_termlib=no])
-# Regular expressions (regcmp) are in -lgen on Solaris 2,
-# and in -lintl on SCO Unix.
-AC_CHECK_LIB(gen, regcmp)
-AC_CHECK_LIB(intl, regcmp)
-AC_CHECK_LIB(PW, regcmp)
+# Regular expressions (regcmp) are in -lgen on Solaris 2, (but in libc
+# at least on Solaris 10 (2.10)) and in -lintl on SCO Unix.
+AC_SEARCH_LIBS([regcmp], [gen intl PW])
# Checks for terminal libraries
AC_MSG_CHECKING([for working terminal libraries])
AC_HEADER_TIME
# Autoheader templates for symbols defined later by AC_DEFINE.
+AH_TEMPLATE([HAVE_GNU_REGEX],
+ [GNU regex library])
AH_TEMPLATE([HAVE_POSIX_REGCOMP],
[POSIX regcomp() and regex.h])
AH_TEMPLATE([HAVE_PCRE],
# Checks for regular expression functions.
have_regex=no
have_posix_regex=unknown
-AC_MSG_CHECKING(for regcomp)
+supported_regex=""
# Select a regular expression library.
WANT_REGEX=auto
AC_ARG_WITH(regex,
- [ --with-regex={auto,pcre,posix,regcmp,re_comp,regcomp,regcomp-local} Select a regular expression library [auto]],
+ [ --with-regex={auto,gnu,pcre,posix,regcmp,re_comp,regcomp,regcomp-local,none} Select a regular expression library [auto]],
WANT_REGEX="$withval")
if test $have_regex = no; then
if test $WANT_REGEX = auto -o $WANT_REGEX = posix; then
# Some versions of Solaris have a regcomp() function, but it doesn't work!
# So we run a test program. If we're cross-compiling, do it the old way.
+AC_MSG_CHECKING(for POSIX regcomp)
AC_TRY_RUN([
#include <sys/types.h>
#include <regex.h>
exit(0); }],
have_posix_regex=yes, have_posix_regex=no, have_posix_regex=unknown)
if test $have_posix_regex = yes; then
- AC_MSG_RESULT(using POSIX regcomp)
- AC_DEFINE(HAVE_POSIX_REGCOMP)
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_POSIX_REGCOMP) supported_regex="$supported_regex posix"
have_regex=yes
elif test $have_posix_regex = unknown; then
AC_TRY_LINK([
#include <sys/types.h>
#include <regex.h>],
[regex_t *r; regfree(r);],
- AC_MSG_RESULT(using POSIX regcomp)
- AC_DEFINE(HAVE_POSIX_REGCOMP) have_regex=yes)
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_POSIX_REGCOMP) have_regex=yes; supported_regex="$supported_regex posix")
else
AC_MSG_RESULT(no)
fi
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], [])
+[AC_DEFINE(HAVE_PCRE) LIBS="$LIBS -lpcre" have_regex=yes; supported_regex="$supported_regex pcre"], [])
+fi
+fi
+
+if test $have_regex = no; then
+if test $WANT_REGEX = auto -o $WANT_REGEX = gnu; then
+AC_CHECK_LIB(c, re_compile_pattern,
+[AC_DEFINE(HAVE_GNU_REGEX) have_regex=yes; supported_regex="$supported_regex gnu"], [])
fi
fi
if test $have_regex = no; then
if test $WANT_REGEX = auto -o $WANT_REGEX = regcmp; then
AC_CHECK_FUNC(regcmp,
-AC_MSG_RESULT(using regcmp); AC_DEFINE(HAVE_REGCMP) have_regex=yes)
+[AC_DEFINE(HAVE_REGCMP) have_regex=yes; supported_regex="$supported_regex regcmp"],[])
fi
fi
if test $have_regex = no; then
if test $WANT_REGEX = auto -o $WANT_REGEX = regcomp; then
+AC_MSG_CHECKING(for V8 regcomp)
AC_TRY_LINK([
#include "regexp.h"], [regcomp("");],
-AC_MSG_RESULT(using V8 regcomp); AC_DEFINE(HAVE_V8_REGCOMP) have_regex=yes)
+[AC_MSG_RESULT(yes); AC_DEFINE(HAVE_V8_REGCOMP) have_regex=yes; supported_regex="$supported_regex regcomp"],[AC_MSG_RESULT(no)])
fi
fi
if test $have_regex = no && test -f ${srcdir}/regexp.c; then
if test $WANT_REGEX = auto -o $WANT_REGEX = regcomp-local; then
-AC_MSG_RESULT(using V8 regcomp -- local source); AC_DEFINE(HAVE_V8_REGCOMP) AC_DEFINE(HAVE_REGEXEC2) REGEX_O='regexp.$(O)' AC_SUBST(REGEX_O) have_regex=yes
+AC_MSG_RESULT(using V8 regcomp -- local source); AC_DEFINE(HAVE_V8_REGCOMP)
+supported_regex="$supported_regex regcomp-local"
+AC_DEFINE(HAVE_REGEXEC2) REGEX_O='regexp.$(O)' AC_SUBST(REGEX_O) have_regex=yes
fi
fi
if test $have_regex = no; then
if test $WANT_REGEX = auto -o $WANT_REGEX = re_comp; then
-AC_MSG_RESULT(using re_comp); AC_CHECK_FUNC(re_comp, AC_DEFINE(HAVE_RE_COMP) have_regex=yes)
+AC_MSG_CHECKING(for re_comp)
+AC_CHECK_FUNC(re_comp,
+[AC_DEFINE(HAVE_RE_COMP) have_regex=yes; supported_regex="$supported_regex re_comp"],[])
fi
fi
if test $have_regex = no; then
-AC_MSG_RESULT(cannot find regular expression library); AC_DEFINE(NO_REGEX)
+if test $WANT_REGEX = auto -o $WANT_REGEX = none; then
+AC_MSG_RESULT(using no regex)
+else
+AC_MSG_WARN(cannot find regular expression library)
+fi
+AC_DEFINE(NO_REGEX) supported_regex="$supported_regex none"
fi
+AC_MSG_RESULT(regular expression library: $supported_regex)
+
AC_ARG_WITH(editor,
[ --with-editor=PROGRAM use PROGRAM as the default editor [vi]],
AC_DEFINE_UNQUOTED(EDIT_PGM, "$withval"), AC_DEFINE(EDIT_PGM, "vi"))
/*
* Sizes of various buffers.
*/
+#if 0 /* old sizes for small memory machines */
#define CMDBUF_SIZE 512 /* Buffer for multichar commands */
#define UNGOT_SIZE 100 /* Max chars to unget() */
#define LINEBUF_SIZE 1024 /* Max size of line in input file */
#define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */
#define TAGLINE_SIZE 512 /* Max size of line in tags file */
#define TABSTOP_MAX 32 /* Max number of custom tab stops */
+#else /* more reasonable sizes for modern machines */
+#define CMDBUF_SIZE 2048 /* Buffer for multichar commands */
+#define UNGOT_SIZE 200 /* Max chars to unget() */
+#define LINEBUF_SIZE 1024 /* Initial max size of line in input file */
+#define OUTBUF_SIZE 1024 /* Output buffer */
+#define PROMPT_SIZE 2048 /* Max size of prompt string */
+#define TERMBUF_SIZE 2048 /* Termcap buffer for tgetent */
+#define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */
+#define TAGLINE_SIZE 1024 /* Max size of line in tags file */
+#define TABSTOP_MAX 128 /* Max number of custom tab stops */
+#endif
/* Settings automatically determined by configure. */
])
/*
- * Copyright (C) 1984-2011 Mark Nudelman
+ * Copyright (C) 1984-2012 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
*
- * For more information about less, or for information on how to
- * contact the author, see the README file.
+ * For more information, see the README file.
*/
/*
* Sizes of various buffers.
*/
+#if 0 /* old sizes for small memory machines
#define CMDBUF_SIZE 512 /* Buffer for multichar commands */
#define UNGOT_SIZE 100 /* Max chars to unget() */
#define LINEBUF_SIZE 1024 /* Max size of line in input file */
#define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */
#define TAGLINE_SIZE 512 /* Max size of line in tags file */
#define TABSTOP_MAX 32 /* Max number of custom tab stops */
+#else /* more reasonable sizes for modern machines */
+#define CMDBUF_SIZE 2048 /* Buffer for multichar commands */
+#define UNGOT_SIZE 200 /* Max chars to unget() */
+#define LINEBUF_SIZE 1024 /* Initial max size of line in input file */
+#define OUTBUF_SIZE 1024 /* Output buffer */
+#define PROMPT_SIZE 2048 /* Max size of prompt string */
+#define TERMBUF_SIZE 2048 /* Termcap buffer for tgetent */
+#define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */
+#define TAGLINE_SIZE 1024 /* Max size of line in tags file */
+#define TABSTOP_MAX 128 /* Max number of custom tab stops */
+#endif
/* Define to `long' if <sys/types.h> doesn't define. */
#if MSDOS_COMPILER==BORLANDC
/* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
+/* Define HAVE_FLOAT if your compiler supports the "double" type. */
+#define HAVE_FLOAT 1
+
/* Define if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/*
- * Copyright (C) 1984-2011 Mark Nudelman
+ * Copyright (C) 1984-2012 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
*
- * For more information about less, or for information on how to
- * contact the author, see the README file.
+ * For more information, see the README file.
*/
/*
* Sizes of various buffers.
*/
+#if 0 /* old sizes for small memory machines
#define CMDBUF_SIZE 512 /* Buffer for multichar commands */
#define UNGOT_SIZE 100 /* Max chars to unget() */
#define LINEBUF_SIZE 1024 /* Max size of line in input file */
#define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */
#define TAGLINE_SIZE 512 /* Max size of line in tags file */
#define TABSTOP_MAX 32 /* Max number of custom tab stops */
+#else /* more reasonable sizes for modern machines */
+#define CMDBUF_SIZE 2048 /* Buffer for multichar commands */
+#define UNGOT_SIZE 200 /* Max chars to unget() */
+#define LINEBUF_SIZE 1024 /* Initial max size of line in input file */
+#define OUTBUF_SIZE 1024 /* Output buffer */
+#define PROMPT_SIZE 2048 /* Max size of prompt string */
+#define TERMBUF_SIZE 2048 /* Termcap buffer for tgetent */
+#define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */
+#define TAGLINE_SIZE 1024 /* Max size of line in tags file */
+#define TABSTOP_MAX 128 /* Max number of custom tab stops */
+#endif
/* Define to `long' if <sys/types.h> doesn't define. */
/* #define off_t long */
/*
- * Copyright (C) 1984-2011 Mark Nudelman
+ * Copyright (C) 1984-2012 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
*
- * For more information about less, or for information on how to
- * contact the author, see the README file.
+ * For more information, see the README file.
*/
/*
* Sizes of various buffers.
*/
+#if 0 /* old sizes for small memory machines
#define CMDBUF_SIZE 512 /* Buffer for multichar commands */
#define UNGOT_SIZE 100 /* Max chars to unget() */
#define LINEBUF_SIZE 1024 /* Max size of line in input file */
#define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */
#define TAGLINE_SIZE 512 /* Max size of line in tags file */
#define TABSTOP_MAX 32 /* Max number of custom tab stops */
+#else /* more reasonable sizes for modern machines */
+#define CMDBUF_SIZE 2048 /* Buffer for multichar commands */
+#define UNGOT_SIZE 200 /* Max chars to unget() */
+#define LINEBUF_SIZE 1024 /* Initial max size of line in input file */
+#define OUTBUF_SIZE 1024 /* Output buffer */
+#define PROMPT_SIZE 2048 /* Max size of prompt string */
+#define TERMBUF_SIZE 2048 /* Termcap buffer for tgetent */
+#define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */
+#define TAGLINE_SIZE 1024 /* Max size of line in tags file */
+#define TABSTOP_MAX 128 /* Max number of custom tab stops */
+#endif
/* Define to `long' if <sys/types.h> doesn't define. */
#define off_t long
/*
- * Copyright (C) 1984-2011 Mark Nudelman
+ * Copyright (C) 1984-2012 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
*
- * For more information about less, or for information on how to
- * contact the author, see the README file.
+ * For more information, see the README file.
*/
/*
* Sizes of various buffers.
*/
+#if 0 /* old sizes for small memory machines
#define CMDBUF_SIZE 512 /* Buffer for multichar commands */
#define UNGOT_SIZE 100 /* Max chars to unget() */
#define LINEBUF_SIZE 1024 /* Max size of line in input file */
#define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */
#define TAGLINE_SIZE 512 /* Max size of line in tags file */
#define TABSTOP_MAX 32 /* Max number of custom tab stops */
+#else /* more reasonable sizes for modern machines */
+#define CMDBUF_SIZE 2048 /* Buffer for multichar commands */
+#define UNGOT_SIZE 200 /* Max chars to unget() */
+#define LINEBUF_SIZE 1024 /* Initial max size of line in input file */
+#define OUTBUF_SIZE 1024 /* Output buffer */
+#define PROMPT_SIZE 2048 /* Max size of prompt string */
+#define TERMBUF_SIZE 2048 /* Termcap buffer for tgetent */
+#define TERMSBUF_SIZE 1024 /* Buffer to hold termcap strings */
+#define TAGLINE_SIZE 1024 /* Max size of line in tags file */
+#define TABSTOP_MAX 128 /* Max number of custom tab stops */
+#endif
/* Define to `long' if <sys/types.h> doesn't define. */
/* #define off_t long */
\e[1mDESCRIPTION\e[0m
\e[4mlessecho\e[24m is a program that simply echos its arguments on standard out-
- put. But any argument containing spaces is enclosed in quotes.
+ put. But any metacharacter in the output is preceded by an "escape"
+ character, which by default is a backslash.
\e[1mOPTIONS\e[0m
A summary of options is included below.
- \e[1m-ox \e[22mSpecifies "x" to be the open quote character.
+ \e[1m-ex \e[22mSpecifies "x", rather than backslash, to be the escape char for
+ metachars. If x is "-", no escape char is used and arguments
+ containing metachars are surrounded by quotes instead.
+
+ \e[1m-ox \e[22mSpecifies "x", rather than double-quote, to be the open quote
+ character, which is used if the -e- option is specified.
\e[1m-cx \e[22mSpecifies "x" to be the close quote character.
\e[1m-dn \e[22mSpecifies "n" to be the close quote character, as an integer.
- \e[1m-mx \e[22mSpecifies "x" to be a metachar.
+ \e[1m-mx \e[22mSpecifies "x" to be a metachar. By default, no characters are
+ considered metachars.
\e[1m-nn \e[22mSpecifies "n" to be a metachar, as an integer.
- \e[1m-ex \e[22mSpecifies "x" to be the escape char for metachars.
-
- \e[1m-fn \e[22mSpecifies "n" to be the escape char for metachars, as an inte-
+ \e[1m-fn \e[22mSpecifies "n" to be the escape char for metachars, as an inte-
ger.
- \e[1m-a \e[22mSpecifies that all arguments are to be quoted. The default is
- that only arguments containing spaces are quoted.
+ \e[1m-a \e[22mSpecifies that all arguments are to be quoted. The default is
+ that only arguments containing metacharacters are quoted
\e[1mSEE ALSO\e[0m
less(1)
\e[1mAUTHOR\e[0m
- This manual page was written by Thomas Schoepf <schoepf@debian.org>,
+ This manual page was written by Thomas Schoepf <schoepf@debian.org>,
for the Debian GNU/Linux system (but may be used by others).
Send bug reports or comments to bug-less@gnu.org.
- Version 444: 09 Jun 2011 LESSECHO(1)
+ Version 458: 04 Apr 2013 LESSECHO(1)
-.TH LESSECHO 1 "Version 444: 09 Jun 2011"
+.TH LESSECHO 1 "Version 458: 04 Apr 2013"
.SH NAME
lessecho \- expand metacharacters
.SH SYNOPSIS
.SH "DESCRIPTION"
.I lessecho
is a program that simply echos its arguments on standard output.
-But any argument containing spaces is enclosed in quotes.
+But any metacharacter in the output is preceded by an "escape"
+character, which by default is a backslash.
.SH OPTIONS
A summary of options is included below.
.TP
+.B \-ex
+Specifies "x", rather than backslash, to be the escape char for metachars.
+If x is "-", no escape char is used and arguments containing metachars
+are surrounded by quotes instead.
+.TP
.B \-ox
-Specifies "x" to be the open quote character.
+Specifies "x", rather than double-quote, to be the open quote character,
+which is used if the -e- option is specified.
.TP
.B \-cx
Specifies "x" to be the close quote character.
.TP
.B \-mx
Specifies "x" to be a metachar.
+By default, no characters are considered metachars.
.TP
.B \-nn
Specifies "n" to be a metachar, as an integer.
.TP
-.B \-ex
-Specifies "x" to be the escape char for metachars.
-.TP
.B \-fn
Specifies "n" to be the escape char for metachars, as an integer.
.TP
.B \-a
Specifies that all arguments are to be quoted.
-The default is that only arguments containing spaces are quoted.
+The default is that only arguments containing metacharacters are quoted
.SH "SEE ALSO"
less(1)
.SH AUTHOR
/*
- * Copyright (C) 1984-2011 Mark Nudelman
+ * Copyright (C) 1984-2012 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
*
- * For more information about less, or for information on how to
- * contact the author, see the README file.
+ * For more information, see the README file.
*/
+#if HAVE_GNU_REGEX
+#define __USE_GNU 1
+#include <regex.h>
+#define DEFINE_PATTERN(name) struct re_pattern_buffer *name
+#define CLEAR_PATTERN(name) name = NULL
+#endif
+
#if HAVE_POSIX_REGCOMP
#include <regex.h>
#ifdef REG_EXTENDED
#define CLEAR_PATTERN(name) name = NULL
#endif
+#if NO_REGEX
+#define DEFINE_PATTERN(name)
+#define CLEAR_PATTERN(name)
+#endif
/*
- * Copyright (C) 1984-2011 Mark Nudelman
+ * Copyright (C) 1984-2012 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
*
- * For more information about less, or for information on how to
- * contact the author, see the README file.
+ * For more information, see the README file.
*/
/*
- * Copyright (C) 1984-2011 Mark Nudelman
+ * Copyright (C) 1984-2012 Mark Nudelman
*
* You may distribute under the terms of either the GNU General Public
* License or the Less License, as specified in the README file.
*
- * For more information about less, or for information on how to
- * contact the author, see the README file.
+ * For more information, see the README file.
*/
/*