From f7cf2976020bea4fd5cba55555e1b09b71a26953 Mon Sep 17 00:00:00 2001 From: Lionel Sambuc Date: Tue, 3 Dec 2013 11:35:03 +0100 Subject: [PATCH] Importing external/bsd/less Change-Id: I7999b23fbef86a9a5d8d6fe4e80b9bd23d5b9d87 --- commands/Makefile | 2 +- commands/less/Makefile | 5 - commands/less/Makefile.inc | 7 - commands/less/less/Makefile | 22 - commands/less/less/charset.c | 1042 --- commands/less/less/version.c | 675 -- commands/less/less2netbsd | 100 - commands/less/lessecho/Makefile | 10 - commands/less/lesskey/Makefile | 9 - commands/less/lesskey/lesskey.h | 40 - distrib/sets/lists/minix/mi | 1 + external/bsd/Makefile | 6 +- external/bsd/less/Makefile | 7 + external/bsd/less/Makefile.inc | 4 + external/bsd/less/bin/Makefile | 7 + external/bsd/less/bin/Makefile.inc | 7 + external/bsd/less/bin/less/Makefile | 20 + external/bsd/less/bin/lessecho/Makefile | 9 + external/bsd/less/bin/lesskey/Makefile | 12 + external/bsd/less/dist/COPYING | 674 ++ .../less => external/bsd/less/dist}/INSTALL | 0 .../less => external/bsd/less/dist}/LICENSE | 2 +- external/bsd/less/dist/Makefile.aut | 133 + external/bsd/less/dist/Makefile.dsb | 51 + external/bsd/less/dist/Makefile.dsg | 92 + external/bsd/less/dist/Makefile.dsu | 59 + external/bsd/less/dist/Makefile.in | 122 + external/bsd/less/dist/Makefile.o2e | 43 + external/bsd/less/dist/Makefile.o9c | 47 + external/bsd/less/dist/Makefile.o9u | 43 + external/bsd/less/dist/Makefile.wnb | 71 + external/bsd/less/dist/Makefile.wnm | 56 + .../less/less => external/bsd/less/dist}/NEWS | 188 +- .../less => external/bsd/less/dist}/README | 18 +- .../less => external/bsd/less/dist}/brac.c | 4 +- .../less/less => external/bsd/less/dist}/ch.c | 308 +- external/bsd/less/dist/charset.c | 1178 +++ .../less => external/bsd/less/dist}/charset.h | 4 +- .../less => external/bsd/less/dist}/cmd.h | 6 +- .../less => external/bsd/less/dist}/cmdbuf.c | 94 +- .../less => external/bsd/less/dist}/command.c | 728 +- external/bsd/less/dist/configure | 6740 +++++++++++++++++ external/bsd/less/dist/configure.ac | 666 ++ external/bsd/less/dist/cvt.c | 122 + .../less => external/bsd/less/dist}/decode.c | 9 +- external/bsd/less/dist/defines.ds | 400 + .../less => external/bsd/less/dist}/defines.h | 68 +- external/bsd/less/dist/defines.h.in | 426 ++ external/bsd/less/dist/defines.o2 | 328 + external/bsd/less/dist/defines.o9 | 340 + external/bsd/less/dist/defines.wn | 339 + .../less => external/bsd/less/dist}/edit.c | 39 +- .../bsd/less/dist}/filename.c | 78 +- .../bsd/less/dist}/forwback.c | 90 +- .../less => external/bsd/less/dist}/funcs.h | 36 +- .../less => external/bsd/less/dist}/help.c | 20 +- .../less => external/bsd/less/dist}/ifile.c | 4 +- .../less => external/bsd/less/dist}/input.c | 84 +- external/bsd/less/dist/install.sh | 119 + .../less => external/bsd/less/dist}/jump.c | 34 +- .../less => external/bsd/less/dist}/less.1 | 477 +- .../less => external/bsd/less/dist}/less.h | 67 +- external/bsd/less/dist/less.hlp | 231 + external/bsd/less/dist/lessecho.1 | 47 + .../bsd/less/dist}/lessecho.c | 6 +- .../bsd/less/dist}/lesskey.1 | 145 +- .../bsd/less/dist}/lesskey.c | 122 +- .../less => external/bsd/less/dist}/lesskey.h | 4 +- .../less => external/bsd/less/dist}/lglob.h | 4 +- .../less => external/bsd/less/dist}/line.c | 86 +- .../less => external/bsd/less/dist}/linenum.c | 61 +- .../less => external/bsd/less/dist}/lsystem.c | 13 +- .../less => external/bsd/less/dist}/main.c | 37 +- .../less => external/bsd/less/dist}/mark.c | 4 +- external/bsd/less/dist/mkfuncs.awk | 9 + external/bsd/less/dist/mkhelp.c | 71 + external/bsd/less/dist/mkinstalldirs | 32 + .../less => external/bsd/less/dist}/optfunc.c | 157 +- .../less => external/bsd/less/dist}/option.c | 199 +- .../less => external/bsd/less/dist}/option.h | 8 +- .../less => external/bsd/less/dist}/opttbl.c | 46 +- .../less/less => external/bsd/less/dist}/os.c | 65 +- .../less => external/bsd/less/dist}/output.c | 223 +- external/bsd/less/dist/pattern.c | 324 + external/bsd/less/dist/pattern.h | 51 + .../less => external/bsd/less/dist}/pckeys.h | 4 +- .../bsd/less/dist}/position.c | 4 +- .../bsd/less/dist}/position.h | 4 +- .../less => external/bsd/less/dist}/prompt.c | 36 +- external/bsd/less/dist/regexp.c | 1252 +++ external/bsd/less/dist/regexp.h | 36 + .../less => external/bsd/less/dist}/screen.c | 162 +- external/bsd/less/dist/scrsize.c | 106 + .../less => external/bsd/less/dist}/search.c | 951 +-- .../less => external/bsd/less/dist}/signal.c | 34 +- .../less => external/bsd/less/dist}/tags.c | 16 +- .../less => external/bsd/less/dist}/ttyin.c | 12 +- external/bsd/less/dist/version.c | 750 ++ external/bsd/less/less2netbsd | 121 + releasetools/nbsd_ports | 1 + 100 files changed, 18004 insertions(+), 3822 deletions(-) delete mode 100644 commands/less/Makefile delete mode 100644 commands/less/Makefile.inc delete mode 100644 commands/less/less/Makefile delete mode 100644 commands/less/less/charset.c delete mode 100644 commands/less/less/version.c delete mode 100755 commands/less/less2netbsd delete mode 100644 commands/less/lessecho/Makefile delete mode 100644 commands/less/lesskey/Makefile delete mode 100644 commands/less/lesskey/lesskey.h create mode 100644 external/bsd/less/Makefile create mode 100644 external/bsd/less/Makefile.inc create mode 100644 external/bsd/less/bin/Makefile create mode 100644 external/bsd/less/bin/Makefile.inc create mode 100644 external/bsd/less/bin/less/Makefile create mode 100644 external/bsd/less/bin/lessecho/Makefile create mode 100644 external/bsd/less/bin/lesskey/Makefile create mode 100644 external/bsd/less/dist/COPYING rename {commands/less/less => external/bsd/less/dist}/INSTALL (100%) rename {commands/less/less => external/bsd/less/dist}/LICENSE (96%) create mode 100644 external/bsd/less/dist/Makefile.aut create mode 100644 external/bsd/less/dist/Makefile.dsb create mode 100644 external/bsd/less/dist/Makefile.dsg create mode 100644 external/bsd/less/dist/Makefile.dsu create mode 100644 external/bsd/less/dist/Makefile.in create mode 100644 external/bsd/less/dist/Makefile.o2e create mode 100644 external/bsd/less/dist/Makefile.o9c create mode 100644 external/bsd/less/dist/Makefile.o9u create mode 100644 external/bsd/less/dist/Makefile.wnb create mode 100644 external/bsd/less/dist/Makefile.wnm rename {commands/less/less => external/bsd/less/dist}/NEWS (78%) rename {commands/less/less => external/bsd/less/dist}/README (96%) rename {commands/less/less => external/bsd/less/dist}/brac.c (95%) rename {commands/less/less => external/bsd/less/dist}/ch.c (72%) create mode 100644 external/bsd/less/dist/charset.c rename {commands/less/less => external/bsd/less/dist}/charset.h (87%) rename {commands/less/less => external/bsd/less/dist}/cmd.h (95%) rename {commands/less/less => external/bsd/less/dist}/cmdbuf.c (94%) rename {commands/less/less => external/bsd/less/dist}/command.c (74%) create mode 100755 external/bsd/less/dist/configure create mode 100644 external/bsd/less/dist/configure.ac create mode 100644 external/bsd/less/dist/cvt.c rename {commands/less/less => external/bsd/less/dist}/decode.c (98%) create mode 100644 external/bsd/less/dist/defines.ds rename {commands/less/less => external/bsd/less/dist}/defines.h (89%) create mode 100644 external/bsd/less/dist/defines.h.in create mode 100644 external/bsd/less/dist/defines.o2 create mode 100644 external/bsd/less/dist/defines.o9 create mode 100644 external/bsd/less/dist/defines.wn rename {commands/less/less => external/bsd/less/dist}/edit.c (95%) rename {commands/less/less => external/bsd/less/dist}/filename.c (93%) rename {commands/less/less => external/bsd/less/dist}/forwback.c (86%) rename {commands/less/less => external/bsd/less/dist}/funcs.h (87%) rename {commands/less/less => external/bsd/less/dist}/help.c (95%) rename {commands/less/less => external/bsd/less/dist}/ifile.c (98%) rename {commands/less/less => external/bsd/less/dist}/input.c (82%) create mode 100644 external/bsd/less/dist/install.sh rename {commands/less/less => external/bsd/less/dist}/jump.c (89%) rename {commands/less/less => external/bsd/less/dist}/less.1 (84%) rename {commands/less/less => external/bsd/less/dist}/less.h (85%) create mode 100644 external/bsd/less/dist/less.hlp create mode 100644 external/bsd/less/dist/lessecho.1 rename {commands/less/lessecho => external/bsd/less/dist}/lessecho.c (97%) rename {commands/less/lesskey => external/bsd/less/dist}/lesskey.1 (80%) rename {commands/less/lesskey => external/bsd/less/dist}/lesskey.c (86%) rename {commands/less/less => external/bsd/less/dist}/lesskey.h (88%) rename {commands/less/less => external/bsd/less/dist}/lglob.h (96%) rename {commands/less/less => external/bsd/less/dist}/line.c (91%) rename {commands/less/less => external/bsd/less/dist}/linenum.c (90%) rename {commands/less/less => external/bsd/less/dist}/lsystem.c (96%) rename {commands/less/less => external/bsd/less/dist}/main.c (93%) rename {commands/less/less => external/bsd/less/dist}/mark.c (97%) create mode 100644 external/bsd/less/dist/mkfuncs.awk create mode 100644 external/bsd/less/dist/mkhelp.c create mode 100644 external/bsd/less/dist/mkinstalldirs rename {commands/less/less => external/bsd/less/dist}/optfunc.c (78%) rename {commands/less/less => external/bsd/less/dist}/option.c (82%) rename {commands/less/less => external/bsd/less/dist}/option.h (89%) rename {commands/less/less => external/bsd/less/dist}/opttbl.c (93%) rename {commands/less/less => external/bsd/less/dist}/os.c (82%) rename {commands/less/less => external/bsd/less/dist}/output.c (78%) create mode 100644 external/bsd/less/dist/pattern.c create mode 100644 external/bsd/less/dist/pattern.h rename {commands/less/less => external/bsd/less/dist}/pckeys.h (89%) rename {commands/less/less => external/bsd/less/dist}/position.c (97%) rename {commands/less/less => external/bsd/less/dist}/position.h (80%) rename {commands/less/less => external/bsd/less/dist}/prompt.c (93%) create mode 100644 external/bsd/less/dist/regexp.c create mode 100644 external/bsd/less/dist/regexp.h rename {commands/less/less => external/bsd/less/dist}/screen.c (94%) create mode 100644 external/bsd/less/dist/scrsize.c rename {commands/less/less => external/bsd/less/dist}/search.c (57%) rename {commands/less/less => external/bsd/less/dist}/signal.c (89%) rename {commands/less/less => external/bsd/less/dist}/tags.c (97%) rename {commands/less/less => external/bsd/less/dist}/ttyin.c (95%) create mode 100644 external/bsd/less/dist/version.c create mode 100755 external/bsd/less/less2netbsd diff --git a/commands/Makefile b/commands/Makefile index 71ecfceaf..e9f1dbaa5 100644 --- a/commands/Makefile +++ b/commands/Makefile @@ -13,7 +13,7 @@ SUBDIR= add_route arp ash at backup btrace \ gcov-pull grep host \ hostaddr ifconfig ifdef \ intr ipcrm ipcs irdpd isoread \ - less loadkeys loadramdisk logger look lp \ + loadkeys loadramdisk logger look lp \ lpd lspci mail MAKEDEV \ mined \ mount mt netconf \ diff --git a/commands/less/Makefile b/commands/less/Makefile deleted file mode 100644 index 9999a1c1f..000000000 --- a/commands/less/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -# $NetBSD: Makefile,v 1.2 1999/03/24 09:15:20 mrg Exp $ - -SUBDIR=less lesskey lessecho - -.include diff --git a/commands/less/Makefile.inc b/commands/less/Makefile.inc deleted file mode 100644 index 4c8b4eae4..000000000 --- a/commands/less/Makefile.inc +++ /dev/null @@ -1,7 +0,0 @@ -# $NetBSD: Makefile.inc,v 1.3 2001/07/26 14:20:47 mrg Exp $ - -.if exists(${.CURDIR}/../../Makefile.inc) -.include "${.CURDIR}/../../Makefile.inc" -.endif - -CWARNFLAGS+= -Wno-strict-prototypes -Wno-missing-prototypes diff --git a/commands/less/less/Makefile b/commands/less/less/Makefile deleted file mode 100644 index 9416e8e0f..000000000 --- a/commands/less/less/Makefile +++ /dev/null @@ -1,22 +0,0 @@ -# $NetBSD: Makefile,v 1.11 2006/11/20 22:06:26 dsl Exp $ -# from: @(#)Makefile 5.6 (Berkeley) 3/12/91 - -.ifdef SMALLPROG -CPPFLAGS+=-DSMALL -.endif - -PROG= less -CPPFLAGS+=-I${.CURDIR} -I${.CURDIR}/../lesskey -DSYSDIR=\"/etc\" -SRCS= brac.c ch.c charset.c cmdbuf.c command.c decode.c edit.c \ - filename.c forwback.c help.c ifile.c input.c jump.c line.c \ - linenum.c lsystem.c main.c mark.c optfunc.c option.c opttbl.c \ - os.c output.c position.c prompt.c screen.c search.c signal.c \ - tags.c ttyin.c version.c - -LDADD+= -ltermcap -DPADD+= ${LIBTERM} - -MLINKS= less.1 more.1 less.1 page.1 -LINKS= ${BINDIR}/less ${BINDIR}/more ${BINDIR}/less ${BINDIR}/page - -.include diff --git a/commands/less/less/charset.c b/commands/less/less/charset.c deleted file mode 100644 index 111d3322f..000000000 --- a/commands/less/less/charset.c +++ /dev/null @@ -1,1042 +0,0 @@ -/* $NetBSD: charset.c,v 1.7 2006/10/26 01:33:08 mrg Exp $ */ - -/* - * Copyright (C) 1984-2005 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. - */ - - -/* - * Functions to define the character set - * and do things specific to the character set. - */ - -#include "less.h" -#if HAVE_LOCALE -#include -#include -#include -#endif - -#include "charset.h" - -public int utf_mode = 0; - -/* - * Predefined character sets, - * selected by the LESSCHARSET environment variable. - */ -struct charset { - char *name; - int *p_flag; - char *desc; -} charsets[] = { - { "ascii", NULL, "8bcccbcc18b95.b" }, - { "utf-8", &utf_mode, "8bcccbcc18b95.b126.bb" }, - { "iso8859", NULL, "8bcccbcc18b95.33b." }, - { "latin3", NULL, "8bcccbcc18b95.33b5.b8.b15.b4.b12.b18.b12.b." }, - { "arabic", NULL, "8bcccbcc18b95.33b.3b.7b2.13b.3b.b26.5b19.b" }, - { "greek", NULL, "8bcccbcc18b95.33b4.2b4.b3.b35.b44.b" }, - { "greek2005", NULL, "8bcccbcc18b95.33b14.b35.b44.b" }, - { "hebrew", NULL, "8bcccbcc18b95.33b.b29.32b28.2b2.b" }, - { "koi8-r", NULL, "8bcccbcc18b95.b." }, - { "KOI8-T", NULL, "8bcccbcc18b95.b8.b6.b8.b.b.5b7.3b4.b4.b3.b.b.3b." }, - { "georgianps", NULL, "8bcccbcc18b95.3b11.4b12.2b." }, - { "tcvn", NULL, "b..b...bcccbccbbb7.8b95.b48.5b." }, - { "TIS-620", NULL, "8bcccbcc18b95.b.4b.11b7.8b." }, - { "next", NULL, "8bcccbcc18b95.bb125.bb" }, - { "dos", NULL, "8bcccbcc12bc5b95.b." }, - { "windows-1251", NULL, "8bcccbcc12bc5b95.b24.b." }, - { "windows-1252", NULL, "8bcccbcc12bc5b95.b.b11.b.2b12.b." }, - { "windows-1255", NULL, "8bcccbcc12bc5b95.b.b8.b.5b9.b.4b." }, - { "ebcdic", NULL, "5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b." }, - { "IBM-1047", NULL, "4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc191.b" }, - { NULL, NULL, NULL } -}; - -/* - * Support "locale charmap"/nl_langinfo(CODESET) values, as well as others. - */ -struct cs_alias { - char *name; - char *oname; -} cs_aliases[] = { - { "UTF-8", "utf-8" }, - { "ANSI_X3.4-1968", "ascii" }, - { "US-ASCII", "ascii" }, - { "latin1", "iso8859" }, - { "ISO-8859-1", "iso8859" }, - { "latin9", "iso8859" }, - { "ISO-8859-15", "iso8859" }, - { "latin2", "iso8859" }, - { "ISO-8859-2", "iso8859" }, - { "ISO-8859-3", "latin3" }, - { "latin4", "iso8859" }, - { "ISO-8859-4", "iso8859" }, - { "cyrillic", "iso8859" }, - { "ISO-8859-5", "iso8859" }, - { "ISO-8859-6", "arabic" }, - { "ISO-8859-7", "greek" }, - { "IBM9005", "greek2005" }, - { "ISO-8859-8", "hebrew" }, - { "latin5", "iso8859" }, - { "ISO-8859-9", "iso8859" }, - { "latin6", "iso8859" }, - { "ISO-8859-10", "iso8859" }, - { "latin7", "iso8859" }, - { "ISO-8859-13", "iso8859" }, - { "latin8", "iso8859" }, - { "ISO-8859-14", "iso8859" }, - { "latin10", "iso8859" }, - { "ISO-8859-16", "iso8859" }, - { "IBM437", "dos" }, - { "EBCDIC-US", "ebcdic" }, - { "IBM1047", "IBM-1047" }, - { "KOI8-R", "koi8-r" }, - { "KOI8-U", "koi8-r" }, - { "GEORGIAN-PS", "georgianps" }, - { "TCVN5712-1", "tcvn" }, - { "NEXTSTEP", "next" }, - { "windows", "windows-1252" }, /* backward compatibility */ - { "CP1251", "windows-1251" }, - { "CP1252", "windows-1252" }, - { "CP1255", "windows-1255" }, - { NULL, NULL } -}; - -#define IS_BINARY_CHAR 01 -#define IS_CONTROL_CHAR 02 - -static char chardef[256]; -static char *binfmt = NULL; -static char *utfbinfmt = NULL; -public int binattr = AT_STANDOUT; - -static void ichardef __P((char *)); -static int icharset __P((char *, int)); -#if HAVE_LOCALE -static void ilocale __P((void)); -#endif - -/* - * Define a charset, given a description string. - * The string consists of 256 letters, - * one for each character in the charset. - * If the string is shorter than 256 letters, missing letters - * are taken to be identical to the last one. - * A decimal number followed by a letter is taken to be a - * repetition of the letter. - * - * Each letter is one of: - * . normal character - * b binary character - * c control character - */ - static void -ichardef(s) - char *s; -{ - register char *cp; - register int n; - register char v; - - n = 0; - v = 0; - cp = chardef; - while (*s != '\0') - { - switch (*s++) - { - case '.': - v = 0; - break; - case 'c': - v = IS_CONTROL_CHAR; - break; - case 'b': - v = IS_BINARY_CHAR|IS_CONTROL_CHAR; - break; - - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - n = (10 * n) + (s[-1] - '0'); - continue; - - default: - error("invalid chardef", NULL_PARG); - quit(QUIT_ERROR); - /*NOTREACHED*/ - } - - do - { - if (cp >= chardef + sizeof(chardef)) - { - error("chardef longer than 256", NULL_PARG); - quit(QUIT_ERROR); - /*NOTREACHED*/ - } - *cp++ = v; - } while (--n > 0); - n = 0; - } - - while (cp < chardef + sizeof(chardef)) - *cp++ = v; -} - -/* - * Define a charset, given a charset name. - * The valid charset names are listed in the "charsets" array. - */ - static int -icharset(name, no_error) - register char *name; - int no_error; -{ - register struct charset *p; - register struct cs_alias *a; - - if (name == NULL || *name == '\0') - return (0); - - /* First see if the name is an alias. */ - for (a = cs_aliases; a->name != NULL; a++) - { - if (strcmp(name, a->name) == 0) - { - name = a->oname; - break; - } - } - - for (p = charsets; p->name != NULL; p++) - { - if (strcmp(name, p->name) == 0) - { - ichardef(p->desc); - if (p->p_flag != NULL) - *(p->p_flag) = 1; - return (1); - } - } - - if (!no_error) { - error("invalid charset name", NULL_PARG); - quit(QUIT_ERROR); - } - return (0); -} - -#if HAVE_LOCALE -/* - * Define a charset, given a locale name. - */ - static void -ilocale() -{ - register int c; - - for (c = 0; c < (int) sizeof(chardef); c++) - { - if (isprint(c)) - chardef[c] = 0; - else if (iscntrl(c)) - chardef[c] = IS_CONTROL_CHAR; - else - chardef[c] = IS_BINARY_CHAR|IS_CONTROL_CHAR; - } -} -#endif - -/* - * Define the printing format for control (or binary utf) chars. - */ - static void -setbinfmt(s, fmtvarptr, default_fmt) - char *s; - char **fmtvarptr; - char *default_fmt; -{ - if (s && utf_mode) - { - /* It would be too hard to account for width otherwise. */ - char *t = s; - while (*t) - { - if (*t < ' ' || *t > '~') - { - s = default_fmt; - goto attr; - } - t++; - } - } - - /* %n is evil */ - if (s == NULL || *s == '\0' || - (*s == '*' && (s[1] == '\0' || s[2] == '\0' || strchr(s + 2, 'n'))) || - (*s != '*' && strchr(s, 'n'))) - s = default_fmt; - - /* - * Select the attributes if it starts with "*". - */ - attr: - if (*s == '*') - { - switch (s[1]) - { - case 'd': binattr = AT_BOLD; break; - case 'k': binattr = AT_BLINK; break; - case 's': binattr = AT_STANDOUT; break; - case 'u': binattr = AT_UNDERLINE; break; - default: binattr = AT_NORMAL; break; - } - s += 2; - } - *fmtvarptr = s; -} - -/* - * - */ - static void -set_charset() -{ - char *s; - - /* - * See if environment variable LESSCHARSET is defined. - */ - s = lgetenv("LESSCHARSET"); - if (icharset(s, 0)) - return; - - /* - * LESSCHARSET is not defined: try LESSCHARDEF. - */ - s = lgetenv("LESSCHARDEF"); - if (s != NULL && *s != '\0') - { - ichardef(s); - return; - } - -#if HAVE_LOCALE - /* - * Try using the codeset name as the charset name. - */ - s = nl_langinfo(CODESET); - if (icharset(s, 1)) - return; -#endif - -#if HAVE_STRSTR - /* - * Check whether LC_ALL, LC_CTYPE or LANG look like UTF-8 is used. - */ - if ((s = lgetenv("LC_ALL")) != NULL || - (s = lgetenv("LC_CTYPE")) != NULL || - (s = lgetenv("LANG")) != NULL) - { - if ( strstr(s, "UTF-8") != NULL || strstr(s, "utf-8") != NULL - || strstr(s, "UTF8") != NULL || strstr(s, "utf8") != NULL) - if (icharset("utf-8", 1)) - return; - } -#endif - -#if HAVE_LOCALE - /* - * Get character definitions from locale functions, - * rather than from predefined charset entry. - */ - ilocale(); -#if MSDOS_COMPILER - /* - * Default to "dos". - */ - (void) icharset("dos", 1); -#else - /* - * Default to "latin1". - */ - (void) icharset("latin1", 1); -#endif -#endif -} - -/* - * Initialize charset data structures. - */ - public void -init_charset() -{ - char *s; - -#if HAVE_LOCALE - setlocale(LC_ALL, ""); -#endif - - set_charset(); - - s = lgetenv("LESSBINFMT"); - setbinfmt(s, &binfmt, "*s<%02X>"); - - s = lgetenv("LESSUTFBINFMT"); - setbinfmt(s, &utfbinfmt, ""); -} - -/* - * Is a given character a "binary" character? - */ - public int -binary_char(c) - unsigned int c; -{ - c &= 0377; - return (chardef[c] & IS_BINARY_CHAR); -} - -/* - * Is a given character a "control" character? - */ - public int -control_char(c) - int c; -{ - c &= 0377; - return (chardef[c] & IS_CONTROL_CHAR); -} - -/* - * Return the printable form of a character. - * For example, in the "ascii" charset '\3' is printed as "^C". - */ - public char * -prchar(c) - int c; -{ - /* {{ This buffer can be overrun if LESSBINFMT is a long string. }} */ - static char buf[32]; - - c &= 0377; - if ((c < 128 || !utf_mode) && !control_char(c)) - SNPRINTF1(buf, sizeof(buf), "%c", c); - else if (c == ESC) - strcpy(buf, "ESC"); -#if IS_EBCDIC_HOST - else if (!binary_char(c) && c < 64) - SNPRINTF1(buf, sizeof(buf), "^%c", - /* - * This array roughly inverts CONTROL() #defined in less.h, - * and should be kept in sync with CONTROL() and IBM-1047. - */ - "@ABC.I.?...KLMNO" - "PQRS.JH.XY.." - "\\]^_" - "......W[.....EFG" - "..V....D....TU.Z"[c]); -#else - else if (c < 128 && !control_char(c ^ 0100)) - SNPRINTF1(buf, sizeof(buf), "^%c", c ^ 0100); -#endif - else - SNPRINTF1(buf, sizeof(buf), binfmt, c); - return (buf); -} - -/* - * Return the printable form of a UTF-8 character. - */ - public char * -prutfchar(ch) - LWCHAR ch; -{ - static char buf[32]; - - if (ch == ESC) - strcpy(buf, "ESC"); - else if (ch < 128 && control_char(ch)) - { - if (!control_char(ch ^ 0100)) - SNPRINTF1(buf, sizeof(buf), "^%c", ((char) ch) ^ 0100); - else - SNPRINTF1(buf, sizeof(buf), binfmt, (char) ch); - } else if (is_ubin_char(ch)) - SNPRINTF1(buf, sizeof(buf), utfbinfmt, ch); - else - { - int len; - if (ch >= 0x80000000) - { - len = 3; - ch = 0xFFFD; - } else - { - len = (ch < 0x80) ? 1 - : (ch < 0x800) ? 2 - : (ch < 0x10000) ? 3 - : (ch < 0x200000) ? 4 - : (ch < 0x4000000) ? 5 - : 6; - } - buf[len] = '\0'; - if (len == 1) - *buf = (char) ch; - else - { - *buf = ((1 << len) - 1) << (8 - len); - while (--len > 0) - { - buf[len] = (char) (0x80 | (ch & 0x3F)); - ch >>= 6; - } - *buf |= ch; - } - } - return (buf); -} - -/* - * Get the length of a UTF-8 character in bytes. - */ - public int -utf_len(ch) - char ch; -{ - if ((ch & 0x80) == 0) - return 1; - if ((ch & 0xE0) == 0xC0) - return 2; - if ((ch & 0xF0) == 0xE0) - return 3; - if ((ch & 0xF8) == 0xF0) - return 4; - if ((ch & 0xFC) == 0xF8) - return 5; - if ((ch & 0xFE) == 0xFC) - return 6; - /* Invalid UTF-8 encoding. */ - return 1; -} - -/* - * Is a UTF-8 character well-formed? - */ - public int -is_utf8_well_formed(s) - unsigned char *s; -{ - int i; - int len; - - if (IS_UTF8_INVALID(s[0])) - return (0); - - len = utf_len((char) s[0]); - if (len == 1) - return (1); - if (len == 2) - { - if (s[0] < 0xC2) - return (0); - } else - { - unsigned char mask; - mask = (~((1 << (8-len)) - 1)) & 0xFF; - if (s[0] == mask && (s[1] & mask) == 0x80) - return (0); - } - - for (i = 1; i < len; i++) - if (!IS_UTF8_TRAIL(s[i])) - return (0); - return (1); -} - -/* - * Get the value of a UTF-8 character. - */ - public LWCHAR -get_wchar(p) - char *p; -{ - switch (utf_len(p[0])) - { - case 1: - default: - return (LWCHAR) - (p[0] & 0xFF); - case 2: - return (LWCHAR) ( - ((p[0] & 0x1F) << 6) | - (p[1] & 0x3F)); - case 3: - return (LWCHAR) ( - ((p[0] & 0x0F) << 12) | - ((p[1] & 0x3F) << 6) | - (p[2] & 0x3F)); - case 4: - return (LWCHAR) ( - ((p[0] & 0x07) << 18) | - ((p[1] & 0x3F) << 12) | - ((p[2] & 0x3F) << 6) | - (p[3] & 0x3F)); - case 5: - return (LWCHAR) ( - ((p[0] & 0x03) << 24) | - ((p[1] & 0x3F) << 18) | - ((p[2] & 0x3F) << 12) | - ((p[3] & 0x3F) << 6) | - (p[4] & 0x3F)); - case 6: - return (LWCHAR) ( - ((p[0] & 0x01) << 30) | - ((p[1] & 0x3F) << 24) | - ((p[2] & 0x3F) << 18) | - ((p[3] & 0x3F) << 12) | - ((p[4] & 0x3F) << 6) | - (p[5] & 0x3F)); - } -} - -/* - * Step forward or backward one character in a string. - */ - public LWCHAR -step_char(pp, dir, limit) - char **pp; - signed int dir; - char *limit; -{ - LWCHAR ch; - char *p = *pp; - - if (!utf_mode) - { - /* It's easy if chars are one byte. */ - if (dir > 0) - ch = (LWCHAR) ((p < limit) ? *p++ : 0); - else - ch = (LWCHAR) ((p > limit) ? *--p : 0); - } else if (dir > 0) - { - if (p + utf_len(*p) > limit) - ch = 0; - else - { - ch = get_wchar(p); - p++; - while (IS_UTF8_TRAIL(*p)) - p++; - } - } else - { - while (p > limit && IS_UTF8_TRAIL(p[-1])) - p--; - if (p > limit) - ch = get_wchar(--p); - else - ch = 0; - } - *pp = p; - return ch; -} - -/* - * Unicode characters data - */ -struct wchar_range { LWCHAR first, last; }; - -static struct wchar_range comp_table[] = { - {0x300,0x357}, {0x35d,0x36f}, {0x483,0x486}, {0x488,0x489}, - {0x591,0x5a1}, {0x5a3,0x5b9}, {0x5bb,0x5bd}, {0x5bf,0x5bf}, - {0x5c1,0x5c2}, {0x5c4,0x5c4}, {0x610,0x615}, {0x64b,0x658}, - {0x670,0x670}, {0x6d6,0x6dc}, {0x6de,0x6e4}, {0x6e7,0x6e8}, - {0x6ea,0x6ed}, {0x711,0x711}, {0x730,0x74a}, {0x7a6,0x7b0}, - {0x901,0x902}, {0x93c,0x93c}, {0x941,0x948}, {0x94d,0x94d}, - {0x951,0x954}, {0x962,0x963}, {0x981,0x981}, {0x9bc,0x9bc}, - {0x9c1,0x9c4}, {0x9cd,0x9cd}, {0x9e2,0x9e3}, {0xa01,0xa02}, - {0xa3c,0xa3c}, {0xa41,0xa42}, {0xa47,0xa48}, {0xa4b,0xa4d}, - {0xa70,0xa71}, {0xa81,0xa82}, {0xabc,0xabc}, {0xac1,0xac5}, - {0xac7,0xac8}, {0xacd,0xacd}, {0xae2,0xae3}, {0xb01,0xb01}, - {0xb3c,0xb3c}, {0xb3f,0xb3f}, {0xb41,0xb43}, {0xb4d,0xb4d}, - {0xb56,0xb56}, {0xb82,0xb82}, {0xbc0,0xbc0}, {0xbcd,0xbcd}, - {0xc3e,0xc40}, {0xc46,0xc48}, {0xc4a,0xc4d}, {0xc55,0xc56}, - {0xcbc,0xcbc}, {0xcbf,0xcbf}, {0xcc6,0xcc6}, {0xccc,0xccd}, - {0xd41,0xd43}, {0xd4d,0xd4d}, {0xdca,0xdca}, {0xdd2,0xdd4}, - {0xdd6,0xdd6}, {0xe31,0xe31}, {0xe34,0xe3a}, {0xe47,0xe4e}, - {0xeb1,0xeb1}, {0xeb4,0xeb9}, {0xebb,0xebc}, {0xec8,0xecd}, - {0xf18,0xf19}, {0xf35,0xf35}, {0xf37,0xf37}, {0xf39,0xf39}, - {0xf71,0xf7e}, {0xf80,0xf84}, {0xf86,0xf87}, {0xf90,0xf97}, - {0xf99,0xfbc}, {0xfc6,0xfc6}, {0x102d,0x1030}, {0x1032,0x1032}, - {0x1036,0x1037}, {0x1039,0x1039}, {0x1058,0x1059}, - {0x1712,0x1714}, {0x1732,0x1734}, {0x1752,0x1753}, - {0x1772,0x1773}, {0x17b7,0x17bd}, {0x17c6,0x17c6}, - {0x17c9,0x17d3}, {0x17dd,0x17dd}, {0x180b,0x180d}, - {0x18a9,0x18a9}, {0x1920,0x1922}, {0x1927,0x1928}, - {0x1932,0x1932}, {0x1939,0x193b}, {0x20d0,0x20ea}, - {0x302a,0x302f}, {0x3099,0x309a}, {0xfb1e,0xfb1e}, - {0xfe00,0xfe0f}, {0xfe20,0xfe23}, {0x1d167,0x1d169}, - {0x1d17b,0x1d182}, {0x1d185,0x1d18b}, {0x1d1aa,0x1d1ad}, - {0xe0100,0xe01ef}, -}; - -static struct wchar_range comb_table[] = { - {0x0644,0x0622}, {0x0644,0x0623}, {0x0644,0x0625}, {0x0644,0x0627}, -}; - -/* - * Characters with general category values - * Cc: Other, Control - * Cf: Other, Format - * Cs: Other, Surrogate - * Co: Other, Private Use - * Cn: Other, Not Assigned - * Zl: Separator, Line - * Zp: Separator, Paragraph - */ -static struct wchar_range ubin_table[] = { - { 0x0000, 0x001f} /* Cc */, { 0x007f, 0x009f} /* Cc */, -#if 0 - { 0x00ad, 0x00ad} /* Cf */, -#endif - { 0x0237, 0x024f} /* Cn */, { 0x0358, 0x035c} /* Cn */, - { 0x0370, 0x0373} /* Cn */, { 0x0376, 0x0379} /* Cn */, - { 0x037b, 0x037d} /* Cn */, { 0x037f, 0x0383} /* Cn */, - { 0x038b, 0x038b} /* Cn */, { 0x038d, 0x038d} /* Cn */, - { 0x03a2, 0x03a2} /* Cn */, { 0x03cf, 0x03cf} /* Cn */, - { 0x03fc, 0x03ff} /* Cn */, { 0x0487, 0x0487} /* Cn */, - { 0x04cf, 0x04cf} /* Cn */, { 0x04f6, 0x04f7} /* Cn */, - { 0x04fa, 0x04ff} /* Cn */, { 0x0510, 0x0530} /* Cn */, - { 0x0557, 0x0558} /* Cn */, { 0x0560, 0x0560} /* Cn */, - { 0x0588, 0x0588} /* Cn */, { 0x058b, 0x0590} /* Cn */, - { 0x05a2, 0x05a2} /* Cn */, { 0x05ba, 0x05ba} /* Cn */, - { 0x05c5, 0x05cf} /* Cn */, { 0x05eb, 0x05ef} /* Cn */, - { 0x05f5, 0x05ff} /* Cn */, -#if 0 - { 0x0600, 0x0603} /* Cf */, -#endif - { 0x0604, 0x060b} /* Cn */, { 0x0616, 0x061a} /* Cn */, - { 0x061c, 0x061e} /* Cn */, { 0x0620, 0x0620} /* Cn */, - { 0x063b, 0x063f} /* Cn */, { 0x0659, 0x065f} /* Cn */, -#if 0 - { 0x06dd, 0x06dd} /* Cf */, -#endif - { 0x070e, 0x070e} /* Cn */, -#if 0 - { 0x070f, 0x070f} /* Cf */, -#endif - { 0x074b, 0x074c} /* Cn */, { 0x0750, 0x077f} /* Cn */, - { 0x07b2, 0x0900} /* Cn */, { 0x093a, 0x093b} /* Cn */, - { 0x094e, 0x094f} /* Cn */, { 0x0955, 0x0957} /* Cn */, - { 0x0971, 0x0980} /* Cn */, { 0x0984, 0x0984} /* Cn */, - { 0x098d, 0x098e} /* Cn */, { 0x0991, 0x0992} /* Cn */, - { 0x09a9, 0x09a9} /* Cn */, { 0x09b1, 0x09b1} /* Cn */, - { 0x09b3, 0x09b5} /* Cn */, { 0x09ba, 0x09bb} /* Cn */, - { 0x09c5, 0x09c6} /* Cn */, { 0x09c9, 0x09ca} /* Cn */, - { 0x09ce, 0x09d6} /* Cn */, { 0x09d8, 0x09db} /* Cn */, - { 0x09de, 0x09de} /* Cn */, { 0x09e4, 0x09e5} /* Cn */, - { 0x09fb, 0x0a00} /* Cn */, { 0x0a04, 0x0a04} /* Cn */, - { 0x0a0b, 0x0a0e} /* Cn */, { 0x0a11, 0x0a12} /* Cn */, - { 0x0a29, 0x0a29} /* Cn */, { 0x0a31, 0x0a31} /* Cn */, - { 0x0a34, 0x0a34} /* Cn */, { 0x0a37, 0x0a37} /* Cn */, - { 0x0a3a, 0x0a3b} /* Cn */, { 0x0a3d, 0x0a3d} /* Cn */, - { 0x0a43, 0x0a46} /* Cn */, { 0x0a49, 0x0a4a} /* Cn */, - { 0x0a4e, 0x0a58} /* Cn */, { 0x0a5d, 0x0a5d} /* Cn */, - { 0x0a5f, 0x0a65} /* Cn */, { 0x0a75, 0x0a80} /* Cn */, - { 0x0a84, 0x0a84} /* Cn */, { 0x0a8e, 0x0a8e} /* Cn */, - { 0x0a92, 0x0a92} /* Cn */, { 0x0aa9, 0x0aa9} /* Cn */, - { 0x0ab1, 0x0ab1} /* Cn */, { 0x0ab4, 0x0ab4} /* Cn */, - { 0x0aba, 0x0abb} /* Cn */, { 0x0ac6, 0x0ac6} /* Cn */, - { 0x0aca, 0x0aca} /* Cn */, { 0x0ace, 0x0acf} /* Cn */, - { 0x0ad1, 0x0adf} /* Cn */, { 0x0ae4, 0x0ae5} /* Cn */, - { 0x0af0, 0x0af0} /* Cn */, { 0x0af2, 0x0b00} /* Cn */, - { 0x0b04, 0x0b04} /* Cn */, { 0x0b0d, 0x0b0e} /* Cn */, - { 0x0b11, 0x0b12} /* Cn */, { 0x0b29, 0x0b29} /* Cn */, - { 0x0b31, 0x0b31} /* Cn */, { 0x0b34, 0x0b34} /* Cn */, - { 0x0b3a, 0x0b3b} /* Cn */, { 0x0b44, 0x0b46} /* Cn */, - { 0x0b49, 0x0b4a} /* Cn */, { 0x0b4e, 0x0b55} /* Cn */, - { 0x0b58, 0x0b5b} /* Cn */, { 0x0b5e, 0x0b5e} /* Cn */, - { 0x0b62, 0x0b65} /* Cn */, { 0x0b72, 0x0b81} /* Cn */, - { 0x0b84, 0x0b84} /* Cn */, { 0x0b8b, 0x0b8d} /* Cn */, - { 0x0b91, 0x0b91} /* Cn */, { 0x0b96, 0x0b98} /* Cn */, - { 0x0b9b, 0x0b9b} /* Cn */, { 0x0b9d, 0x0b9d} /* Cn */, - { 0x0ba0, 0x0ba2} /* Cn */, { 0x0ba5, 0x0ba7} /* Cn */, - { 0x0bab, 0x0bad} /* Cn */, { 0x0bb6, 0x0bb6} /* Cn */, - { 0x0bba, 0x0bbd} /* Cn */, { 0x0bc3, 0x0bc5} /* Cn */, - { 0x0bc9, 0x0bc9} /* Cn */, { 0x0bce, 0x0bd6} /* Cn */, - { 0x0bd8, 0x0be6} /* Cn */, { 0x0bfb, 0x0c00} /* Cn */, - { 0x0c04, 0x0c04} /* Cn */, { 0x0c0d, 0x0c0d} /* Cn */, - { 0x0c11, 0x0c11} /* Cn */, { 0x0c29, 0x0c29} /* Cn */, - { 0x0c34, 0x0c34} /* Cn */, { 0x0c3a, 0x0c3d} /* Cn */, - { 0x0c45, 0x0c45} /* Cn */, { 0x0c49, 0x0c49} /* Cn */, - { 0x0c4e, 0x0c54} /* Cn */, { 0x0c57, 0x0c5f} /* Cn */, - { 0x0c62, 0x0c65} /* Cn */, { 0x0c70, 0x0c81} /* Cn */, - { 0x0c84, 0x0c84} /* Cn */, { 0x0c8d, 0x0c8d} /* Cn */, - { 0x0c91, 0x0c91} /* Cn */, { 0x0ca9, 0x0ca9} /* Cn */, - { 0x0cb4, 0x0cb4} /* Cn */, { 0x0cba, 0x0cbb} /* Cn */, - { 0x0cc5, 0x0cc5} /* Cn */, { 0x0cc9, 0x0cc9} /* Cn */, - { 0x0cce, 0x0cd4} /* Cn */, { 0x0cd7, 0x0cdd} /* Cn */, - { 0x0cdf, 0x0cdf} /* Cn */, { 0x0ce2, 0x0ce5} /* Cn */, - { 0x0cf0, 0x0d01} /* Cn */, { 0x0d04, 0x0d04} /* Cn */, - { 0x0d0d, 0x0d0d} /* Cn */, { 0x0d11, 0x0d11} /* Cn */, - { 0x0d29, 0x0d29} /* Cn */, { 0x0d3a, 0x0d3d} /* Cn */, - { 0x0d44, 0x0d45} /* Cn */, { 0x0d49, 0x0d49} /* Cn */, - { 0x0d4e, 0x0d56} /* Cn */, { 0x0d58, 0x0d5f} /* Cn */, - { 0x0d62, 0x0d65} /* Cn */, { 0x0d70, 0x0d81} /* Cn */, - { 0x0d84, 0x0d84} /* Cn */, { 0x0d97, 0x0d99} /* Cn */, - { 0x0db2, 0x0db2} /* Cn */, { 0x0dbc, 0x0dbc} /* Cn */, - { 0x0dbe, 0x0dbf} /* Cn */, { 0x0dc7, 0x0dc9} /* Cn */, - { 0x0dcb, 0x0dce} /* Cn */, { 0x0dd5, 0x0dd5} /* Cn */, - { 0x0dd7, 0x0dd7} /* Cn */, { 0x0de0, 0x0df1} /* Cn */, - { 0x0df5, 0x0e00} /* Cn */, { 0x0e3b, 0x0e3e} /* Cn */, - { 0x0e5c, 0x0e80} /* Cn */, { 0x0e83, 0x0e83} /* Cn */, - { 0x0e85, 0x0e86} /* Cn */, { 0x0e89, 0x0e89} /* Cn */, - { 0x0e8b, 0x0e8c} /* Cn */, { 0x0e8e, 0x0e93} /* Cn */, - { 0x0e98, 0x0e98} /* Cn */, { 0x0ea0, 0x0ea0} /* Cn */, - { 0x0ea4, 0x0ea4} /* Cn */, { 0x0ea6, 0x0ea6} /* Cn */, - { 0x0ea8, 0x0ea9} /* Cn */, { 0x0eac, 0x0eac} /* Cn */, - { 0x0eba, 0x0eba} /* Cn */, { 0x0ebe, 0x0ebf} /* Cn */, - { 0x0ec5, 0x0ec5} /* Cn */, { 0x0ec7, 0x0ec7} /* Cn */, - { 0x0ece, 0x0ecf} /* Cn */, { 0x0eda, 0x0edb} /* Cn */, - { 0x0ede, 0x0eff} /* Cn */, { 0x0f48, 0x0f48} /* Cn */, - { 0x0f6b, 0x0f70} /* Cn */, { 0x0f8c, 0x0f8f} /* Cn */, - { 0x0f98, 0x0f98} /* Cn */, { 0x0fbd, 0x0fbd} /* Cn */, - { 0x0fcd, 0x0fce} /* Cn */, { 0x0fd0, 0x0fff} /* Cn */, - { 0x1022, 0x1022} /* Cn */, { 0x1028, 0x1028} /* Cn */, - { 0x102b, 0x102b} /* Cn */, { 0x1033, 0x1035} /* Cn */, - { 0x103a, 0x103f} /* Cn */, { 0x105a, 0x109f} /* Cn */, - { 0x10c6, 0x10cf} /* Cn */, { 0x10f9, 0x10fa} /* Cn */, - { 0x10fc, 0x10ff} /* Cn */, { 0x115a, 0x115e} /* Cn */, - { 0x11a3, 0x11a7} /* Cn */, { 0x11fa, 0x11ff} /* Cn */, - { 0x1207, 0x1207} /* Cn */, { 0x1247, 0x1247} /* Cn */, - { 0x1249, 0x1249} /* Cn */, { 0x124e, 0x124f} /* Cn */, - { 0x1257, 0x1257} /* Cn */, { 0x1259, 0x1259} /* Cn */, - { 0x125e, 0x125f} /* Cn */, { 0x1287, 0x1287} /* Cn */, - { 0x1289, 0x1289} /* Cn */, { 0x128e, 0x128f} /* Cn */, - { 0x12af, 0x12af} /* Cn */, { 0x12b1, 0x12b1} /* Cn */, - { 0x12b6, 0x12b7} /* Cn */, { 0x12bf, 0x12bf} /* Cn */, - { 0x12c1, 0x12c1} /* Cn */, { 0x12c6, 0x12c7} /* Cn */, - { 0x12cf, 0x12cf} /* Cn */, { 0x12d7, 0x12d7} /* Cn */, - { 0x12ef, 0x12ef} /* Cn */, { 0x130f, 0x130f} /* Cn */, - { 0x1311, 0x1311} /* Cn */, { 0x1316, 0x1317} /* Cn */, - { 0x131f, 0x131f} /* Cn */, { 0x1347, 0x1347} /* Cn */, - { 0x135b, 0x1360} /* Cn */, { 0x137d, 0x139f} /* Cn */, - { 0x13f5, 0x1400} /* Cn */, { 0x1677, 0x167f} /* Cn */, - { 0x169d, 0x169f} /* Cn */, { 0x16f1, 0x16ff} /* Cn */, - { 0x170d, 0x170d} /* Cn */, { 0x1715, 0x171f} /* Cn */, - { 0x1737, 0x173f} /* Cn */, { 0x1754, 0x175f} /* Cn */, - { 0x176d, 0x176d} /* Cn */, { 0x1771, 0x1771} /* Cn */, - { 0x1774, 0x177f} /* Cn */, -#if 0 - { 0x17b4, 0x17b5} /* Cf */, -#endif - { 0x17de, 0x17df} /* Cn */, { 0x17ea, 0x17ef} /* Cn */, - { 0x17fa, 0x17ff} /* Cn */, { 0x180f, 0x180f} /* Cn */, - { 0x181a, 0x181f} /* Cn */, { 0x1878, 0x187f} /* Cn */, - { 0x18aa, 0x18ff} /* Cn */, { 0x191d, 0x191f} /* Cn */, - { 0x192c, 0x192f} /* Cn */, { 0x193c, 0x193f} /* Cn */, - { 0x1941, 0x1943} /* Cn */, { 0x196e, 0x196f} /* Cn */, - { 0x1975, 0x19df} /* Cn */, { 0x1a00, 0x1cff} /* Cn */, - { 0x1d6c, 0x1dff} /* Cn */, { 0x1e9c, 0x1e9f} /* Cn */, - { 0x1efa, 0x1eff} /* Cn */, { 0x1f16, 0x1f17} /* Cn */, - { 0x1f1e, 0x1f1f} /* Cn */, { 0x1f46, 0x1f47} /* Cn */, - { 0x1f4e, 0x1f4f} /* Cn */, { 0x1f58, 0x1f58} /* Cn */, - { 0x1f5a, 0x1f5a} /* Cn */, { 0x1f5c, 0x1f5c} /* Cn */, - { 0x1f5e, 0x1f5e} /* Cn */, { 0x1f7e, 0x1f7f} /* Cn */, - { 0x1fb5, 0x1fb5} /* Cn */, { 0x1fc5, 0x1fc5} /* Cn */, - { 0x1fd4, 0x1fd5} /* Cn */, { 0x1fdc, 0x1fdc} /* Cn */, - { 0x1ff0, 0x1ff1} /* Cn */, { 0x1ff5, 0x1ff5} /* Cn */, - { 0x1fff, 0x1fff} /* Cn */, { 0x200b, 0x200f} /* Cf */, - { 0x2028, 0x2028} /* Zl */, - { 0x2029, 0x2029} /* Zp */, - { 0x202a, 0x202e} /* Cf */, - { 0x2055, 0x2056} /* Cn */, { 0x2058, 0x205e} /* Cn */, - { 0x2060, 0x2063} /* Cf */, - { 0x2064, 0x2069} /* Cn */, - { 0x206a, 0x206f} /* Cf */, - { 0x2072, 0x2073} /* Cn */, { 0x208f, 0x209f} /* Cn */, - { 0x20b2, 0x20cf} /* Cn */, { 0x20eb, 0x20ff} /* Cn */, - { 0x213c, 0x213c} /* Cn */, { 0x214c, 0x2152} /* Cn */, - { 0x2184, 0x218f} /* Cn */, { 0x23d1, 0x23ff} /* Cn */, - { 0x2427, 0x243f} /* Cn */, { 0x244b, 0x245f} /* Cn */, - { 0x2618, 0x2618} /* Cn */, { 0x267e, 0x267f} /* Cn */, - { 0x2692, 0x269f} /* Cn */, { 0x26a2, 0x2700} /* Cn */, - { 0x2705, 0x2705} /* Cn */, { 0x270a, 0x270b} /* Cn */, - { 0x2728, 0x2728} /* Cn */, { 0x274c, 0x274c} /* Cn */, - { 0x274e, 0x274e} /* Cn */, { 0x2753, 0x2755} /* Cn */, - { 0x2757, 0x2757} /* Cn */, { 0x275f, 0x2760} /* Cn */, - { 0x2795, 0x2797} /* Cn */, { 0x27b0, 0x27b0} /* Cn */, - { 0x27bf, 0x27cf} /* Cn */, { 0x27ec, 0x27ef} /* Cn */, - { 0x2b0e, 0x2e7f} /* Cn */, { 0x2e9a, 0x2e9a} /* Cn */, - { 0x2ef4, 0x2eff} /* Cn */, { 0x2fd6, 0x2fef} /* Cn */, - { 0x2ffc, 0x2fff} /* Cn */, { 0x3040, 0x3040} /* Cn */, - { 0x3097, 0x3098} /* Cn */, { 0x3100, 0x3104} /* Cn */, - { 0x312d, 0x3130} /* Cn */, { 0x318f, 0x318f} /* Cn */, - { 0x31b8, 0x31ef} /* Cn */, { 0x321f, 0x321f} /* Cn */, - { 0x3244, 0x324f} /* Cn */, { 0x327e, 0x327e} /* Cn */, - { 0x32ff, 0x32ff} /* Cn */, { 0x4db6, 0x4dbf} /* Cn */, - { 0x9fa6, 0x9fff} /* Cn */, { 0xa48d, 0xa48f} /* Cn */, - { 0xa4c7, 0xabff} /* Cn */, { 0xd7a4, 0xd7ff} /* Cn */, - { 0xd800, 0xdfff} /* Cs */, - { 0xe000, 0xf8ff} /* Co */, - { 0xfa2e, 0xfa2f} /* Cn */, { 0xfa6b, 0xfaff} /* Cn */, - { 0xfb07, 0xfb12} /* Cn */, { 0xfb18, 0xfb1c} /* Cn */, - { 0xfb37, 0xfb37} /* Cn */, { 0xfb3d, 0xfb3d} /* Cn */, - { 0xfb3f, 0xfb3f} /* Cn */, { 0xfb42, 0xfb42} /* Cn */, - { 0xfb45, 0xfb45} /* Cn */, { 0xfbb2, 0xfbd2} /* Cn */, - { 0xfd40, 0xfd4f} /* Cn */, { 0xfd90, 0xfd91} /* Cn */, - { 0xfdc8, 0xfdef} /* Cn */, { 0xfdfe, 0xfdff} /* Cn */, - { 0xfe10, 0xfe1f} /* Cn */, { 0xfe24, 0xfe2f} /* Cn */, - { 0xfe53, 0xfe53} /* Cn */, { 0xfe67, 0xfe67} /* Cn */, - { 0xfe6c, 0xfe6f} /* Cn */, { 0xfe75, 0xfe75} /* Cn */, - { 0xfefd, 0xfefe} /* Cn */, - { 0xfeff, 0xfeff} /* Cf */, - { 0xff00, 0xff00} /* Cn */, { 0xffbf, 0xffc1} /* Cn */, - { 0xffc8, 0xffc9} /* Cn */, { 0xffd0, 0xffd1} /* Cn */, - { 0xffd8, 0xffd9} /* Cn */, { 0xffdd, 0xffdf} /* Cn */, - { 0xffe7, 0xffe7} /* Cn */, { 0xffef, 0xfff8} /* Cn */, - { 0xfff9, 0xfffb} /* Cf */, - { 0xfffe, 0xffff} /* Cn */, { 0x1000c, 0x1000c} /* Cn */, - { 0x10027, 0x10027} /* Cn */, { 0x1003b, 0x1003b} /* Cn */, - { 0x1003e, 0x1003e} /* Cn */, { 0x1004e, 0x1004f} /* Cn */, - { 0x1005e, 0x1007f} /* Cn */, { 0x100fb, 0x100ff} /* Cn */, - { 0x10103, 0x10106} /* Cn */, { 0x10134, 0x10136} /* Cn */, - { 0x10140, 0x102ff} /* Cn */, { 0x1031f, 0x1031f} /* Cn */, - { 0x10324, 0x1032f} /* Cn */, { 0x1034b, 0x1037f} /* Cn */, - { 0x1039e, 0x1039e} /* Cn */, { 0x103a0, 0x103ff} /* Cn */, - { 0x1049e, 0x1049f} /* Cn */, { 0x104aa, 0x107ff} /* Cn */, - { 0x10806, 0x10807} /* Cn */, { 0x10809, 0x10809} /* Cn */, - { 0x10836, 0x10836} /* Cn */, { 0x10839, 0x1083b} /* Cn */, - { 0x1083d, 0x1083e} /* Cn */, { 0x10840, 0x1cfff} /* Cn */, - { 0x1d0f6, 0x1d0ff} /* Cn */, { 0x1d127, 0x1d129} /* Cn */, - { 0x1d173, 0x1d17a} /* Cf */, - { 0x1d1de, 0x1d2ff} /* Cn */, { 0x1d357, 0x1d3ff} /* Cn */, - { 0x1d455, 0x1d455} /* Cn */, { 0x1d49d, 0x1d49d} /* Cn */, - { 0x1d4a0, 0x1d4a1} /* Cn */, { 0x1d4a3, 0x1d4a4} /* Cn */, - { 0x1d4a7, 0x1d4a8} /* Cn */, { 0x1d4ad, 0x1d4ad} /* Cn */, - { 0x1d4ba, 0x1d4ba} /* Cn */, { 0x1d4bc, 0x1d4bc} /* Cn */, - { 0x1d4c4, 0x1d4c4} /* Cn */, { 0x1d506, 0x1d506} /* Cn */, - { 0x1d50b, 0x1d50c} /* Cn */, { 0x1d515, 0x1d515} /* Cn */, - { 0x1d51d, 0x1d51d} /* Cn */, { 0x1d53a, 0x1d53a} /* Cn */, - { 0x1d53f, 0x1d53f} /* Cn */, { 0x1d545, 0x1d545} /* Cn */, - { 0x1d547, 0x1d549} /* Cn */, { 0x1d551, 0x1d551} /* Cn */, - { 0x1d6a4, 0x1d6a7} /* Cn */, { 0x1d7ca, 0x1d7cd} /* Cn */, - { 0x1d800, 0x1ffff} /* Cn */, { 0x2a6d7, 0x2f7ff} /* Cn */, - { 0x2fa1e, 0xe0000} /* Cn */, - { 0xe0001, 0xe0001} /* Cf */, - { 0xe0002, 0xe001f} /* Cn */, - { 0xe0020, 0xe007f} /* Cf */, - { 0xe0080, 0xe00ff} /* Cn */, { 0xe01f0, 0xeffff} /* Cn */, - { 0xf0000, 0xffffd} /* Co */, - { 0xffffe, 0xfffff} /* Cn */, - {0x100000,0x10fffd} /* Co */, - {0x10fffe,0x10ffff} /* Cn */, - {0x110000,0x7fffffff} /* ISO 10646?? */ -}; - -/* - * Double width characters - * W: East Asian Wide - * F: East Asian Full-width - */ -static struct wchar_range wide_table[] = { - { 0x1100, 0x115f} /* W */, { 0x2329, 0x232a} /* W */, - { 0x2E80, 0x2FFB} /* W */, - { 0x3000, 0x3000} /* F */, - { 0x3001, 0x303E} /* W */, { 0x3041, 0x4DB5} /* W */, - { 0x4E00, 0x9FA5} /* W */, { 0xA000, 0xA4C6} /* W */, - { 0xAC00, 0xD7A3} /* W */, { 0xF900, 0xFA6A} /* W */, - { 0xFE30, 0xFE6B} /* W */, - { 0xFF01, 0xFF60} /* F */, { 0xFFE0, 0xFFE6} /* F */, - { 0x20000, 0x2FFFD} /* W */, { 0x30000, 0x3FFFD} /* W */, - -}; - - static int -is_in_table(ch, table, tsize) - LWCHAR ch; - struct wchar_range table[]; - int tsize; -{ - int hi; - int lo; - - /* Binary search in the table. */ - if (ch < table[0].first) - return 0; - lo = 0; - hi = tsize - 1; - while (lo <= hi) - { - int mid = (lo + hi) / 2; - if (ch > table[mid].last) - lo = mid + 1; - else if (ch < table[mid].first) - hi = mid - 1; - else - return 1; - } - return 0; -} - -/* - * Is a character a UTF-8 composing character? - * If a composing character follows any char, the two combine into one glyph. - */ - public int -is_composing_char(ch) - LWCHAR ch; -{ - return is_in_table(ch, comp_table, (sizeof(comp_table) / sizeof(*comp_table))); -} - -/* - * Should this UTF-8 character be treated as binary? - */ - public int -is_ubin_char(ch) - LWCHAR ch; -{ - return is_in_table(ch, ubin_table, (sizeof(ubin_table) / sizeof(*ubin_table))); -} - -/* - * Is this a double width UTF-8 character? - */ - public int -is_wide_char(ch) - LWCHAR ch; -{ - return is_in_table(ch, wide_table, (sizeof(wide_table) / sizeof(*wide_table))); -} - -/* - * Is a character a UTF-8 combining character? - * A combining char acts like an ordinary char, but if it follows - * a specific char (not any char), the two combine into one glyph. - */ - public int -is_combining_char(ch1, ch2) - LWCHAR ch1; - LWCHAR ch2; -{ - /* The table is small; use linear search. */ - int i; - for (i = 0; i < sizeof(comb_table)/sizeof(*comb_table); i++) - { - if (ch1 == comb_table[i].first && - ch2 == comb_table[i].last) - return 1; - } - return 0; -} - diff --git a/commands/less/less/version.c b/commands/less/less/version.c deleted file mode 100644 index 84e01a444..000000000 --- a/commands/less/less/version.c +++ /dev/null @@ -1,675 +0,0 @@ -/* $NetBSD: version.c,v 1.6 2006/10/26 01:33:08 mrg Exp $ */ - -/* - * Copyright (C) 1984-2005 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. - */ - - -/* ------------------------ CHANGE HISTORY -------------------------- - - 1/29/84 Allowed use on standard input - 2/1/84 Added E, N, P commands - 4/17/84 Added '=' command, 'stop' signal handling - 4/20/84 Added line folding -v2 4/27/84 Fixed '=' command to use BOTTOM_PLUS_ONE, - instead of TOP, added 'p' & 'v' commands -v3 5/3/84 Added -m and -t options, '-' command -v4 5/3/84 Added LESS environment variable -v5 5/3/84 New comments, fixed '-' command slightly -v6 5/15/84 Added -Q, visual bell -v7 5/24/84 Fixed jump_back(n) bug: n should count real - lines, not folded lines. Also allow number on G command. -v8 5/30/84 Re-do -q and -Q commands -v9 9/25/84 Added "+" argument -v10 10/10/84 Fixed bug in -b argument processing -v11 10/18/84 Made error() ring bell if \n not entered. ------------------------------------------------------------------ -v12 2/13/85 Reorganized signal handling and made portable to 4.2bsd. -v13 2/16/85 Reword error message for '-' command. -v14 2/22/85 Added -bf and -bp variants of -b. -v15 2/25/85 Miscellaneous changes. -v16 3/13/85 Added -u flag for backspace processing. -v17 4/13/85 Added j and k commands, changed -t default. -v18 4/20/85 Rewrote signal handling code. -v19 5/2/85 Got rid of "verbose" eq_message(). - Made search() scroll in some cases. -v20 5/21/85 Fixed screen.c ioctls for System V. -v21 5/23/85 Fixed some first_cmd bugs. -v22 5/24/85 Added support for no RECOMP nor REGCMP. -v23 5/25/85 Miscellanous changes and prettying up. - Posted to USENET. ------------------------------------------------------------------ -v24 6/3/85 Added ti,te terminal init & de-init. - (Thanks to Mike Kersenbrock) -v25 6/8/85 Added -U flag, standout mode underlining. -v26 6/9/85 Added -M flag. - Use underline termcap (us) if it exists. -v27 6/15/85 Renamed some variables to make unique in - 6 chars. Minor fix to -m. -v28 6/28/85 Fixed right margin bug. -v29 6/28/85 Incorporated M.Rose's changes to signal.c -v30 6/29/85 Fixed stupid bug in argument processing. -v31 7/15/85 Added -p flag, changed repaint algorithm. - Added kludge for magic cookie terminals. -v32 7/16/85 Added cat_file if output not a tty. -v33 7/23/85 Added -e flag and EDITOR. -v34 7/26/85 Added -s flag. -v35 7/27/85 Rewrote option handling; added option.c. -v36 7/29/85 Fixed -e flag to work if not last file. -v37 8/10/85 Added -x flag. -v38 8/19/85 Changed prompting; created prompt.c. -v39 8/24/85 (Not -p) does not initially clear screen. -v40 8/26/85 Added "skipping" indicator in forw(). - Posted to USENET. ------------------------------------------------------------------ -v41 9/17/85 ONLY_RETURN, control char commands, - faster search, other minor fixes. -v42 9/25/85 Added ++ command line syntax; - ch_fsize for pipes. -v43 10/15/85 Added -h flag, changed prim.c algorithms. -v44 10/16/85 Made END print in all cases of eof; - ignore SIGTTOU after receiv ing SIGTSTP. -v45 10/16/85 Never print backspaces unless -u. -v46 10/24/85 Backwards scroll in jump_loc. -v47 10/30/85 Fixed bug in edit(): *first_cmd==0 -v48 11/16/85 Use TIOCSETN instead of TIOCSETP. - Added marks (m and ' commands). - Posted to USENET. ------------------------------------------------------------------ -v49 1/9/86 Fixed bug: signal didn't clear mcc. -v50 1/15/86 Added ' (quote) to gomark. -v51 1/16/86 Added + cmd, fixed problem if first_cmd - fails, made g cmd sort of "work" on pipes - ev en if bof is no longer buffered. -v52 1/17/86 Made short files work better. -v53 1/20/86 Added -P option. -v54 1/20/86 Changed help to use HELPFILE. -v55 1/23/86 Messages work better if not tty output. -v56 1/24/86 Added -l option. -v57 1/31/86 Fixed -l to get confirmation before - ov erwriting an existing file. -v58 8/28/86 Added filename globbing. -v59 9/15/86 Fixed some bugs with very long filenames. -v60 9/26/86 Incorporated changes from Leith (Casey) - Leedom for boldface and -z option. -v61 9/26/86 Got rid of annoying repaints after ! cmd. - Posted to USENET. ------------------------------------------------------------------ -v62 12/23/86 Added is_directory(); change -z default to - -1 instead of 24; cat-and-exit if -e and - file is less than a screenful. -v63 1/8/87 Fixed bug in cat-and-exit if > 1 file. -v64 1/12/87 Changed puts/putstr, putc/putchr, - getc/getchr to av oid name conflict with - stdio functions. -v65 1/26/87 Allowed '-' command to change NUMBER - v alued options (thanks to Gary Puckering) -v66 2/13/87 Fixed bug: prepaint should use force=1. -v67 2/24/87 Added !! and % expansion to ! command. -v68 2/25/87 Added SIGWINCH and TIOCGWINSZ support; - changed is_directory to bad_file. - (thanks to J. Robert Ward) -v69 2/25/87 Added SIGWIND and WIOCGETD (for Unix PC). -v70 3/13/87 Changed help cmd from 'h' to 'H'; better - error msgs in bad_file, errno_message. -v71 5/11/87 Changed -p to -c, made triple -c/-C - for clear-eol like more's -c. -v72 6/26/87 Added -E, -L, use $SHELL in lsystem(). - (thanks to Stev e Spearman) -v73 6/26/87 Allow Examine "#" for previous file. - Posted to USENET 8/25/87. ------------------------------------------------------------------ -v74 9/18/87 Fix conflict in EOF symbol with stdio.h, - Make os.c more portable to BSD. -v75 9/23/87 Fix problems in get_term (thanks to - Paul Eggert); new backwards scrolling in - jump_loc (thanks to Marion Hakanson). -v76 9/23/87 Added -i flag; allow single "!" to - inv oke a shell (thanks to Franco Barber). -v77 9/24/87 Added -n flag and line number support. -v78 9/25/87 Fixed problem with prompts longer than - the screen width. -v79 9/29/87 Added the _ command. -v80 10/6/87 Allow signal to break out of linenum scan. -v81 10/6/87 Allow -b to be changed from within less. -v82 10/7/87 Add cmd_decode to use a table for key - binding (thanks to Dav id Nason). -v83 10/9/87 Allow .less file for user-defined keys. -v84 10/11/87 Fix -e/-E problems (thanks to Felix Lee). -v85 10/15/87 Search now keeps track of line numbers. -v86 10/20/87 Added -B option and autobuf; fixed - "pipe error" bug. -v87 3/1/88 Fix bug re BSD signals while reading file. -v88 3/12/88 Use new format for -P option (thanks to - der Mouse), allow "+-c" without message, - fix bug re BSD hangup. -v89 3/18/88 Turn off line numbers if linenum scan - is interrupted. -v90 3/30/88 Allow -P from within less. -v91 3/30/88 Added tags file support (new -t option) - (thanks to Brian Campbell). -v92 4/4/88 Added -+option syntax. -v93 4/11/88 Add support for slow input (thanks to - Joe Orost & apologies for taking almost - 3 years to get this in!) -v94 4/11/88 Redo reading/signal stuff. -v95 4/20/88 Repaint screen better after signal. -v96 4/21/88 Add /! and ?! commands. -v97 5/17/88 Allow -l/-L from within less. - Eliminate some static arrays (use calloc). - Posted to USENET. ------------------------------------------------------------------ -v98 10/14/88 Fix incorrect calloc call; uninitialized - var in exec_mca; core dump on unknown TERM. - Make v cmd work if past last line of file. - Fix some signal bugs. -v99 10/29/88 Allow space between -X and string, - when X is a string-valued option. -v100 1/5/89 Fix globbing bug when $SHELL not set; - allow spaces after -t command. -v101 1/6/89 Fix problem with long (truncated) lines - in tags file (thanks to Neil Dixon). -v102 1/6/89 Fix bug with E# when no prev file; - allow spaces after -l command. -v103 3/14/89 Add -N, -f and -? options. Add z and w - commands. Add %L for prompt strings. -v104 3/16/89 Added EDITPROTO. -v105 3/20/89 Fix bug in find_linenum which cached - incorrectly on long lines. -v106 3/31/89 Added -k option and multiple lesskey - files. -v107 4/27/89 Add 8-bit char support and -g option. - Split option code into 3 files. -v108 5/5/89 Allocate position table dynamically - (thanks to Paul Eggert); change % command - from "percent" to vi-style brace finder. -v109 5/10/89 Added ESC-% command, split prim.c. -v110 5/24/89 Fixed bug in + option; fixed repaint bug - under Sun windows (thanks to Paul Eggert). -v111 5/25/89 Generalized # and % expansion; use - calloc for some error messages. -v112 5/30/89 Get rid of ESC-%, add {}()[] commands. -v113 5/31/89 Optimize lseeks (thanks to Paul Eggert). -v114 7/25/89 Added ESC-/ and ESC-/! commands. -v115 7/26/89 Added ESC-n command. -v116 7/31/89 Added find_pos to optimize g command. -v117 8/1/89 Change -f option to -r. -v118 8/2/89 Save positions for all previous files, - not just the immediately previous one. -v119 8/7/89 Save marks across file boundaries. - Add file handle stuff. -v120 8/11/89 Add :ta command. -v121 8/16/89 Add -f option. -v122 8/30/89 Fix performance with many buffers. -v123 8/31/89 Verbose prompts for string options. - Posted beta to USENET. ------------------------------------------------------------------ -v124 9/18/89 Reorganize search commands, - N = rev, ESC-n = span, add ESC-N. -v125 9/18/89 Fix tab bug (thanks to Alex Liu). - Fix EOF bug when both -w and -c. -v126 10/25/89 Add -j option. -v127 10/27/89 Fix problems with blank lines before BOF. -v128 10/27/89 Add %bj, etc. to prompt strings. -v129 11/3/89 Add -+,-- commands; add set-option and - unset-option to lesskey. -v130 11/6/89 Generalize A_EXTRA to string, remove - set-option, unset-option from lesskey. -v131 11/7/89 Changed name of EDITPROTO to LESSEDIT. -v132 11/8/89 Allow editing of command prefix. -v133 11/16/89 Add -y option (thanks to Jeff Sullivan). -v134 12/1/89 Glob filenames in the -l command. -v135 12/5/89 Combined {}()[] commands into one, and - added ESC-^F and ESC-^B commands. -v136 1/20/90 Added -S, -R flags. Added | command. - Added warning for binary files. (thanks - to Richard Brittain and J. Sullivan). -v137 1/21/90 Rewrote horrible pappend code. - Added * notation for hi-bit chars. -v138 1/24/90 Fix magic cookie terminal handling. - Get rid of "cleanup" loop in ch_get. -v139 1/27/90 Added MSDOS support. (many thanks - to Richard Brittain). -v140 2/7/90 Editing a new file adds it to the - command line list. -v141 2/8/90 Add edit_list for editing >1 file. -v142 2/10/90 Add :x command. -v143 2/11/90 Add * and @ modifies to search cmds. - Change ESC-/ cmd from /@* to / *. -v144 3/1/90 Messed around with ch_zero; - no real change. -v145 3/2/90 Added -R and -v/-V for MSDOS; - renamed FILENAME to avoid conflict. -v146 3/5/90 Pull cmdbuf functions out of command.c -v147 3/7/90 Implement ?@; fix multi-file edit bugs. -v148 3/29/90 Fixed bug in :e then :e#. -v149 4/3/90 Change error,ierror,query to use PARG. -v150 4/6/90 Add LESS_CHARSET, LESS_CHARDEF. -v151 4/13/90 Remove -g option; clean up ispipe. -v152 4/14/90 lsystem() closes input file, for - editors which require exclusive open. -v153 4/18/90 Fix bug if SHELL unset; - fix bug in overstrike control char. -v154 4/25/90 Output to fd 2 via buffer. -v155 4/30/90 Ignore -i if uppercase in pattern - (thanks to Michael Rendell.) -v156 5/3/90 Remove scroll limits in forw() & back(); - causes problems with -c. -v157 5/4/90 Forward search starts at next real line - (not screen line) after jump target. -v158 6/14/90 Added F command. -v159 7/29/90 Fix bug in exiting: output not flushed. -v160 7/29/90 Clear screen before initial output w/ -c. -v161 7/29/90 Add -T flag. -v162 8/14/90 Fix bug with +F on command line. -v163 8/21/90 Added LESSBINFMT variable. -v164 9/5/90 Added -p, LINES, COLUMNS and - unset mark ' == BOF, for 1003.2 D5. -v165 9/6/90 At EOF with -c set, don't display empty - screen when try to page forward. -v166 9/6/90 Fix G when final line in file wraps. -v167 9/11/90 Translate CR/LF -> LF for 1003.2. -v168 9/13/90 Return to curr file if "tag not found". -v169 12/12/90 G goes to EOF even if file has grown. -v170 1/17/91 Add optimization for BSD _setjmp; - fix #include ioctl.h TERMIO problem. - (thanks to Paul Eggert) - Posted to USENET. ------------------------------------------------------------------ -v171 3/6/91 Fix -? bug in get_filename. -v172 3/15/91 Fix G bug in empty file. - Fix bug with ?\n and -i and uppercase - pattern at EOF! - (thanks to Paul Eggert) -v173 3/17/91 Change N cmd to not permanently change - direction. (thanks to Brian Matthews) -v174 3/18/91 Fix bug with namelogfile not getting - cleared when change files. -v175 3/18/91 Fix bug with ++cmd on command line. - (thanks to Jim Meyering) -v176 4/2/91 Change | to not force current screen, - include marked line, start/end from - top of screen. Improve search speed. - (thanks to Don Mears) -v177 4/2/91 Add LESSHELP variable. - Fix bug with F command with -e. - Try /dev/tty for input before using fd 2. - Patches posted to USENET 4/2/91. ------------------------------------------------------------------ -v178 4/8/91 Fixed bug in globbing logfile name. - (thanks to Jim Meyering) -v179 4/9/91 Allow negative -z for screen-relative. -v180 4/9/91 Clear to eos rather than eol if "db"; - don't use "sr" if "da". - (thanks to Tor Lillqvist) -v181 4/18/91 Fixed bug with "negative" chars 80 - FF. - (thanks to Benny Sander Hofmann) -v182 5/16/91 Fixed bug with attribute at EOL. - (thanks to Brian Matthews) -v183 6/1/91 Rewrite linstall to do smart config. -v184 7/11/91 Process \b in searches based on -u - rather than -i. -v185 7/11/91 -Pxxx sets short prompt; assume SIGWINCH - after a SIGSTOP. (thanks to Ken Laprade) ------------------------------------------------------------------ -v186 4/20/92 Port to MS-DOS (Microsoft C). -v187 4/23/92 Added -D option & TAB_COMPLETE_FILENAME. -v188 4/28/92 Added command line editing features. -v189 12/8/92 Fix mem overrun in anscreen.c:init; - fix edit_list to recover from bin file. -v190 2/13/93 Make TAB enter one filename at a time; - create ^L with old TAB functionality. -v191 3/10/93 Defer creating "flash" page for MS-DOS. -v192 9/6/93 Add BACK-TAB. -v193 9/17/93 Simplify binary_file handling. -v194 1/4/94 Add rudiments of alt_filename handling. -v195 1/11/94 Port back to Unix; support keypad. ------------------------------------------------------------------ -v196 6/7/94 Fix bug with bad filename; fix IFILE - type problem. (thanks to David MacKenzie) -v197 6/7/94 Fix bug with .less tables inserted wrong. -v198 6/23/94 Use autoconf installation technology. - (thanks to David MacKenzie) -v199 6/29/94 Fix MS-DOS build (thanks to Tim Wiegman). -v200 7/25/94 Clean up copyright, minor fixes. - Posted to prep.ai.mit.edu ------------------------------------------------------------------ -v201 7/27/94 Check for no memcpy; add casts to calloc; - look for regcmp in libgen.a. - (thanks to Kaveh Ghazi). -v202 7/28/94 Fix bug in edit_next/edit_prev with - non-existent files. -v203 8/2/94 Fix a variety of configuration bugs on - various systems. (thanks to Sakai - Kiyotaka, Harald Koenig, Bjorn Brox, - Teemu Rantanen, and Thorsten Lockert) -v204 8/3/94 Use strerror if available. - (thanks to J.T. Conklin) -v205 8/5/94 Fix bug in finding "me" termcap entry. - (thanks to Andreas Stolcke) -8/10/94 v205+: Change BUFSIZ to LBUFSIZE to avoid name - conflict with stdio.h. - Posted to prep.ai.mit.edu ------------------------------------------------------------------ -v206 8/10/94 Use initial_scrpos for -t to avoid - displaying first page before init(). - (thanks to Dominique Petitpierre) -v207 8/12/94 Fix bug if stdout is not tty. -v208 8/16/94 Fix bug in close_altfile if goto err1 - in edit_ifile. (Thanks to M.J. Hewitt) -v209 8/16/94 Change scroll to wscroll to avoid - conflict with library function. -v210 8/16/94 Fix bug with bold on 8 bit chars. - (thanks to Vitor Duarte) -v211 8/16/94 Don't quit on EOI in jump_loc / forw. -v212 8/18/94 Use time_t if available. -v213 8/20/94 Allow ospeed to be defined in termcap.h. -v214 8/20/94 Added HILITE_SEARCH, -F, ESC-u cmd. - (thanks to Paul Lew and Bob Byrnes) -v215 8/23/94 Fix -i toggle behavior. -v216 8/23/94 Process BS in all searches, not only -u. -v217 8/24/94 Added -X flag. -v218 8/24/94 Reimplement undo_search. -v219 8/24/94 Find tags marked with line number - instead of pattern. -v220 8/24/94 Stay at same position after SIG_WINCH. -v221 8/24/94 Fix bug in file percentage in big file. -v222 8/25/94 Do better if can't reopen current file. -v223 8/27/94 Support setlocale. - (thanks to Robert Joop) -v224 8/29/94 Revert v216: process BS in search - only if -u. -v225 9/6/94 Rewrite undo_search again: toggle. -v226 9/15/94 Configuration fixes. - (thanks to David MacKenzie) -v227 9/19/94 Fixed strerror config problem. - Posted to prep.ai.mit.edu ------------------------------------------------------------------ -v228 9/21/94 Fix bug in signals: repeated calls to - get_editkeys overflowed st_edittable. -v229 9/21/94 Fix "Nothing to search" error if -a - and SRCH_PAST_EOF. -v230 9/21/94 Don't print extra error msg in search - after regerror(). -v231 9/22/94 Fix hilite bug if search matches 0 chars. - (thanks to John Polstra) -v232 9/23/94 Deal with weird systems that have - termios.h but not tcgetattr(). - Posted to prep.ai.mit.edu ------------------------------------------------------------------ -v233 9/26/94 Use get_term() instead of pos_init() in - psignals to re-get lower_left termcap. - (Thanks to John Malecki) -v234 9/26/94 Make MIDDLE closer to middle of screen. -v235 9/27/94 Use local strchr if system doesn't have. -v236 9/28/94 Don't use libucb; use libterm if - libtermcap & libcurses doesn't work. - (Fix for Solaris; thanks to Frank Kaefer) -v237 9/30/94 Use system isupper() etc if provided. - Posted to prep.ai.mit.edu ------------------------------------------------------------------ -v238 10/6/94 Make binary non-blinking if LESSBINFMT - is set to a string without a *. -v239 10/7/94 Don't let delimit_word run back past - beginning of cmdbuf. -v240 10/10/94 Don't write into termcap buffer. - (Thanks to Benoit Speckel) -v241 10/13/94 New lesskey file format. - Don't expand filenames in search command. -v242 10/14/94 Allow lesskey specification of "literal". -v243 10/14/94 Add #stop command to lesskey. -v244 10/16/94 Add -f flag to lesskey. -v245 10/25/94 Allow TAB_COMPLETE_FILENAME to be undefd. -v246 10/27/94 Move help file to /usr/local/share. -v247 10/27/94 Add -V option. -v248 11/5/94 Add -V option to lesskey. -v249 11/5/94 Remove -f flag from lesskey; default - input file is ~/.lesskey.in, not stdin. -v250 11/7/94 Lesskey input file "-" means stdin. -v251 11/9/94 Convert cfgetospeed result to ospeed. - (Thanks to Andrew Chernov) -v252 11/16/94 Change default lesskey input file from - .lesskey.in to .lesskey. - Posted to prep.ai.mit.edu ------------------------------------------------------------------ -v253 11/21/94 Fix bug when tags file has a backslash. -v254 12/6/94 Fix -k option. -v255 12/8/94 Add #define EXAMINE to disable :e etc. -v256 12/10/94 Change highlighting: only highlite search - results (but now it is reliable). -v257 12/10/94 Add goto_line and repaint_highlight - to optimize highlight repaints. -v258 12/12/94 Fixup in hilite_line if BS_SPECIAL. -v259 12/12/94 Convert to autoconf 2.0. -v260 12/13/94 Add SECURE define. -v261 12/14/94 Use system WERASE char as EC_W_BACKSPACE. -v262 12/16/94 Add -g/-G flag and screen_hilite. -v263 12/20/94 Reimplement/optimize -G flag behavior. -v264 12/23/94 Allow EXTRA string after line-edit cmd - in lesskey file. -v265 12/24/94 Add LESSOPEN=|cmd syntax. -v266 12/26/94 Add -I flag. -v267 12/28/94 Formalize the four-byte header emitted - by a LESSOPEN pipe. -v268 12/28/94 Get rid of four-byte header. -v269 1/2/95 Close alt file before open new one. - Avoids multiple popen(). -v270 1/3/95 Use VISUAL; use S_ISDIR/S_ISREG; fix - config problem with Solaris POSIX regcomp. -v271 1/4/95 Don't quit on read error. -v272 1/5/95 Get rid of -L. -v273 1/6/95 Fix ch_ungetchar bug; don't call - LESSOPEN on a pipe. -v274 1/6/95 Ported to OS/2 (thanks to Kai Uwe Rommel) -v275 1/18/95 Fix bug if toggle -G at EOF. -v276 1/30/95 Fix OS/2 version. -v277 1/31/95 Add "next" charset; don't display ^X - for X > 128. -v278 2/14/95 Change default for -G. - Posted to prep.ai.mit.edu ------------------------------------------------------------------ -v279 2/22/95 Add GNU options --help, --version. - Minor config fixes. -v280 2/24/95 Clean up calls to glob(); don't set # - if we can't open the new file. -v281 2/24/95 Repeat search should turn on hilites. -v282 3/2/95 Minor fixes. -v283 3/2/95 Fix homefile; make OS2 look in $HOME. -v284 3/2/95 Error if "v" on LESSOPENed file; - "%" figures out file size on pipe. -v285 3/7/95 Don't set # in lsystem; - lesskey try $HOME first. -v286 3/7/95 Reformat change history (too much free time?). -v287 3/8/95 Fix hilite bug if overstrike multiple chars. -v288 3/8/95 Allow lesskey to override get_editkey keys. -v289 3/9/95 Fix adj_hilite bug when line gets processed by - hilite_line more than once. -v290 3/9/95 Make configure automatically. Fix Sequent problem - with incompatible sigsetmask(). - Posted to prep.ai.mit.edu ------------------------------------------------------------------ -v291 3/21/95 Add #env to lesskey. Fix MS-DOS build. - Posted to simtel. ------------------------------------------------------------------ -v292 4/24/95 Add MS-DOS support for Borland C. - Fix arrow keys in MS-DOS versions. -v293 4/28/95 Add auto-versioning stuff to make dist. -v294 5/12/95 Fix Borland build. -v295 1/20/96 Fix search on squished file; add /@@. -v296 1/23/96 Allow cmdbuf larger than screen width. -v297 1/24/96 Don't call termcap if tgetent fails; - add #defines for buffers. -v298 1/24/96 Change @@ to ^K. - Add alternate search modifiers ^N, ^F, ^E. -v299 1/25/96 Fix percent overflow in jump_percent (thanks to Brent Wiese); - don't send "ti" after shell command till RETURN pressed. -v300 1/25/96 Change -U to print tabs as ^I. -v301 1/30/96 Make hilites work in cmd F output. -v302 1/31/96 Fix cmd F to notice window-change signals. -v303 1/31/96 Add ESC-SPACE command. -v304 2/1/96 Add ^R search modifier; add LESSSECURE. -v305 2/2/96 Workaround Linux /proc kernel bug; add LESSKEY. -v306 3/16/96 Minor fixes. -v307 3/25/96 Allow cmd line arg "--"; fix DOS & OS/2 defines.h. -v308 4/4/96 Port to OS-9 (thanks to Boisy Pitre); fix -d. -v309 4/9/96 Fix OS-9 version; fix tags bug with "$". -v310 4/10/96 Get rid of HELPFILE. -v311 4/22/96 Add Windows32 support; merge doscreen.c into screen.c. -v312 4/24/96 Don't quit after "cannot reopen" error. -v313 4/25/96 Added horizontal scrolling. -v314 4/26/96 Modified -e to quit on reaching end of a squished file. -v315 4/26/96 Fix "!;TAB" bug. -v316 5/2/96 Make "|a" when (a < curr screen) go to end of curr screen. -v317 5/14/96 Various fixes for the MS-DOS and OS/2 builds. - Added ## and %% handling for filenames -v318 5/29/96 Port to OS-9 Microware compiler; minor fixes - (thanks to Martin Gregorie). -v319 7/8/96 Fix Windows port (thanks to Jeff Paquette). -v320 7/11/96 Final fixes for Windows port. -v321 7/18/96 Minor fixes. - Posted to Web page. ------------------------------------------------------------------ -v322 8/13/96 Fix bug in shell escape from help file; add support for - Microsoft Visual C under Windows; numerous small fixes. -v323 8/19/96 Fixes for Windows version (thanks to Simon Munton); - fix for Linux library weirdness (thanks to Jim Diamond); - port to DJGPP (thanks to Eli Zaretskii). -v324 8/21/96 Add support for spaces in filenames (thanks to Simon Munton). -v325 8/21/96 Add lessecho, for spaces in filenames under Unix. -v326 8/27/96 Fix DJGPP version. -v327 9/1/96 Reorganize lglob, make spaces in filenames work better in Unix. -v328 10/7/96 Append / to directory name in filename completion. - Fix MS-DOS and OS-9 versions. -v329 10/11/96 Fix more MS-DOS bugs; add LESSSEPARATOR; add -" option. - Add LESSMETACHARS, LESSMETAESCAPE. -v330 10/21/96 Minor fixes. - Posted to Web page. ------------------------------------------------------------------ -v331 4/22/97 Various Windows fixes (thanks to Gurusamy Sarathy). -v332 4/22/97 Enter filenames from cmd line into edit history. - Posted to Web page. ------------------------------------------------------------------ -v333 3/4/99 Changed -w to highlite new line after forward movement. -v334 3/9/99 Avoid overflowing prompt buffer; add %d and %D. -v335 3/20/99 Add EBCDIC support (thanks to Thomas Dorner). - Use HOMEDRIVE/HOMEPATH on Windows (thanks to Preston Bannister). - Posted to Web page. ------------------------------------------------------------------ -v336 4/8/99 Fix installation bugs. -v337 4/9/99 Fix another installation bug. - Posted to Web page. ------------------------------------------------------------------ -v338 4/13/99 Add support for long option names. -v339 4/18/99 Add \k, long option names to lesskey. Add -^P. Add :d. -v340 4/21/99 Add regexec2. Fix Windows build. - Posted to Web page. ------------------------------------------------------------------ -v341 5/6/99 Add -F option; %c & ?c prompt escapes. - (Thanks to Michele Maltoni) -v342 7/22/99 Add system-wide lesskey file; allow GPL or Less License. -v343 9/23/99 Support UTF-8 (Thanks to Robert Brady). - Add %P and ?P in prompts. -v344 10/27/99 -w highlights target line of g and p commands. -v345 10/29/99 Make -R pass thru ESC but not other control chars. - Posted to Web page. ------------------------------------------------------------------ -v346 11/4/99 Fix bugs in long option processing; R cmd should clear hilites. - Posted to Web page. ------------------------------------------------------------------ -v347 12/13/99 Fixes for DJGPP version (thanks to Eli Zaretskii). -v348 12/28/99 Fix deleting file with marks (thanks to Dimitar Jekov). - Fix color problem in DJGPP version (thanks to Eli Zaretskii). -v349 1/24/00 Fix minor DJGPP bugs; check environment vars for UTF-8; - add --with-editor (thanks to Eli, Markus Kuhn, Thomas Schoepf). -v350 3/1/00 Fix clear-while-standout bug. -v351 3/5/00 Change -M and = prompts to show top & bottom line number. - Posted to Web page. ------------------------------------------------------------------ -v352 3/8/00 Fix scan_option NULL dereference. ------------------------------------------------------------------ -v353 3/20/00 Fix SECURE compile bug, allow space after numeric option. -v354 3/23/00 Add support for PCRE; add --with-regex configure option. ------------------------------------------------------------------ -v355 6/28/00 Add -# option (thanks to Andy Levinson). -v356 7/5/00 Add -J option. -v357 7/6/00 Support sigprocmask. ------------------------------------------------------------------ -v358 7/8/00 Fix problems with #stop in lesskey file. - Posted to Web page. ------------------------------------------------------------------ -v359 9/10/00 Fixes for Win32 display problems (thanks to Maurizio Vairani). -v360 1/17/01 Move sysless to etc. -v361 12/4/01 Add IBM-1047 charset & EBCDIC fixes (thanks to Thomas Dorner). - Fix 32 bit dependencies (thanks to Paul Eggert). - Fix UTF-8 overstriking (thanks to Robert Brady). -v362 12/4/01 Make status column show search targets. -v363 12/6/01 Add --no-keypad option. - Add variable width tabstops (thanks to Peter Samuelson). -v364 12/10/01 Better handling of very long lines in input; - Fix horizontal shifting of colored text. -v365 12/11/01 Fix overstriking of tabs; - Add support for global(1) and multiple tag matches - (thanks to Shigio Yamaguchi and Tim Vanderhoek). -v366 12/11/01 Fixes for OS/2 (thanks to Kyosuke Tokoro). -v367 12/13/01 Allow -D and -x options to terminate without dollar sign; - Right/left arrow when entering N are shift cmds, not line edit. -v368 12/18/01 Update lesskey commands. -v370 12/23/01 Fix tags error messages. - Posted to Web page. ------------------------------------------------------------------ -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. ------------------------------------------------------------------ -v382 2/3/04 Remove copyrighted code. ------------------------------------------------------------------ -v383 2/16/04 Add history file; add -K option; improve UTF-8 handling; - fix some signed char bugs (thanks to Christian Biere); - fix some upper/lower case bugs (thanks to Bjoern Jacke); - add erase2 char (thanks to David Lawrence); - add windows charset (thanks to Dimitar Zhekov). -v384 2/20/04 Improvements in UTF-8 handling. -v385 2/23/04 Fix UTF-8 output bug. ------------------------------------------------------------------ -v386 9/13/05 Improvements to UTF-8 shift & color (thanks to Charles Levert); - protect against invalid LESSOPEN and LESSCLOSE values. -v387 9/14/05 Update Charles Levert's UTF-8 patch. -v388 9/14/05 Change history behavior; change most sprintf calls to snprintf. -v389 9/14/05 Fix copy & paste with long lines; improve performance of - expand_linebuf; fix crash in init_mlist; -v390 9/15/05 Show search matches in status column even if -G is set. ------------------------------------------------------------------ -v391 9/17/05 Fix bugs. -v392 10/14/05 Fix line wrapping bug. -v393 10/19/05 Allow multiple attributes per char; fix bold+underline bug - (thanks again to Charles Levert). -v394 11/8/05 Fix prompt bug; fix compile problem in Windows build. -*/ - -char version[] = "394"; diff --git a/commands/less/less2netbsd b/commands/less/less2netbsd deleted file mode 100755 index 104bea7c0..000000000 --- a/commands/less/less2netbsd +++ /dev/null @@ -1,100 +0,0 @@ -#! /bin/sh -# -# $NetBSD: less2netbsd,v 1.8 2008/05/29 14:51:27 mrg Exp $ -# -# Copyright (c) 1996, 2003 Matthew R. Green -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. - -# less2netbsd: convert a less source tree into a netbsd less source -# tree, under src/usr.bin/less ready for importing. note that you need -# to run ./configure to generate defines.h (a bug in less 381's configure -# wrongly does not find sigset_t on NetBSD; correct this in defines.h.) - -if [ $# -ne 2 ]; then echo "less2netbsd src dest"; exit 1; fi - -r=$1 -d=$2/less - -case "$d" in - /*) - ;; - *) - d=`/bin/pwd`/$d - ;; -esac - -case "$r" in - /*) - ;; - *) - r=`/bin/pwd`/$r - ;; -esac - -echo preparing directory $d -rm -rf $d -mkdir -p $d; cd $d -mkdir -p src/usr.bin/less/less src/usr.bin/less/lesskey src/usr.bin/less/lessecho - -### start less ############################### -cd $r -echo less: -src="main.c screen.c brac.c ch.c charset.c cmdbuf.c command.c decode.c edit.c filename.c forwback.c help.c ifile.c input.c jump.c line.c linenum.c lsystem.c mark.c optfunc.c option.c opttbl.c os.c output.c position.c prompt.c search.c signal.c tags.c ttyin.c version.c" -src="$src charset.h cmd.h defines.h funcs.h less.h lesskey.h lglob.h option.h pckeys.h position.h regexp.h" -src="$src INSTALL LICENSE NEWS README less.nro" - -pax -rvw $src $d/src/usr.bin/less/less - -cd $d/src/usr.bin/less/less -mv less.nro less.1 - -### end less ############################### - -### start lesskey ############################### -cd $r -echo lesskey: -src='lesskey.c lesskey.h lesskey.nro' - -pax -rvw $src $d/src/usr.bin/less/lesskey - -cd $d/src/usr.bin/less/lesskey -mv lesskey.nro lesskey.1 - -### end lesskey ############################### - -### start lessecho ############################### -cd $r -echo lessecho: -src='lessecho.c' - -pax -rvw $src $d/src/usr.bin/less/lessecho - -### end lesskey ############################### - -find $d -name '*.[ch]' -print | while read c; do - chmod u+w $c -done - -echo done -exit 0 diff --git a/commands/less/lessecho/Makefile b/commands/less/lessecho/Makefile deleted file mode 100644 index 5e63d437d..000000000 --- a/commands/less/lessecho/Makefile +++ /dev/null @@ -1,10 +0,0 @@ -# $NetBSD: Makefile,v 1.3 2002/09/18 14:00:38 lukem Exp $ - -NOMAN= # defined - -PROG= lessecho -SRCS= lessecho.c version.c -CPPFLAGS+=-I${.CURDIR}/../less -.PATH: ${.CURDIR}/../less - -.include diff --git a/commands/less/lesskey/Makefile b/commands/less/lesskey/Makefile deleted file mode 100644 index 079e2b151..000000000 --- a/commands/less/lesskey/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -# $NetBSD: Makefile,v 1.5 1997/10/24 09:00:39 lukem Exp $ - -PROG= lesskey -SRCS= lesskey.c version.c -CPPFLAGS+=-I${.CURDIR}/../less - -.PATH: ${.CURDIR}/../less - -.include diff --git a/commands/less/lesskey/lesskey.h b/commands/less/lesskey/lesskey.h deleted file mode 100644 index 1734d2663..000000000 --- a/commands/less/lesskey/lesskey.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (C) 1984-2004 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. - */ - - -/* - * Format of a lesskey file: - * - * LESSKEY_MAGIC (4 bytes) - * sections... - * END_LESSKEY_MAGIC (4 bytes) - * - * Each section is: - * - * section_MAGIC (1 byte) - * section_length (2 bytes) - * key table (section_length bytes) - */ -#define C0_LESSKEY_MAGIC '\0' -#define C1_LESSKEY_MAGIC 'M' -#define C2_LESSKEY_MAGIC '+' -#define C3_LESSKEY_MAGIC 'G' - -#define CMD_SECTION 'c' -#define EDIT_SECTION 'e' -#define VAR_SECTION 'v' -#define END_SECTION 'x' - -#define C0_END_LESSKEY_MAGIC 'E' -#define C1_END_LESSKEY_MAGIC 'n' -#define C2_END_LESSKEY_MAGIC 'd' - -/* */ -#define KRADIX 64 diff --git a/distrib/sets/lists/minix/mi b/distrib/sets/lists/minix/mi index aa72999d8..57666c8ac 100644 --- a/distrib/sets/lists/minix/mi +++ b/distrib/sets/lists/minix/mi @@ -2130,6 +2130,7 @@ ./usr/man/man1/ld.elf_so.1 minix-sys ./usr/man/man1/leave.1 minix-sys ./usr/man/man1/less.1 minix-sys +./usr/man/man1/lessecho.1 minix-sys ./usr/man/man1/lesskey.1 minix-sys ./usr/man/man1/lex.1 minix-sys ./usr/man/man1/linkfarm.1 minix-sys diff --git a/external/bsd/Makefile b/external/bsd/Makefile index b4d6c4ef1..e7e135690 100644 --- a/external/bsd/Makefile +++ b/external/bsd/Makefile @@ -2,8 +2,10 @@ .include -SUBDIR= byacc file flex mdocml \ - libarchive +SUBDIR= byacc file flex less \ + libarchive mdocml \ + + .if (${MKATF} != "no") SUBDIR+= atf .endif diff --git a/external/bsd/less/Makefile b/external/bsd/less/Makefile new file mode 100644 index 000000000..cd3d2ca8a --- /dev/null +++ b/external/bsd/less/Makefile @@ -0,0 +1,7 @@ +# $NetBSD: Makefile,v 1.1 2011/07/03 18:02:00 tron Exp $ + +.include + +SUBDIR= bin + +.include diff --git a/external/bsd/less/Makefile.inc b/external/bsd/less/Makefile.inc new file mode 100644 index 000000000..f1c322fbe --- /dev/null +++ b/external/bsd/less/Makefile.inc @@ -0,0 +1,4 @@ +# $NetBSD: Makefile.inc,v 1.1 2011/07/03 18:02:00 tron Exp $ + +LESS_DISTDIR= ${NETBSDSRCDIR}/external/bsd/less/dist +.PATH: ${LESS_DISTDIR} diff --git a/external/bsd/less/bin/Makefile b/external/bsd/less/bin/Makefile new file mode 100644 index 000000000..997687607 --- /dev/null +++ b/external/bsd/less/bin/Makefile @@ -0,0 +1,7 @@ +# $NetBSD: Makefile,v 1.1 2011/07/03 18:02:01 tron Exp $ + +.include + +SUBDIR= less lessecho lesskey + +.include diff --git a/external/bsd/less/bin/Makefile.inc b/external/bsd/less/bin/Makefile.inc new file mode 100644 index 000000000..00f8f328f --- /dev/null +++ b/external/bsd/less/bin/Makefile.inc @@ -0,0 +1,7 @@ +# $NetBSD: Makefile.inc,v 1.1 2011/07/03 18:02:01 tron Exp $ + +.include "../Makefile.inc" + +BINDIR= /usr/bin + +CPPFLAGS+= -I${LESS_DISTDIR} -DBINDIR=\"${BINDIR}\" -DSYSDIR=\"/etc\" diff --git a/external/bsd/less/bin/less/Makefile b/external/bsd/less/bin/less/Makefile new file mode 100644 index 000000000..786531f1b --- /dev/null +++ b/external/bsd/less/bin/less/Makefile @@ -0,0 +1,20 @@ +# $NetBSD: Makefile,v 1.2 2011/07/03 18:15:18 tron Exp $ + +.include + +PROG= less + +SRCS= main.c screen.c brac.c ch.c charset.c cmdbuf.c \ + command.c cvt.c decode.c edit.c filename.c forwback.c \ + help.c ifile.c input.c jump.c line.c linenum.c \ + lsystem.c mark.c optfunc.c option.c opttbl.c os.c \ + output.c pattern.c position.c prompt.c search.c signal.c \ + tags.c ttyin.c version.c + +LDADD+= -lcurses -ltermcap +DPADD+= ${LIBCURSES} + +MLINKS= less.1 more.1 less.1 page.1 +LINKS= ${BINDIR}/less ${BINDIR}/more ${BINDIR}/less ${BINDIR}/page + +.include "bsd.prog.mk" diff --git a/external/bsd/less/bin/lessecho/Makefile b/external/bsd/less/bin/lessecho/Makefile new file mode 100644 index 000000000..6a5681894 --- /dev/null +++ b/external/bsd/less/bin/lessecho/Makefile @@ -0,0 +1,9 @@ +# $NetBSD: Makefile,v 1.1 2011/07/03 18:02:01 tron Exp $ + +.include + +PROG= lessecho + +SRCS= lessecho version.c + +.include "bsd.prog.mk" diff --git a/external/bsd/less/bin/lesskey/Makefile b/external/bsd/less/bin/lesskey/Makefile new file mode 100644 index 000000000..f20f56348 --- /dev/null +++ b/external/bsd/less/bin/lesskey/Makefile @@ -0,0 +1,12 @@ +# $NetBSD: Makefile,v 1.1 2011/07/03 18:02:01 tron Exp $ + +.include + +PROG= lesskey + +SRCS= lesskey version.c + +LDADD+= -ltermcap +DPADD+= ${LIBTERM} + +.include "bsd.prog.mk" diff --git a/external/bsd/less/dist/COPYING b/external/bsd/less/dist/COPYING new file mode 100644 index 000000000..94a9ed024 --- /dev/null +++ b/external/bsd/less/dist/COPYING @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/commands/less/less/INSTALL b/external/bsd/less/dist/INSTALL similarity index 100% rename from commands/less/less/INSTALL rename to external/bsd/less/dist/INSTALL diff --git a/commands/less/less/LICENSE b/external/bsd/less/dist/LICENSE similarity index 96% rename from commands/less/less/LICENSE rename to external/bsd/less/dist/LICENSE index 7e4887bcd..c7168e718 100644 --- a/commands/less/less/LICENSE +++ b/external/bsd/less/dist/LICENSE @@ -2,7 +2,7 @@ ------------ Less -Copyright (C) 1984-2005 Mark Nudelman +Copyright (C) 1984-2011 Mark Nudelman Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions diff --git a/external/bsd/less/dist/Makefile.aut b/external/bsd/less/dist/Makefile.aut new file mode 100644 index 000000000..b3ee3f463 --- /dev/null +++ b/external/bsd/less/dist/Makefile.aut @@ -0,0 +1,133 @@ +# Makefile for authoring less. + +EMAIL = markn@greenwoodsoftware.com +HOMEPAGE = http://www.greenwoodsoftware.com/less +SHELL = /bin/sh +RCS = rcs +NROFF = nroff -man + +srcdir = . + +SRC = \ + main.c screen.c brac.c ch.c charset.c cmdbuf.c \ + command.c cvt.c decode.c edit.c filename.c forwback.c \ + help.c ifile.c input.c jump.c line.c linenum.c \ + lsystem.c mark.c optfunc.c option.c opttbl.c os.c \ + output.c pattern.c position.c prompt.c search.c signal.c \ + tags.c ttyin.c version.c +DISTFILES_W = \ + defines.ds Makefile.dsb Makefile.dsg Makefile.dsu \ + defines.o2 Makefile.o2e \ + defines.o9 Makefile.o9c Makefile.o9u \ + defines.wn Makefile.wnm Makefile.wnb +DISTFILES = \ + ${SRC} regexp.c regexp.h \ + COPYING INSTALL LICENSE Makefile.in Makefile.aut NEWS README \ + configure configure.ac lesskey.c lessecho.c scrsize.c \ + charset.h cmd.h funcs.h lglob.h less.h lesskey.h option.h \ + pckeys.h pattern.h position.h \ + install.sh defines.h.in mkinstalldirs \ + less.nro less.man lesskey.nro lesskey.man lessecho.nro lessecho.man \ + less.hlp \ + mkfuncs.awk mkhelp.c \ + ${DISTFILES_W} + +all: help.c funcs.h ${srcdir}/configure + +release: .FORCE + ${MAKE} -f Makefile.aut tagall + ${MAKE} -f Makefile.aut all + ${MAKE} -f Makefile.aut clean + ${MAKE} -f Makefile.aut dist + +.FORCE: + +help.c: less.hlp mkhelp + -mv -f ${srcdir}/help.c ${srcdir}/help.c.old + rm -rf help.c + ./mkhelp < less.hlp > help.c + if cmp -s help.c help.c.old; then mv help.c.old help.c; fi + +mkhelp: mkhelp.c + ${CC} -o mkhelp mkhelp.c + +${srcdir}/configure: ${srcdir}/configure.ac \ + ${srcdir}/Makefile.in + cd ${srcdir}; autoheader; autoconf + +funcs.h: ${SRC:%=${srcdir}/%} + -mv -f ${srcdir}/funcs.h ${srcdir}/funcs.h.old + awk -f ${srcdir}/mkfuncs.awk ${SRC:%=${srcdir}/%} >${srcdir}/funcs.h + if cmp -s funcs.h funcs.h.old; then mv funcs.h.old funcs.h; fi + +lint: + lint -I. ${CPPFLAGS} ${SRC} + +clean: + rm -f Makefile config.status config.log config.cache defines.h stamp-h \ + README NEWS \ + less.nro less.man lesskey.nro lesskey.man lessecho.nro lessecho.man + +distclean: clean +realclean: clean + +REPLACE_VERSION = \ + @REL=`sed -e '/char version/!d' -e 's/[^0-9.]*\([0-9.]*\).*/\1/' -e q ${srcdir}/version.c`; \ + DT=`date '+%d %h %Y'`; \ + echo "Stuffing version number $$REL into $@"; \ + sed \ + -e "s;@@VERSION@@;$$REL;" \ + -e "s;@@DATE@@;$$DT;" \ + -e "s;@@EMAIL@@;${EMAIL};" \ + -e "s;@@HOMEPAGE@@;${HOMEPAGE};" >$@ + +${srcdir}/README: ${srcdir}/README.VER ${srcdir}/version.c + ${REPLACE_VERSION} ${srcdir}/README.VER +${srcdir}/NEWS: ${srcdir}/NEWS.VER ${srcdir}/version.c + ${REPLACE_VERSION} ${srcdir}/NEWS.VER +${srcdir}/less.nro: ${srcdir}/less.nro.VER ${srcdir}/version.c + ${REPLACE_VERSION} ${srcdir}/less.nro.VER +${srcdir}/lesskey.nro: ${srcdir}/lesskey.nro.VER ${srcdir}/version.c + ${REPLACE_VERSION} ${srcdir}/lesskey.nro.VER +${srcdir}/lessecho.nro: ${srcdir}/lessecho.nro.VER ${srcdir}/version.c + ${REPLACE_VERSION} ${srcdir}/lessecho.nro.VER +${srcdir}/less.hlp: ${srcdir}/less.hlp.VER ${srcdir}/version.c + ${REPLACE_VERSION} ${srcdir}/less.hlp.VER + +${srcdir}/less.man: ${srcdir}/less.nro + ${NROFF} ${srcdir}/less.nro >${srcdir}/less.man +${srcdir}/lesskey.man: ${srcdir}/lesskey.nro + ${NROFF} ${srcdir}/lesskey.nro >${srcdir}/lesskey.man +${srcdir}/lessecho.man: ${srcdir}/lessecho.nro + ${NROFF} ${srcdir}/lessecho.nro >${srcdir}/lessecho.man + + +distfiles: ${DISTFILES} + +dist: ${DISTFILES} + if [ ! -d ${srcdir}/release ]; then mkdir ${srcdir}/release; fi + @cd ${srcdir}; \ + REL=`sed -e '/char version/!d' -e 's/[^0-9.]*\([0-9.]*\).*/less-\1/' -e q version.c`; \ + rm -rf release/$$REL; mkdir release/$$REL; \ + echo "Preparing $$REL"; \ + rm -rf $$REL; mkdir $$REL; \ + for file in ${DISTFILES}; do \ + cp -p $$file $$REL; \ + chmod -w $$REL/$$file; \ + done; \ + cd $$REL; chmod +w ${DISTFILES_W}; cd ..; \ + echo "Creating release/$$REL/$$REL.tar.gz"; \ + tar -cf - $$REL | gzip -c >release/$$REL/$$REL.tar.gz; \ + echo "Signing release/$$REL/$$REL.tar.gz"; \ + gpg --detach-sign release/$$REL/$$REL.tar.gz; \ + echo "Creating release/$$REL/$$REL.zip"; \ + zip -rq release/$$REL/$$REL.zip $$REL; \ + rm -rf $$REL + +tagall: + @REL=`sed -e '/char version/!d' -e 's/[^0-9.]*\([0-9.]*\).*/v\1/' -e q ${srcdir}/version.c`; \ + echo "tagging $$REL"; \ + for f in ${srcdir}/RCS/*,v; do \ + REV=`co -p $$f 2>&1 | sed -e '1d' -e '3,$$d' -e 's/revision //'`; \ + ${RCS} -N$$REL:$$REV $$f; \ + done diff --git a/external/bsd/less/dist/Makefile.dsb b/external/bsd/less/dist/Makefile.dsb new file mode 100644 index 000000000..e45b6025c --- /dev/null +++ b/external/bsd/less/dist/Makefile.dsb @@ -0,0 +1,51 @@ +# Makefile for less. +# MS-DOS version (Borland C/C++ 4.02) + +#### Start of system configuration section. #### + +CC = bcc +LIBDIR = \bc\lib + +CFLAGS = -A- -mm -O2 -w- -1- -2- -a -d -Z +LDFLAGS = -mm +LIBS = +EXT = .EXE + +#### 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. $(CPPFLAGS) $(CFLAGS) $< + +OBJ = \ + main.obj screen.obj brac.obj ch.obj charset.obj cmdbuf.obj \ + command.obj cvt.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 pattern.obj position.obj prompt.obj search.obj signal.obj \ + tags.obj ttyin.obj version.obj + +all: less$(EXT) lesskey$(EXT) + +# This is really horrible, but the command line is too long for +# MS-DOS if we try to link $(OBJ). +less$(EXT): $(OBJ) + ren lesskey.obj lesskey.obo + $(CC) $(LDFLAGS) -e$@ *.obj $(LIBS) + ren lesskey.obo lesskey.obj + +lesskey$(EXT): lesskey.obj version.obj + $(CC) $(LDFLAGS) -e$@ 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 + diff --git a/external/bsd/less/dist/Makefile.dsg b/external/bsd/less/dist/Makefile.dsg new file mode 100644 index 000000000..b921b5dec --- /dev/null +++ b/external/bsd/less/dist/Makefile.dsg @@ -0,0 +1,92 @@ +# Makefile for less under DJGPP v2.0 or later. + +#### Start of system configuration section. #### + +srcdir = . +VPATH = . + +CC = gcc +INSTALL = ginstall -c +INSTALL_PROGRAM = ginstall +INSTALL_DATA = ginstall -m 644 +AWK = gawk + +CFLAGS = -O2 -g +CFLAGS_COMPILE_ONLY = -c +#LDFLAGS = -s +LDFLAGS = -g +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} -DBINDIR=\"${bindir}\" -DSYSDIR=\"${sysconfdir}\" ${CPPFLAGS} ${CFLAGS} $< + +OBJ = \ + main.${O} screen.${O} brac.${O} ch.${O} charset.${O} cmdbuf.${O} \ + command.${O} cvt.${O} decode.${O} edit.${O} filename.${O} forwback.${O} \ + help.${O} ifile.${O} input.${O} jump.${O} line.${O} linenum.${O} \ + lsystem.${O} mark.${O} optfunc.${O} option.${O} opttbl.${O} os.${O} \ + output.${O} pattern.${O} position.${O} prompt.${O} search.${O} signal.${O} \ + tags.${O} ttyin.${O} version.${O} + +all: less lesskey lessecho + +less: ${OBJ} + ${CC} ${LDFLAGS} -o $@ ${OBJ} ${LIBS} + +lesskey: lesskey.${O} version.${O} + ${CC} ${LDFLAGS} -o $@ lesskey.${O} version.${O} + +lessecho: lessecho.${O} version.${O} + ${CC} ${LDFLAGS} -o $@ lessecho.${O} version.${O} + +defines.h: defines.ds + command.com /c copy $< $@ + +${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: +dvi: +check: +installcheck: + +TAGS: + etags *.c *.h + +newfuncs: + command.com /c if exist funcs.h del funcs.h + ${AWK} -f mkfuncs.awk ${OBJ:.${O}=.c} > funcs.h + +clean: + command.com /c for %f in (*.${O} less lesskey lessecho *.exe) do if exist %f del %f + +mostlyclean: clean + +distclean: clean + command.com /c if not exist Makefile.dsg ren Makefile Makefile.dsg + command.com /c if not exist defines.ds ren defines.h defines.ds + command.com /c for %f in (Makefile defines.h) do if exist %f del %f + +realclean: distclean + command.com /c if exist TAGS del TAGS + diff --git a/external/bsd/less/dist/Makefile.dsu b/external/bsd/less/dist/Makefile.dsu new file mode 100644 index 000000000..40a253848 --- /dev/null +++ b/external/bsd/less/dist/Makefile.dsu @@ -0,0 +1,59 @@ +# 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 cvt.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 pattern.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 + diff --git a/external/bsd/less/dist/Makefile.in b/external/bsd/less/dist/Makefile.in new file mode 100644 index 000000000..8c8aed81e --- /dev/null +++ b/external/bsd/less/dist/Makefile.in @@ -0,0 +1,122 @@ +# Makefile for less. + +#### Start of system configuration section. #### + +srcdir = @srcdir@ +VPATH = @srcdir@ + +CC = @CC@ +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ + +CFLAGS = @CFLAGS@ +CFLAGS_COMPILE_ONLY = -c +LDFLAGS = @LDFLAGS@ +CPPFLAGS = @CPPFLAGS@ +EXEEXT = @EXEEXT@ +O=o + +LIBS = @LIBS@ + +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +# Where the installed binary goes. +bindir = @bindir@ +binprefix = + +sysconfdir = @sysconfdir@ +datarootdir = @datarootdir@ + +mandir = @mandir@ +manext = 1 +manprefix = +DESTDIR = + +#### End of system configuration section. #### + +SHELL = /bin/sh + +# 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} -DBINDIR=\"${bindir}\" -DSYSDIR=\"${sysconfdir}\" ${CPPFLAGS} ${CFLAGS} $< + +OBJ = \ + main.${O} screen.${O} brac.${O} ch.${O} charset.${O} cmdbuf.${O} \ + command.${O} cvt.${O} decode.${O} edit.${O} filename.${O} forwback.${O} \ + help.${O} ifile.${O} input.${O} jump.${O} line.${O} linenum.${O} \ + lsystem.${O} mark.${O} optfunc.${O} option.${O} opttbl.${O} os.${O} \ + output.${O} pattern.${O} position.${O} prompt.${O} search.${O} signal.${O} \ + tags.${O} ttyin.${O} version.${O} @REGEX_O@ + +all: less$(EXEEXT) lesskey$(EXEEXT) lessecho$(EXEEXT) + +less$(EXEEXT): ${OBJ} + ${CC} ${LDFLAGS} -o $@ ${OBJ} ${LIBS} + +lesskey$(EXEEXT): lesskey.${O} version.${O} + ${CC} ${LDFLAGS} -o $@ lesskey.${O} version.${O} + +lessecho$(EXEEXT): lessecho.${O} version.${O} + ${CC} ${LDFLAGS} -o $@ lessecho.${O} version.${O} + +${OBJ}: ${srcdir}/less.h ${srcdir}/funcs.h defines.h + +install: all ${srcdir}/less.nro ${srcdir}/lesskey.nro ${srcdir}/lessecho.nro installdirs + ${INSTALL_PROGRAM} less$(EXEEXT) ${DESTDIR}${bindir}/${binprefix}less$(EXEEXT) + ${INSTALL_PROGRAM} lesskey$(EXEEXT) ${DESTDIR}${bindir}/${binprefix}lesskey$(EXEEXT) + ${INSTALL_PROGRAM} lessecho$(EXEEXT) ${DESTDIR}${bindir}/${binprefix}lessecho$(EXEEXT) + ${INSTALL_DATA} ${srcdir}/less.nro ${DESTDIR}${mandir}/man${manext}/${manprefix}less.${manext} + ${INSTALL_DATA} ${srcdir}/lesskey.nro ${DESTDIR}${mandir}/man${manext}/${manprefix}lesskey.${manext} + ${INSTALL_DATA} ${srcdir}/lessecho.nro ${DESTDIR}${mandir}/man${manext}/${manprefix}lessecho.${manext} + +install-strip: + ${MAKE} INSTALL_PROGRAM='${INSTALL_PROGRAM} -s' install + +installdirs: mkinstalldirs + ${srcdir}/mkinstalldirs ${DESTDIR}${bindir} ${DESTDIR}${mandir}/man${manext} + +uninstall: + rm -f ${DESTDIR}${bindir}/${binprefix}less$(EXEEXT) + rm -f ${DESTDIR}${bindir}/${binprefix}lesskey$(EXEEXT) + rm -f ${DESTDIR}${bindir}/${binprefix}lessecho$(EXEEXT) + rm -f ${DESTDIR}${mandir}/man${manext}/${manprefix}less.${manext} + rm -f ${DESTDIR}${mandir}/man${manext}/${manprefix}lesskey.${manext} + rm -f ${DESTDIR}${mandir}/man${manext}/${manprefix}lessecho.${manext} + +info: +install-info: +dvi: +check: +installcheck: + +TAGS: + cd ${srcdir} && etags *.c *.h + +# config.status might not change defines.h +# Don't rerun config.status if we just configured (so there's no stamp-h). +defines.h: stamp-h +stamp-h: defines.h.in config.status + test ! -f stamp-h || CONFIG_FILES= CONFIG_HEADERS=defines.h ./config.status + touch stamp-h +Makefile: ${srcdir}/Makefile.in config.status + CONFIG_FILES=Makefile CONFIG_HEADERS= ./config.status +config.status: ${srcdir}/configure + ./config.status --recheck + +${srcdir}/configure: ${srcdir}/configure.ac + cd ${srcdir}; autoheader; autoconf + +clean: + rm -f *.${O} core less$(EXEEXT) lesskey$(EXEEXT) lessecho$(EXEEXT) + +mostlyclean: clean + +distclean: clean + rm -f Makefile config.status config.log config.cache defines.h stamp-h + +realclean: distclean + rm -f TAGS + diff --git a/external/bsd/less/dist/Makefile.o2e b/external/bsd/less/dist/Makefile.o2e new file mode 100644 index 000000000..3bb6dfc4e --- /dev/null +++ b/external/bsd/less/dist/Makefile.o2e @@ -0,0 +1,43 @@ +# Makefile for less. +# OS/2 version, for emx+gcc compiler + +#### Start of system configuration section. #### + +CC = gcc -Zomf +CFLAGS = -I. -O2 -Wall +LDFLAGS = -s -Zcrtdll +LIBS = -ltermcap +O = obj + +#### End of system configuration section. #### + +.SUFFIXES: .c .${O} + +# This rule allows us to supply the necessary -D options +# in addition to whatever the user asks for. +.c.${O}: + ${CC} -c ${CPPFLAGS} ${CFLAGS} $< + +OBJ = \ + main.${O} screen.${O} brac.${O} ch.${O} charset.${O} cmdbuf.${O} \ + command.${O} cvt.${O} decode.${O} edit.${O} filename.${O} forwback.${O} \ + help.${O} ifile.${O} input.${O} jump.${O} line.${O} linenum.${O} \ + lsystem.${O} mark.${O} optfunc.${O} option.${O} opttbl.${O} os.${O} \ + output.${O} pattern.${O} position.${O} prompt.${O} search.${O} signal.${O} \ + tags.${O} ttyin.${O} version.${O} regexp.${O} + +all: less.exe lesskey.exe scrsize.exe + +less.exe: ${OBJ} + ${CC} ${OBJ} -o $@ ${LDFLAGS} ${LIBS} + +lesskey.exe: lesskey.${O} version.${O} + ${CC} lesskey.${O} version.${O} -o $@ ${LDFLAGS} + +scrsize.exe: scrsize.c + ${CC} ${CFLAGS} -D__ST_MT_ERRNO__ -s -Zmtd -lX11 $< + +${OBJ}: defines.h less.h + +defines.h: defines.o2 + copy defines.o2 defines.h diff --git a/external/bsd/less/dist/Makefile.o9c b/external/bsd/less/dist/Makefile.o9c new file mode 100644 index 000000000..e107f5594 --- /dev/null +++ b/external/bsd/less/dist/Makefile.o9c @@ -0,0 +1,47 @@ +# Makefile for less. +# OS-9 version for Microware C 3.2. + +#### Start of system configuration section. #### + +CC = cc +CPPFLAGS = -D_OSK_MWC32 -DDEBUG=0 -DSTRCSPN +CFLAGS = -k=0 -v=. +CFLAGS_COMPILE_ONLY = -r +LDFLAGS = -igm=8 +LIBS = -l=/dd/lib/termlib.l +O = r + + +#### End of system configuration section. #### + +.SUFFIXES: .c .${O} + +# This rule allows us to supply the necessary -D options +# in addition to whatever the user asks for. + +.c.${O}: + ${CC} ${CFLAGS_COMPILE_ONLY} ${CPPFLAGS} ${CFLAGS} $< + +OBJ = \ + main.${O} screen.${O} brac.${O} ch.${O} charset.${O} cmdbuf.${O} \ + command.${O} cvt.${O} decode.${O} edit.${O} filename.${O} forwback.${O} \ + help.${O} ifile.${O} input.${O} jump.${O} line.${O} linenum.${O} \ + lsystem.${O} mark.${O} optfunc.${O} option.${O} opttbl.${O} os.${O} \ + output.${O} pattern.${O} position.${O} prompt.${O} search.${O} signal.${O} \ + tags.${O} ttyin.${O} version.${O} regexp.${O} + +all: less lessecho lesskey + +less: ${OBJ} + ${CC} ${OBJ} -f=$@ ${LDFLAGS} ${LIBS} + +lesskey: lesskey.${O} version.${O} + ${CC} lesskey.${O} version.${O} -f=$@ ${LDFLAGS} + +lessecho: lessecho.${O} version.${O} + ${CC} lessecho.${O} version.${O} -f=$@ ${LDFLAGS} + +${OBJ}: defines.h less.h + +defines.h: defines.o9 + copy defines.o9 defines.h -rf diff --git a/external/bsd/less/dist/Makefile.o9u b/external/bsd/less/dist/Makefile.o9u new file mode 100644 index 000000000..8ca84c897 --- /dev/null +++ b/external/bsd/less/dist/Makefile.o9u @@ -0,0 +1,43 @@ +# Makefile for less. +# OS-9 version for Ultra C. + +#### Start of system configuration section. #### + +CC = cc +CPPFLAGS = +CFLAGS = -v=. +CFLAGS_COMPILE_ONLY = -eas +LDFLAGS = -olM=24k +LIBS = -ltermlib.l -lsys_clib.l -lunix.l +O = r + + +#### End of system configuration section. #### + +.SUFFIXES: .c .${O} + +# This rule allows us to supply the necessary -D options +# in addition to whatever the user asks for. +.c.${O}: + ${CC} ${CFLAGS_COMPILE_ONLY} ${CPPFLAGS} ${CFLAGS} $< + +OBJ = \ + main.${O} screen.${O} brac.${O} ch.${O} charset.${O} cmdbuf.${O} \ + command.${O} cvt.${O} decode.${O} edit.${O} filename.${O} forwback.${O} \ + help.${O} ifile.${O} input.${O} jump.${O} line.${O} linenum.${O} \ + lsystem.${O} mark.${O} optfunc.${O} option.${O} opttbl.${O} os.${O} \ + output.${O} pattern.${O} position.${O} prompt.${O} search.${O} signal.${O} \ + tags.${O} ttyin.${O} version.${O} regexp.${O} + +all: less lesskey + +less: ${OBJ} + ${CC} ${OBJ} -f=$@ ${LDFLAGS} ${LIBS} + +lesskey: lesskey.${O} version.${O} + ${CC} lesskey.${O} version.${O} -f=$@ ${LDFLAGS} + +${OBJ}: defines.h less.h + +defines.h: defines.o9 + copy defines.o9 defines.h -rf diff --git a/external/bsd/less/dist/Makefile.wnb b/external/bsd/less/dist/Makefile.wnb new file mode 100644 index 000000000..75a65cdd2 --- /dev/null +++ b/external/bsd/less/dist/Makefile.wnb @@ -0,0 +1,71 @@ +# Makefile for less. +# Windows version +# Bolarnd C++ 5.5.1 free command line tools + +#### Start of system configuration section. #### +# +# Borland's make knows its own location in the +# filesystem. +# + +CC = bcc32 +LIBDIR = $(MAKEDIR)\..\lib + +CFLAGS = -O2 -w-pro -TWC -P-c -v- -d -f- -ff- -vi +LDFLAGS = -Tpe -v- -ap -c -x -V4.0 -GF:AGGRESSIVE +LD = ilink32 +LIBS = ${LIBDIR}\import32.lib ${LIBDIR}\cw32.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. ${CPPFLAGS} ${CFLAGS} $< + +OBJ = \ + main.obj screen.obj brac.obj ch.obj charset.obj cmdbuf.obj \ + command.obj cvt.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 pattern.obj position.obj prompt.obj search.obj signal.obj \ + tags.obj ttyin.obj version.obj regexp.obj + +all: less lesskey lessecho + +# +# This is really horrible, but the command line is too long for +# MS-DOS if we try to link ${OBJ}. +# +less: ${OBJ} + ${LD} ${LDFLAGS} ${LIBDIR}\c0x32.obj $**, $@,,${LIBS} + +lesskey: lesskey.obj version.obj + ${LD} ${LDFLAGS} ${LIBDIR}\c0x32.obj $**, $@,,${LIBS} + +lessecho: lessecho.obj version.obj + ${LD} ${LDFLAGS} ${LIBDIR}\c0x32.obj $**, $@,,${LIBS} + +defines.h: defines.wn + -del defines.h + -copy defines.wn defines.h + +${OBJ}: less.h defines.h funcs.h cmd.h + +clean: + -del *.obj + -del *.il? + -del *.tds + -del defines.h + +spotless: clean + -del less.exe + -del lesskey.exe + -del lessecho.exe + +realclean: spotless + +distclean: spotless + diff --git a/external/bsd/less/dist/Makefile.wnm b/external/bsd/less/dist/Makefile.wnm new file mode 100644 index 000000000..7b3383383 --- /dev/null +++ b/external/bsd/less/dist/Makefile.wnm @@ -0,0 +1,56 @@ +# Makefile for less. +# Windows 32 Visual C++ version + +#### Start of system configuration section. #### + +CC = cl + +# Normal flags +CFLAGS = /nologo /ML /W3 /GX /O2 /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c +LDFLAGS = /nologo /subsystem:console /incremental:no /machine:I386 + +# Debugging flags +#CFLAGS = /nologo /MDd /W3 /GX /Od /Gm /Zi /I "." /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /c +#LDFLAGS = /nologo /subsystem:console /incremental:yes /debug /machine:I386 + +LD = link +LIBS = user32.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) $(CFLAGS) $< + +OBJ = \ + main.obj screen.obj brac.obj ch.obj charset.obj cmdbuf.obj \ + command.obj cvt.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 pattern.obj position.obj prompt.obj search.obj signal.obj \ + tags.obj ttyin.obj version.obj regexp.obj + +all: less.exe lesskey.exe + +# This is really horrible, but the command line is too long for +# MS-DOS if we try to link ${OBJ}. +less.exe: $(OBJ) + -del lesskey.obj + $(LD) $(LDFLAGS) *.obj $(LIBS) /out:$@ + +lesskey.exe: lesskey.obj version.obj + $(LD) $(LDFLAGS) lesskey.obj version.obj $(LIBS) /out:$@ + +defines.h: defines.wn + -del defines.h + -copy defines.wn defines.h + +$(OBJ): less.h defines.h funcs.h cmd.h + +clean: + -del *.obj + -del less.exe + -del lesskey.exe + + diff --git a/commands/less/less/NEWS b/external/bsd/less/dist/NEWS similarity index 78% rename from commands/less/less/NEWS rename to external/bsd/less/dist/NEWS index 4a532f472..eb38025cb 100644 --- a/commands/less/less/NEWS +++ b/external/bsd/less/dist/NEWS @@ -7,10 +7,191 @@ http://www.greenwoodsoftware.com/less You can also download the latest version of less from there. - To report bugs, suggestions or comments, send email to bug-less@gnu.org. + To report bugs, suggestions or comments, send email to + bug-less@gnu.org or markn@greenwoodsoftware.com. ====================================================================== + Major changes between "less" versions 443 and 444 + +* Fix bug in unget handling that can cause strange effects on the + command line. + +* Remove vestiges of obsolete -l option that can cause a crash. + +====================================================================== + + Major changes between "less" versions 436 and 443 + +* Change search behavior such that when a search is given an explicit + pattern, the entire displayed screen is included in the search and + not just the portion after the target line. + +* Add -A option to change search behavior to the old way: only + the portion of the screen after the target line is searched. + +* Add %F formatting to prompt strings, replaced by the last component + of the input file. + +* Control-G while editing a command exits the command. + +* Less now exits with status 2 if control-C is pressed and -K is in effect. + +* Fix "ungetc overflow" when passing long commands via the -p option. + +* Fix bug in using line filtering via the & command + in combination with -i and -I. + +* Fix bug in handling negative arguments to the -j option. + +* Fix bug in handling %t in prompt strings. + +* Improve handling of long option names. + +* Improve percentage calculation for very large files. + +====================================================================== + + Major changes between "less" versions 429 and 436 + +* Don't pass "-" to non-pipe LESSOPEN unless it starts with "-". + +* Allow a fraction as the argument to the -# (--shift) option. + +* Fix highlight bug when underlined/overstruck text matches at end of line. + +* Fix non-regex searches with ctrl-R. + +====================================================================== + + Major changes between "less" versions 424 and 429 + +* LESSOPEN pipe will now be used on standard input, if the LESSOPEN + environment variable begins with "|-". + +* The -D option with one number now means use the normal background color. + +* Don't change permissions on history file if it is not a regular file. + +* Fix non-ANSI-compliant code that caused problems with some compilers. + +* Fix binary file detection in UTF-8 mode. + +* Fix display problems with long lines on "ignaw" terminals. + +* Fix problem interrupting the line number calculation for initial prompt. + +* Fix SGR emulation when dealing with multiple attributes (eg. bold+underline). + +* Fix highlight bug when searching for underlined/overstruck text. + +====================================================================== + + Major changes between "less" versions 418 and 424 + +* New "&" command allows filtering of lines based on a pattern. + +* Status column now displays a search match, even if the matched + string is scrolled off screen because -S is in effect. + +* Improve behavior of -F option. + +* Allow CSI character (0x9B) to work in UTF-8 mode. + +* Output carriage return at startup in case terminal doesn't default + to column 1. + +* Fix bug in '' (quote, quote) command after G command. + +====================================================================== + + Major changes between "less" versions 416 and 418 + +* Color escape sequences are now supported in WIN32 build. + +* Makefile now uses EXEEXT feature of autoconf. + +* Fix search bug when using -R and text contains ANSI color escape sequences. + +* Fix crash when using -r with UTF-8 text containing 0x9B bytes. + +* Fix display bug when using ' command to move less than one page forward. + +* Update GPL to version 3. + +====================================================================== + + Major changes between "less" versions 409 and 416 + +* New --follow-name option makes F command follow the name of a file + rather than the file descriptor if an open file is renamed. + +* Make searching with -i/-I work correctly with non-ASCII text. + +* Fix DJGPP build. + +====================================================================== + + Major changes between "less" versions 406 and 409 + +* Support CSI escape sequences, like SGR escape sequences. + +* Fix bug which caused screen to fail to repaint when window is resized. + +* Fix bug in using -i and -I flags with non-ASCII text. + +* Fix configure bug on systems which don't support langinfo.h. + +* Fix crash when searching text containing certain invalid UTF-8 sequences. + +====================================================================== + + Major changes between "less" versions 394 and 406 + +* Allow decimal point in number for % (percent) command. + +* Allow decimal point in number for -j option (fraction of screen height). + +* Make n command fetch previous pattern from history file on first search. + +* Don't rewrite history file if it has not changed. + +* Don't move to bottom of screen on first page. + +* Don't output extraneous newlines, so copy & pasting lines from the + output works better. + +* The -c option has been made identical with the -C option. + +* Allow "/dev/null" as synomym for "-" in LESSHISTFILE to indicate + that no history file should be used. + +* Search can now find text which follows a null byte, if the PCRE + library is used, or if no-regex searching (ctrl-R) is used. + +* Better compatibility with POSIX more specification. + +* Make -f work for directories. + +* Make "t" cmd traverse tags in the correct order. + +* Allow a few binary characters in the input file before warning + that the file is binary. + +* Don't warn that file is binary if it merely contains ANSI color sequences + and -R is in effect. + +* Update Unicode character tables. + +* Support DESTDIR in Makefile. + +* Fix bug when filename contains certain shell metacharacters such as "$". + +* Fix bug when resizing the window while waiting for input from a pipe. + +* Fix configure bugs. + +====================================================================== Major changes between "less" versions 382 and 394 @@ -632,3 +813,8 @@ * Lesskey files may now include characters after the action as extra input to be parsed after the action; for example: "toggle-option X" to toggle a specific option X. + + + + + diff --git a/commands/less/less/README b/external/bsd/less/dist/README similarity index 96% rename from commands/less/less/README rename to external/bsd/less/dist/README index ce014e485..c4cfa63ef 100644 --- a/commands/less/less/README +++ b/external/bsd/less/dist/README @@ -1,26 +1,20 @@ - Less, version 394 + Less, version 444 - This is the distribution of less, version 394, released 03 Dec 2005. + This is the distribution of less, version 444, released 09 Jun 2011. This program is part of the GNU project (http://www.gnu.org). This program is free software. You may redistribute it and/or modify it under the terms of either: 1. The GNU General Public License, as published by the Free - Software Foundation; either version 2, or (at your option) any + Software Foundation; either version 3, or (at your option) any later version. A copy of this license is in the file COPYING. or 2. The Less License, in the file LICENSE. Please report any problems to bug-less@gnu.org or markn@greenwoodsoftware.com. See http://www.greenwoodsoftware.com/less for the latest info. - You may also contact the author at: - Mark Nudelman - Greenwood Software - PO Box 2402 - El Granada, CA 94018 - USA ========================================================================= @@ -46,6 +40,7 @@ INSTALLATION (Unix systems only): --with-editor=program Specifies the default editor program used by the "v" command. The default is "vi". + --with-regex=lib Specifies the regular expression library used by less for pattern matching. The default is "auto", which means the configure program @@ -62,6 +57,7 @@ INSTALLATION (Unix systems only): to prevent users from viewing other files, accessing shell commands, etc. + 3. It is a good idea to look over the generated Makefile and defines.h and make sure they look ok. If you know of any peculiarities of your system that configure might not have detected, you may fix the @@ -97,6 +93,10 @@ complaints, etc., you may mail to the author at markn@greenwoodsoftware.com. Note to hackers: comments noting possible improvements are enclosed in double curly brackets {{ like this }}. +(Note that the above note was originally written at a time when +"hackers" most commonly meant "enthusiastic and dedicated computer +programmers", not "persons who attempt to circumvent computer security".) + ======================================================================= diff --git a/commands/less/less/brac.c b/external/bsd/less/dist/brac.c similarity index 95% rename from commands/less/less/brac.c rename to external/bsd/less/dist/brac.c index e8521e783..d8c31606a 100644 --- a/commands/less/less/brac.c +++ b/external/bsd/less/dist/brac.c @@ -1,7 +1,7 @@ -/* $NetBSD: brac.c,v 1.6 2006/10/26 01:33:08 mrg Exp $ */ +/* $NetBSD: brac.c,v 1.3 2011/07/03 20:14:12 tron Exp $ */ /* - * Copyright (C) 1984-2004 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/commands/less/less/ch.c b/external/bsd/less/dist/ch.c similarity index 72% rename from commands/less/less/ch.c rename to external/bsd/less/dist/ch.c index 5ccad6830..d4f1f1a36 100644 --- a/commands/less/less/ch.c +++ b/external/bsd/less/dist/ch.c @@ -1,7 +1,7 @@ -/* $NetBSD: ch.c,v 1.8 2006/10/26 01:33:08 mrg Exp $ */ +/* $NetBSD: ch.c,v 1.3 2011/07/03 20:14:12 tron Exp $ */ /* - * Copyright (C) 1984-2004 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -23,6 +23,12 @@ #include #endif +#if HAVE_STAT_INO +#include +extern dev_t curr_dev; +extern ino_t curr_ino; +#endif + typedef POSITION BLOCKNUM; public int ignore_eoi; @@ -33,20 +39,19 @@ public int ignore_eoi; * in order from most- to least-recently used. * The circular list is anchored by the file state "thisfile". */ +struct bufnode { + struct bufnode *next, *prev; + struct bufnode *hnext, *hprev; +}; + #define LBUFSIZE 8192 struct buf { - struct buf *next, *prev; - struct buf *hnext, *hprev; + struct bufnode node; BLOCKNUM block; unsigned int datasize; unsigned char data[LBUFSIZE]; }; - -struct buflist { - /* -- Following members must match struct buf */ - struct buf *buf_next, *buf_prev; - struct buf *buf_hnext, *buf_hprev; -}; +#define bufnode_buf(bn) ((struct buf *) bn) /* * The file state is maintained in a filestate structure. @@ -54,8 +59,8 @@ struct buflist { */ #define BUFHASH_SIZE 64 struct filestate { - struct buf *buf_next, *buf_prev; - struct buflist hashtbl[BUFHASH_SIZE]; + struct bufnode buflist; + struct bufnode hashtbl[BUFHASH_SIZE]; int file; int flags; POSITION fpos; @@ -65,8 +70,8 @@ struct filestate { POSITION fsize; }; -#define ch_bufhead thisfile->buf_next -#define ch_buftail thisfile->buf_prev +#define ch_bufhead thisfile->buflist.next +#define ch_buftail thisfile->buflist.prev #define ch_nbufs thisfile->nbufs #define ch_block thisfile->block #define ch_offset thisfile->offset @@ -75,23 +80,48 @@ struct filestate { #define ch_flags thisfile->flags #define ch_file thisfile->file -#define END_OF_CHAIN ((struct buf *)&thisfile->buf_next) -#define END_OF_HCHAIN(h) ((struct buf *)&thisfile->hashtbl[h]) +#define END_OF_CHAIN (&thisfile->buflist) +#define END_OF_HCHAIN(h) (&thisfile->hashtbl[h]) #define BUFHASH(blk) ((blk) & (BUFHASH_SIZE-1)) -#define FOR_BUFS_IN_CHAIN(h,bp) \ - for (bp = thisfile->hashtbl[h].buf_hnext; \ - bp != END_OF_HCHAIN(h); bp = bp->hnext) +/* + * Macros to manipulate the list of buffers in thisfile->buflist. + */ +#define FOR_BUFS(bn) \ + for (bn = ch_bufhead; bn != END_OF_CHAIN; bn = bn->next) -#define HASH_RM(bp) \ - (bp)->hnext->hprev = (bp)->hprev; \ - (bp)->hprev->hnext = (bp)->hnext; +#define BUF_RM(bn) \ + (bn)->next->prev = (bn)->prev; \ + (bn)->prev->next = (bn)->next; -#define HASH_INS(bp,h) \ - (bp)->hnext = thisfile->hashtbl[h].buf_hnext; \ - (bp)->hprev = END_OF_HCHAIN(h); \ - thisfile->hashtbl[h].buf_hnext->hprev = (bp); \ - thisfile->hashtbl[h].buf_hnext = (bp); +#define BUF_INS_HEAD(bn) \ + (bn)->next = ch_bufhead; \ + (bn)->prev = END_OF_CHAIN; \ + ch_bufhead->prev = (bn); \ + ch_bufhead = (bn); + +#define BUF_INS_TAIL(bn) \ + (bn)->next = END_OF_CHAIN; \ + (bn)->prev = ch_buftail; \ + ch_buftail->next = (bn); \ + ch_buftail = (bn); + +/* + * Macros to manipulate the list of buffers in thisfile->hashtbl[n]. + */ +#define FOR_BUFS_IN_CHAIN(h,bn) \ + for (bn = thisfile->hashtbl[h].hnext; \ + bn != END_OF_HCHAIN(h); bn = bn->hnext) + +#define BUF_HASH_RM(bn) \ + (bn)->hnext->hprev = (bn)->hprev; \ + (bn)->hprev->hnext = (bn)->hnext; + +#define BUF_HASH_INS(bn,h) \ + (bn)->hnext = thisfile->hashtbl[h].hnext; \ + (bn)->hprev = END_OF_HCHAIN(h); \ + thisfile->hashtbl[h].hnext->hprev = (bn); \ + thisfile->hashtbl[h].hnext = (bn); static struct filestate *thisfile; static int ch_ungotchar = -1; @@ -100,6 +130,8 @@ static int maxbufs = -1; extern int autobuf; extern int sigs; extern int secure; +extern int screen_trashed; +extern int follow_mode; extern constant char helpdata[]; extern constant int size_helpdata; extern IFILE curr_ifile; @@ -115,69 +147,84 @@ static void ch_delbufs __P((void)); /* * Get the character pointed to by the read pointer. - * ch_get() is a macro which is more efficient to call - * than fch_get (the function), in the usual case - * that the block desired is at the head of the chain. */ -#define ch_get() ((ch_block == ch_bufhead->block && \ - ch_offset < ch_bufhead->datasize) ? \ - ch_bufhead->data[ch_offset] : fch_get()) int -fch_get() +ch_get() { register struct buf *bp; + register struct bufnode *bn; register int n; register int slept; register int h; POSITION pos; POSITION len; + if (thisfile == NULL) + return (EOI); + + /* + * Quick check for the common case where + * the desired char is in the head buffer. + */ + if (ch_bufhead != END_OF_CHAIN) + { + bp = bufnode_buf(ch_bufhead); + if (ch_block == bp->block && ch_offset < bp->datasize) + return bp->data[ch_offset]; + } + slept = FALSE; /* * Look for a buffer holding the desired block. */ h = BUFHASH(ch_block); - FOR_BUFS_IN_CHAIN(h, bp) + FOR_BUFS_IN_CHAIN(h, bn) { + bp = bufnode_buf(bn); if (bp->block == ch_block) { if (ch_offset >= bp->datasize) /* * Need more data in this buffer. */ - goto read_more; + break; goto found; } } - /* - * Block is not in a buffer. - * Take the least recently used buffer - * and read the desired block into it. - * If the LRU buffer has data in it, - * then maybe allocate a new buffer. - */ - if (ch_buftail == END_OF_CHAIN || ch_buftail->block != -1) + if (bn == END_OF_HCHAIN(h)) { /* - * There is no empty buffer to use. - * Allocate a new buffer if: - * 1. We can't seek on this file and -b is not in effect; or - * 2. We haven't allocated the max buffers for this file yet. + * Block is not in a buffer. + * Take the least recently used buffer + * and read the desired block into it. + * If the LRU buffer has data in it, + * then maybe allocate a new buffer. */ - if ((autobuf && !(ch_flags & CH_CANSEEK)) || - (maxbufs < 0 || ch_nbufs < maxbufs)) - if (ch_addbuf()) - /* - * Allocation failed: turn off autobuf. - */ - autobuf = OPT_OFF; + if (ch_buftail == END_OF_CHAIN || + bufnode_buf(ch_buftail)->block != -1) + { + /* + * There is no empty buffer to use. + * Allocate a new buffer if: + * 1. We can't seek on this file and -b is not in effect; or + * 2. We haven't allocated the max buffers for this file yet. + */ + if ((autobuf && !(ch_flags & CH_CANSEEK)) || + (maxbufs < 0 || ch_nbufs < maxbufs)) + if (ch_addbuf()) + /* + * Allocation failed: turn off autobuf. + */ + autobuf = OPT_OFF; + } + bn = ch_buftail; + bp = bufnode_buf(bn); + BUF_HASH_RM(bn); /* Remove from old hash chain. */ + bp->block = ch_block; + bp->datasize = 0; + BUF_HASH_INS(bn, h); /* Insert into new hash chain. */ } - bp = ch_buftail; - HASH_RM(bp); /* Remove from old hash chain. */ - bp->block = ch_block; - bp->datasize = 0; - HASH_INS(bp, h); /* Insert into new hash chain. */ read_more: pos = (ch_block * LBUFSIZE) + bp->datasize; @@ -196,7 +243,7 @@ fch_get() */ if (!(ch_flags & CH_CANSEEK)) return ('?'); - if (lseek(ch_file, (off_t)pos, 0) == BAD_LSEEK) + if (lseek(ch_file, (off_t)pos, SEEK_SET) == BAD_LSEEK) { error("seek error", NULL_PARG); clear_eol(); @@ -277,30 +324,45 @@ fch_get() #endif #endif slept = TRUE; + +#if HAVE_STAT_INO + if (follow_mode == FOLLOW_NAME) + { + /* See whether the file's i-number has changed. + * If so, force the file to be closed and + * reopened. */ + struct stat st; + int r = stat(get_filename(curr_ifile), &st); + if (r == 0 && (st.st_ino != curr_ino || + st.st_dev != curr_dev)) + { + /* screen_trashed=2 causes + * make_display to reopen the file. */ + screen_trashed = 2; + return (EOI); + } + } +#endif } if (sigs) return (EOI); } found: - if (ch_bufhead != bp) + if (ch_bufhead != bn) { /* * Move the buffer to the head of the buffer chain. * This orders the buffer chain, most- to least-recently used. */ - bp->next->prev = bp->prev; - bp->prev->next = bp->next; - bp->next = ch_bufhead; - bp->prev = END_OF_CHAIN; - ch_bufhead->prev = bp; - ch_bufhead = bp; + BUF_RM(bn); + BUF_INS_HEAD(bn); /* * Move to head of hash chain too. */ - HASH_RM(bp); - HASH_INS(bp, h); + BUF_HASH_RM(bn); + BUF_HASH_INS(bn, h); } if (ch_offset >= bp->datasize) @@ -360,6 +422,7 @@ end_logfile() sync_logfile() { register struct buf *bp; + register struct bufnode *bn; int warned = FALSE; BLOCKNUM block; BLOCKNUM nblocks; @@ -367,24 +430,23 @@ sync_logfile() nblocks = (ch_fpos + LBUFSIZE - 1) / LBUFSIZE; for (block = 0; block < nblocks; block++) { - for (bp = ch_bufhead; ; bp = bp->next) + int wrote = FALSE; + FOR_BUFS(bn) { - if (bp == END_OF_CHAIN) - { - if (!warned) - { - error("Warning: log file is incomplete", - NULL_PARG); - warned = TRUE; - } - break; - } + bp = bufnode_buf(bn); if (bp->block == block) { write(logfile, (char *) bp->data, bp->datasize); + wrote = TRUE; break; } } + if (!wrote && !warned) + { + error("Warning: log file is incomplete", + NULL_PARG); + warned = TRUE; + } } } @@ -398,11 +460,13 @@ buffered(block) BLOCKNUM block; { register struct buf *bp; + register struct bufnode *bn; register int h; h = BUFHASH(block); - FOR_BUFS_IN_CHAIN(h, bp) + FOR_BUFS_IN_CHAIN(h, bn) { + bp = bufnode_buf(bn); if (bp->block == block) return (TRUE); } @@ -420,6 +484,9 @@ ch_seek(pos) BLOCKNUM new_block; POSITION len; + if (thisfile == NULL) + return (0); + len = ch_length(); if (pos < ch_zero() || (len != NULL_POSITION && pos > len)) return (1); @@ -454,6 +521,9 @@ ch_end_seek() { POSITION len; + if (thisfile == NULL) + return (0); + if (ch_flags & CH_CANSEEK) ch_fsize = filesize(ch_file); @@ -478,7 +548,8 @@ ch_end_seek() public int ch_beg_seek() { - register struct buf *bp, *firstbp; + register struct bufnode *bn; + register struct bufnode *firstbn; /* * Try a plain ch_seek first. @@ -490,13 +561,15 @@ ch_beg_seek() * Can't get to position 0. * Look thru the buffers for the one closest to position 0. */ - firstbp = bp = ch_bufhead; - if (bp == END_OF_CHAIN) + firstbn = ch_bufhead; + if (firstbn == END_OF_CHAIN) return (1); - while ((bp = bp->next) != END_OF_CHAIN) - if (bp->block < firstbp->block) - firstbp = bp; - ch_block = firstbp->block; + FOR_BUFS(bn) + { + if (bufnode_buf(bn)->block < bufnode_buf(firstbn)->block) + firstbn = bn; + } + ch_block = bufnode_buf(firstbn)->block; ch_offset = 0; return (0); } @@ -507,6 +580,8 @@ ch_beg_seek() public POSITION ch_length() { + if (thisfile == NULL) + return (NULL_POSITION); if (ignore_eoi) return (NULL_POSITION); if (ch_flags & CH_HELPFILE) @@ -520,6 +595,8 @@ ch_length() public POSITION ch_tell() { + if (thisfile == NULL) + return (NULL_POSITION); return (ch_block * LBUFSIZE) + ch_offset; } @@ -531,6 +608,8 @@ ch_forw_get() { register int c; + if (thisfile == NULL) + return (EOI); c = ch_get(); if (c == EOI) return (EOI); @@ -550,6 +629,8 @@ ch_forw_get() public int ch_back_get() { + if (thisfile == NULL) + return (EOI); if (ch_offset > 0) ch_offset --; else @@ -588,7 +669,10 @@ ch_setbufspace(bufspace) public void ch_flush() { - register struct buf *bp; + register struct bufnode *bn; + + if (thisfile == NULL) + return; if (!(ch_flags & CH_CANSEEK)) { @@ -603,8 +687,10 @@ ch_flush() /* * Initialize all the buffers. */ - for (bp = ch_bufhead; bp != END_OF_CHAIN; bp = bp->next) - bp->block = -1; + FOR_BUFS(bn) + { + bufnode_buf(bn)->block = -1; + } /* * Figure out the size of the file, if we can. @@ -632,7 +718,7 @@ ch_flush() } #endif - if (lseek(ch_file, (off_t)0, 0) == BAD_LSEEK) + if (lseek(ch_file, (off_t)0, SEEK_SET) == BAD_LSEEK) { /* * Warning only; even if the seek fails for some reason, @@ -651,6 +737,7 @@ ch_flush() ch_addbuf() { register struct buf *bp; + register struct bufnode *bn; /* * Allocate and initialize a new buffer and link it @@ -661,11 +748,10 @@ ch_addbuf() return (1); ch_nbufs++; bp->block = -1; - bp->next = END_OF_CHAIN; - bp->prev = ch_buftail; - ch_buftail->next = bp; - ch_buftail = bp; - HASH_INS(bp, 0); + bn = &bp->node; + + BUF_INS_TAIL(bn); + BUF_HASH_INS(bn, 0); return (0); } @@ -679,8 +765,8 @@ init_hashtbl() for (h = 0; h < BUFHASH_SIZE; h++) { - thisfile->hashtbl[h].buf_hnext = END_OF_HCHAIN(h); - thisfile->hashtbl[h].buf_hprev = END_OF_HCHAIN(h); + thisfile->hashtbl[h].hnext = END_OF_HCHAIN(h); + thisfile->hashtbl[h].hprev = END_OF_HCHAIN(h); } } @@ -690,14 +776,13 @@ init_hashtbl() static void ch_delbufs() { - register struct buf *bp; + register struct bufnode *bn; while (ch_bufhead != END_OF_CHAIN) { - bp = ch_bufhead; - bp->next->prev = bp->prev; - bp->prev->next = bp->next; - free(bp); + bn = ch_bufhead; + BUF_RM(bn); + free(bufnode_buf(bn)); } ch_nbufs = 0; init_hashtbl(); @@ -721,7 +806,7 @@ seekable(f) return (0); } #endif - return (lseek(f, (off_t)1, 0) != BAD_LSEEK); + return (lseek(f, (off_t)1, SEEK_SET) != BAD_LSEEK); } /* @@ -743,7 +828,7 @@ ch_init(f, flags) */ thisfile = (struct filestate *) calloc(1, sizeof(struct filestate)); - thisfile->buf_next = thisfile->buf_prev = END_OF_CHAIN; + thisfile->buflist.next = thisfile->buflist.prev = END_OF_CHAIN; thisfile->nbufs = 0; thisfile->flags = 0; thisfile->fpos = 0; @@ -773,6 +858,9 @@ ch_close() { int keepstate = FALSE; + if (thisfile == NULL) + return; + if (ch_flags & (CH_CANSEEK|CH_POPENED|CH_HELPFILE)) { /* @@ -811,6 +899,8 @@ ch_close() public int ch_getflags() { + if (thisfile == NULL) + return (0); return (ch_flags); } @@ -819,6 +909,7 @@ ch_getflags() ch_dump(struct filestate *fs) { struct buf *bp; + struct bufnode *bn; unsigned char *s; if (fs == NULL) @@ -830,8 +921,9 @@ ch_dump(struct filestate *fs) fs->file, fs->flags, fs->fpos, fs->fsize, fs->block, fs->offset); printf(" %d bufs:\n", fs->nbufs); - for (bp = fs->buf_next; bp != (struct buf *)fs; bp = bp->next) + for (bn = fs->next; bn != &fs->buflist; bn = bn->next) { + bp = bufnode_buf(bn); printf("%x: blk %x, size %x \"", bp, bp->block, bp->datasize); for (s = bp->data; s < bp->data + 30; s++) diff --git a/external/bsd/less/dist/charset.c b/external/bsd/less/dist/charset.c new file mode 100644 index 000000000..d4cba65e7 --- /dev/null +++ b/external/bsd/less/dist/charset.c @@ -0,0 +1,1178 @@ +/* $NetBSD: charset.c,v 1.3 2011/07/03 20:14:12 tron Exp $ */ + +/* + * Copyright (C) 1984-2011 Mark Nudelman + * + * You may distribute under the terms of either the GNU General Public + * License or the Less License, as specified in the README file. + * + * For more information about less, or for information on how to + * contact the author, see the README file. + */ + + +/* + * Functions to define the character set + * and do things specific to the character set. + */ + +#include "less.h" +#if HAVE_LOCALE +#include +#include +#include +#endif + +#include "charset.h" + +public int utf_mode = 0; + +/* + * Predefined character sets, + * selected by the LESSCHARSET environment variable. + */ +struct charset { + char *name; + int *p_flag; + char *desc; +} charsets[] = { + { "ascii", NULL, "8bcccbcc18b95.b" }, + { "utf-8", &utf_mode, "8bcccbcc18b95.b126.bb" }, + { "iso8859", NULL, "8bcccbcc18b95.33b." }, + { "latin3", NULL, "8bcccbcc18b95.33b5.b8.b15.b4.b12.b18.b12.b." }, + { "arabic", NULL, "8bcccbcc18b95.33b.3b.7b2.13b.3b.b26.5b19.b" }, + { "greek", NULL, "8bcccbcc18b95.33b4.2b4.b3.b35.b44.b" }, + { "greek2005", NULL, "8bcccbcc18b95.33b14.b35.b44.b" }, + { "hebrew", NULL, "8bcccbcc18b95.33b.b29.32b28.2b2.b" }, + { "koi8-r", NULL, "8bcccbcc18b95.b." }, + { "KOI8-T", NULL, "8bcccbcc18b95.b8.b6.b8.b.b.5b7.3b4.b4.b3.b.b.3b." }, + { "georgianps", NULL, "8bcccbcc18b95.3b11.4b12.2b." }, + { "tcvn", NULL, "b..b...bcccbccbbb7.8b95.b48.5b." }, + { "TIS-620", NULL, "8bcccbcc18b95.b.4b.11b7.8b." }, + { "next", NULL, "8bcccbcc18b95.bb125.bb" }, + { "dos", NULL, "8bcccbcc12bc5b95.b." }, + { "windows-1251", NULL, "8bcccbcc12bc5b95.b24.b." }, + { "windows-1252", NULL, "8bcccbcc12bc5b95.b.b11.b.2b12.b." }, + { "windows-1255", NULL, "8bcccbcc12bc5b95.b.b8.b.5b9.b.4b." }, + { "ebcdic", NULL, "5bc6bcc7bcc41b.9b7.9b5.b..8b6.10b6.b9.7b9.8b8.17b3.3b9.7b9.8b8.6b10.b.b.b." }, + { "IBM-1047", NULL, "4cbcbc3b9cbccbccbb4c6bcc5b3cbbc4bc4bccbc191.b" }, + { NULL, NULL, NULL } +}; + +/* + * Support "locale charmap"/nl_langinfo(CODESET) values, as well as others. + */ +struct cs_alias { + char *name; + char *oname; +} cs_aliases[] = { + { "UTF-8", "utf-8" }, + { "ANSI_X3.4-1968", "ascii" }, + { "US-ASCII", "ascii" }, + { "latin1", "iso8859" }, + { "ISO-8859-1", "iso8859" }, + { "latin9", "iso8859" }, + { "ISO-8859-15", "iso8859" }, + { "latin2", "iso8859" }, + { "ISO-8859-2", "iso8859" }, + { "ISO-8859-3", "latin3" }, + { "latin4", "iso8859" }, + { "ISO-8859-4", "iso8859" }, + { "cyrillic", "iso8859" }, + { "ISO-8859-5", "iso8859" }, + { "ISO-8859-6", "arabic" }, + { "ISO-8859-7", "greek" }, + { "IBM9005", "greek2005" }, + { "ISO-8859-8", "hebrew" }, + { "latin5", "iso8859" }, + { "ISO-8859-9", "iso8859" }, + { "latin6", "iso8859" }, + { "ISO-8859-10", "iso8859" }, + { "latin7", "iso8859" }, + { "ISO-8859-13", "iso8859" }, + { "latin8", "iso8859" }, + { "ISO-8859-14", "iso8859" }, + { "latin10", "iso8859" }, + { "ISO-8859-16", "iso8859" }, + { "IBM437", "dos" }, + { "EBCDIC-US", "ebcdic" }, + { "IBM1047", "IBM-1047" }, + { "KOI8-R", "koi8-r" }, + { "KOI8-U", "koi8-r" }, + { "GEORGIAN-PS", "georgianps" }, + { "TCVN5712-1", "tcvn" }, + { "NEXTSTEP", "next" }, + { "windows", "windows-1252" }, /* backward compatibility */ + { "CP1251", "windows-1251" }, + { "CP1252", "windows-1252" }, + { "CP1255", "windows-1255" }, + { NULL, NULL } +}; + +#define IS_BINARY_CHAR 01 +#define IS_CONTROL_CHAR 02 + +static char chardef[256]; +static char *binfmt = NULL; +static char *utfbinfmt = NULL; +public int binattr = AT_STANDOUT; + +static void ichardef __P((char *)); +static int icharset __P((char *, int)); +static void ilocale __P((void)); + +/* + * Define a charset, given a description string. + * The string consists of 256 letters, + * one for each character in the charset. + * If the string is shorter than 256 letters, missing letters + * are taken to be identical to the last one. + * A decimal number followed by a letter is taken to be a + * repetition of the letter. + * + * Each letter is one of: + * . normal character + * b binary character + * c control character + */ + static void +ichardef(s) + char *s; +{ + register char *cp; + register int n; + register char v; + + n = 0; + v = 0; + cp = chardef; + while (*s != '\0') + { + switch (*s++) + { + case '.': + v = 0; + break; + case 'c': + v = IS_CONTROL_CHAR; + break; + case 'b': + v = IS_BINARY_CHAR|IS_CONTROL_CHAR; + break; + + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + n = (10 * n) + (s[-1] - '0'); + continue; + + default: + error("invalid chardef", NULL_PARG); + quit(QUIT_ERROR); + /*NOTREACHED*/ + } + + do + { + if (cp >= chardef + sizeof(chardef)) + { + error("chardef longer than 256", NULL_PARG); + quit(QUIT_ERROR); + /*NOTREACHED*/ + } + *cp++ = v; + } while (--n > 0); + n = 0; + } + + while (cp < chardef + sizeof(chardef)) + *cp++ = v; +} + +/* + * Define a charset, given a charset name. + * The valid charset names are listed in the "charsets" array. + */ + static int +icharset(name, no_error) + register char *name; + int no_error; +{ + register struct charset *p; + register struct cs_alias *a; + + if (name == NULL || *name == '\0') + return (0); + + /* First see if the name is an alias. */ + for (a = cs_aliases; a->name != NULL; a++) + { + if (strcmp(name, a->name) == 0) + { + name = a->oname; + break; + } + } + + for (p = charsets; p->name != NULL; p++) + { + if (strcmp(name, p->name) == 0) + { + ichardef(p->desc); + if (p->p_flag != NULL) + *(p->p_flag) = 1; + return (1); + } + } + + if (!no_error) { + error("invalid charset name", NULL_PARG); + quit(QUIT_ERROR); + } + return (0); +} + +#if HAVE_LOCALE +/* + * Define a charset, given a locale name. + */ + static void +ilocale() +{ + register int c; + + for (c = 0; c < (int) sizeof(chardef); c++) + { + if (isprint(c)) + chardef[c] = 0; + else if (iscntrl(c)) + chardef[c] = IS_CONTROL_CHAR; + else + chardef[c] = IS_BINARY_CHAR|IS_CONTROL_CHAR; + } +} +#endif + +/* + * Define the printing format for control (or binary utf) chars. + */ + static void +setbinfmt(s, fmtvarptr, default_fmt) + char *s; + char **fmtvarptr; + char *default_fmt; +{ + if (s && utf_mode) + { + /* It would be too hard to account for width otherwise. */ + char *t = s; + while (*t) + { + if (*t < ' ' || *t > '~') + { + s = default_fmt; + goto attr; + } + t++; + } + } + + /* %n is evil */ + if (s == NULL || *s == '\0' || + (*s == '*' && (s[1] == '\0' || s[2] == '\0' || strchr(s + 2, 'n'))) || + (*s != '*' && strchr(s, 'n'))) + s = default_fmt; + + /* + * Select the attributes if it starts with "*". + */ + attr: + if (*s == '*') + { + switch (s[1]) + { + case 'd': binattr = AT_BOLD; break; + case 'k': binattr = AT_BLINK; break; + case 's': binattr = AT_STANDOUT; break; + case 'u': binattr = AT_UNDERLINE; break; + default: binattr = AT_NORMAL; break; + } + s += 2; + } + *fmtvarptr = s; +} + +/* + * + */ + static void +set_charset() +{ + char *s; + + /* + * See if environment variable LESSCHARSET is defined. + */ + s = lgetenv("LESSCHARSET"); + if (icharset(s, 0)) + return; + + /* + * LESSCHARSET is not defined: try LESSCHARDEF. + */ + s = lgetenv("LESSCHARDEF"); + if (s != NULL && *s != '\0') + { + ichardef(s); + return; + } + +#if HAVE_LOCALE +#ifdef CODESET + /* + * Try using the codeset name as the charset name. + */ + s = nl_langinfo(CODESET); + if (icharset(s, 1)) + return; +#endif +#endif + +#if HAVE_STRSTR + /* + * Check whether LC_ALL, LC_CTYPE or LANG look like UTF-8 is used. + */ + if ((s = lgetenv("LC_ALL")) != NULL || + (s = lgetenv("LC_CTYPE")) != NULL || + (s = lgetenv("LANG")) != NULL) + { + if ( strstr(s, "UTF-8") != NULL || strstr(s, "utf-8") != NULL + || strstr(s, "UTF8") != NULL || strstr(s, "utf8") != NULL) + if (icharset("utf-8", 1)) + return; + } +#endif + +#if HAVE_LOCALE + /* + * Get character definitions from locale functions, + * rather than from predefined charset entry. + */ + ilocale(); +#if MSDOS_COMPILER + /* + * Default to "dos". + */ + (void) icharset("dos", 1); +#else + /* + * Default to "latin1". + */ + (void) icharset("latin1", 1); +#endif +#endif +} + +/* + * Initialize charset data structures. + */ + public void +init_charset() +{ + char *s; + +#if HAVE_LOCALE + setlocale(LC_ALL, ""); +#endif + + set_charset(); + + s = lgetenv("LESSBINFMT"); + setbinfmt(s, &binfmt, "*s<%02X>"); + + s = lgetenv("LESSUTFBINFMT"); + setbinfmt(s, &utfbinfmt, ""); +} + +/* + * Is a given character a "binary" character? + */ + public int +binary_char(c) + LWCHAR c; +{ + if (utf_mode) + return (is_ubin_char(c)); + c &= 0377; + return (chardef[c] & IS_BINARY_CHAR); +} + +/* + * Is a given character a "control" character? + */ + public int +control_char(c) + LWCHAR c; +{ + c &= 0377; + return (chardef[c] & IS_CONTROL_CHAR); +} + +/* + * Return the printable form of a character. + * For example, in the "ascii" charset '\3' is printed as "^C". + */ + public char * +prchar(c) + LWCHAR c; +{ + /* {{ This buffer can be overrun if LESSBINFMT is a long string. }} */ + static char buf[32]; + + c &= 0377; + if ((c < 128 || !utf_mode) && !control_char(c)) + SNPRINTF1(buf, sizeof(buf), "%c", (int) c); + else if (c == ESC) + strcpy(buf, "ESC"); +#if IS_EBCDIC_HOST + else if (!binary_char(c) && c < 64) + SNPRINTF1(buf, sizeof(buf), "^%c", + /* + * This array roughly inverts CONTROL() #defined in less.h, + * and should be kept in sync with CONTROL() and IBM-1047. + */ + "@ABC.I.?...KLMNO" + "PQRS.JH.XY.." + "\\]^_" + "......W[.....EFG" + "..V....D....TU.Z"[c]); +#else + else if (c < 128 && !control_char(c ^ 0100)) + SNPRINTF1(buf, sizeof(buf), "^%c", (int) (c ^ 0100)); +#endif + else + SNPRINTF1(buf, sizeof(buf), binfmt, c); + return (buf); +} + +/* + * Return the printable form of a UTF-8 character. + */ + public char * +prutfchar(ch) + LWCHAR ch; +{ + static char buf[32]; + + if (ch == ESC) + strcpy(buf, "ESC"); + else if (ch < 128 && control_char(ch)) + { + if (!control_char(ch ^ 0100)) + SNPRINTF1(buf, sizeof(buf), "^%c", ((char) ch) ^ 0100); + else + SNPRINTF1(buf, sizeof(buf), binfmt, (char) ch); + } else if (is_ubin_char(ch)) + SNPRINTF1(buf, sizeof(buf), utfbinfmt, ch); + else + { + int len; + if (ch >= 0x80000000) + { + len = 3; + ch = 0xFFFD; + } else + { + len = (ch < 0x80) ? 1 + : (ch < 0x800) ? 2 + : (ch < 0x10000) ? 3 + : (ch < 0x200000) ? 4 + : (ch < 0x4000000) ? 5 + : 6; + } + buf[len] = '\0'; + if (len == 1) + *buf = (char) ch; + else + { + *buf = ((1 << len) - 1) << (8 - len); + while (--len > 0) + { + buf[len] = (char) (0x80 | (ch & 0x3F)); + ch >>= 6; + } + *buf |= ch; + } + } + return (buf); +} + +/* + * Get the length of a UTF-8 character in bytes. + */ + public int +utf_len(ch) + char ch; +{ + if ((ch & 0x80) == 0) + return 1; + if ((ch & 0xE0) == 0xC0) + return 2; + if ((ch & 0xF0) == 0xE0) + return 3; + if ((ch & 0xF8) == 0xF0) + return 4; + if ((ch & 0xFC) == 0xF8) + return 5; + if ((ch & 0xFE) == 0xFC) + return 6; + /* Invalid UTF-8 encoding. */ + return 1; +} + +/* + * Is a UTF-8 character well-formed? + */ + public int +is_utf8_well_formed(s) + unsigned char *s; +{ + int i; + int len; + + if (IS_UTF8_INVALID(s[0])) + return (0); + + len = utf_len((char) s[0]); + if (len == 1) + return (1); + if (len == 2) + { + if (s[0] < 0xC2) + return (0); + } else + { + unsigned char mask; + mask = (~((1 << (8-len)) - 1)) & 0xFF; + if (s[0] == mask && (s[1] & mask) == 0x80) + return (0); + } + + for (i = 1; i < len; i++) + if (!IS_UTF8_TRAIL(s[i])) + return (0); + return (1); +} + +/* + * Get the value of a UTF-8 character. + */ + public LWCHAR +get_wchar(p) + char *p; +{ + switch (utf_len(p[0])) + { + case 1: + default: + /* 0xxxxxxx */ + return (LWCHAR) + (p[0] & 0xFF); + case 2: + /* 110xxxxx 10xxxxxx */ + return (LWCHAR) ( + ((p[0] & 0x1F) << 6) | + (p[1] & 0x3F)); + case 3: + /* 1110xxxx 10xxxxxx 10xxxxxx */ + return (LWCHAR) ( + ((p[0] & 0x0F) << 12) | + ((p[1] & 0x3F) << 6) | + (p[2] & 0x3F)); + case 4: + /* 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */ + return (LWCHAR) ( + ((p[0] & 0x07) << 18) | + ((p[1] & 0x3F) << 12) | + ((p[2] & 0x3F) << 6) | + (p[3] & 0x3F)); + case 5: + /* 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx */ + return (LWCHAR) ( + ((p[0] & 0x03) << 24) | + ((p[1] & 0x3F) << 18) | + ((p[2] & 0x3F) << 12) | + ((p[3] & 0x3F) << 6) | + (p[4] & 0x3F)); + case 6: + /* 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx */ + return (LWCHAR) ( + ((p[0] & 0x01) << 30) | + ((p[1] & 0x3F) << 24) | + ((p[2] & 0x3F) << 18) | + ((p[3] & 0x3F) << 12) | + ((p[4] & 0x3F) << 6) | + (p[5] & 0x3F)); + } +} + +/* + * Store a character into a UTF-8 string. + */ + public void +put_wchar(pp, ch) + char **pp; + LWCHAR ch; +{ + if (!utf_mode || ch < 0x80) + { + /* 0xxxxxxx */ + *(*pp)++ = (char) ch; + } else if (ch < 0x800) + { + /* 110xxxxx 10xxxxxx */ + *(*pp)++ = (char) (0xC0 | ((ch >> 6) & 0x1F)); + *(*pp)++ = (char) (0x80 | (ch & 0x3F)); + } else if (ch < 0x10000) + { + /* 1110xxxx 10xxxxxx 10xxxxxx */ + *(*pp)++ = (char) (0xE0 | ((ch >> 12) & 0x0F)); + *(*pp)++ = (char) (0x80 | ((ch >> 6) & 0x3F)); + *(*pp)++ = (char) (0x80 | (ch & 0x3F)); + } else if (ch < 0x200000) + { + /* 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */ + *(*pp)++ = (char) (0xF0 | ((ch >> 18) & 0x07)); + *(*pp)++ = (char) (0x80 | ((ch >> 12) & 0x3F)); + *(*pp)++ = (char) (0x80 | ((ch >> 6) & 0x3F)); + *(*pp)++ = (char) (0x80 | (ch & 0x3F)); + } else if (ch < 0x4000000) + { + /* 111110xx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx */ + *(*pp)++ = (char) (0xF0 | ((ch >> 24) & 0x03)); + *(*pp)++ = (char) (0x80 | ((ch >> 18) & 0x3F)); + *(*pp)++ = (char) (0x80 | ((ch >> 12) & 0x3F)); + *(*pp)++ = (char) (0x80 | ((ch >> 6) & 0x3F)); + *(*pp)++ = (char) (0x80 | (ch & 0x3F)); + } else + { + /* 1111110x 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx 10xxxxxx */ + *(*pp)++ = (char) (0xF0 | ((ch >> 30) & 0x01)); + *(*pp)++ = (char) (0x80 | ((ch >> 24) & 0x3F)); + *(*pp)++ = (char) (0x80 | ((ch >> 18) & 0x3F)); + *(*pp)++ = (char) (0x80 | ((ch >> 12) & 0x3F)); + *(*pp)++ = (char) (0x80 | ((ch >> 6) & 0x3F)); + *(*pp)++ = (char) (0x80 | (ch & 0x3F)); + } +} + +/* + * Step forward or backward one character in a string. + */ + public LWCHAR +step_char(pp, dir, limit) + char **pp; + signed int dir; + char *limit; +{ + LWCHAR ch; + int len; + char *p = *pp; + + if (!utf_mode) + { + /* It's easy if chars are one byte. */ + if (dir > 0) + ch = (LWCHAR) ((p < limit) ? *p++ : 0); + else + ch = (LWCHAR) ((p > limit) ? *--p : 0); + } else if (dir > 0) + { + len = utf_len(*p); + if (p + len > limit) + { + ch = 0; + p = limit; + } else + { + ch = get_wchar(p); + p += len; + } + } else + { + while (p > limit && IS_UTF8_TRAIL(p[-1])) + p--; + if (p > limit) + ch = get_wchar(--p); + else + ch = 0; + } + *pp = p; + return ch; +} + +/* + * Unicode characters data + */ +struct wchar_range { LWCHAR first, last; }; + +/* + * Characters with general category values + * Mn: Mark, Nonspacing + * Me: Mark, Enclosing + * Last synched with + * + * dated 2005-11-30T00:58:48Z + */ +static struct wchar_range comp_table[] = { + { 0x0300, 0x036F} /* Mn */, { 0x0483, 0x0486} /* Mn */, + { 0x0488, 0x0489} /* Me */, + { 0x0591, 0x05BD} /* Mn */, { 0x05BF, 0x05BF} /* Mn */, + { 0x05C1, 0x05C2} /* Mn */, { 0x05C4, 0x05C5} /* Mn */, + { 0x05C7, 0x05C7} /* Mn */, { 0x0610, 0x0615} /* Mn */, + { 0x064B, 0x065E} /* Mn */, { 0x0670, 0x0670} /* Mn */, + { 0x06D6, 0x06DC} /* Mn */, + { 0x06DE, 0x06DE} /* Me */, + { 0x06DF, 0x06E4} /* Mn */, { 0x06E7, 0x06E8} /* Mn */, + { 0x06EA, 0x06ED} /* Mn */, { 0x0711, 0x0711} /* Mn */, + { 0x0730, 0x074A} /* Mn */, { 0x07A6, 0x07B0} /* Mn */, + { 0x07EB, 0x07F3} /* Mn */, { 0x0901, 0x0902} /* Mn */, + { 0x093C, 0x093C} /* Mn */, { 0x0941, 0x0948} /* Mn */, + { 0x094D, 0x094D} /* Mn */, { 0x0951, 0x0954} /* Mn */, + { 0x0962, 0x0963} /* Mn */, { 0x0981, 0x0981} /* Mn */, + { 0x09BC, 0x09BC} /* Mn */, { 0x09C1, 0x09C4} /* Mn */, + { 0x09CD, 0x09CD} /* Mn */, { 0x09E2, 0x09E3} /* Mn */, + { 0x0A01, 0x0A02} /* Mn */, { 0x0A3C, 0x0A3C} /* Mn */, + { 0x0A41, 0x0A42} /* Mn */, { 0x0A47, 0x0A48} /* Mn */, + { 0x0A4B, 0x0A4D} /* Mn */, { 0x0A70, 0x0A71} /* Mn */, + { 0x0A81, 0x0A82} /* Mn */, { 0x0ABC, 0x0ABC} /* Mn */, + { 0x0AC1, 0x0AC5} /* Mn */, { 0x0AC7, 0x0AC8} /* Mn */, + { 0x0ACD, 0x0ACD} /* Mn */, { 0x0AE2, 0x0AE3} /* Mn */, + { 0x0B01, 0x0B01} /* Mn */, { 0x0B3C, 0x0B3C} /* Mn */, + { 0x0B3F, 0x0B3F} /* Mn */, { 0x0B41, 0x0B43} /* Mn */, + { 0x0B4D, 0x0B4D} /* Mn */, { 0x0B56, 0x0B56} /* Mn */, + { 0x0B82, 0x0B82} /* Mn */, { 0x0BC0, 0x0BC0} /* Mn */, + { 0x0BCD, 0x0BCD} /* Mn */, { 0x0C3E, 0x0C40} /* Mn */, + { 0x0C46, 0x0C48} /* Mn */, { 0x0C4A, 0x0C4D} /* Mn */, + { 0x0C55, 0x0C56} /* Mn */, { 0x0CBC, 0x0CBC} /* Mn */, + { 0x0CBF, 0x0CBF} /* Mn */, { 0x0CC6, 0x0CC6} /* Mn */, + { 0x0CCC, 0x0CCD} /* Mn */, { 0x0CE2, 0x0CE3} /* Mn */, + { 0x0D41, 0x0D43} /* Mn */, { 0x0D4D, 0x0D4D} /* Mn */, + { 0x0DCA, 0x0DCA} /* Mn */, { 0x0DD2, 0x0DD4} /* Mn */, + { 0x0DD6, 0x0DD6} /* Mn */, { 0x0E31, 0x0E31} /* Mn */, + { 0x0E34, 0x0E3A} /* Mn */, { 0x0E47, 0x0E4E} /* Mn */, + { 0x0EB1, 0x0EB1} /* Mn */, { 0x0EB4, 0x0EB9} /* Mn */, + { 0x0EBB, 0x0EBC} /* Mn */, { 0x0EC8, 0x0ECD} /* Mn */, + { 0x0F18, 0x0F19} /* Mn */, { 0x0F35, 0x0F35} /* Mn */, + { 0x0F37, 0x0F37} /* Mn */, { 0x0F39, 0x0F39} /* Mn */, + { 0x0F71, 0x0F7E} /* Mn */, { 0x0F80, 0x0F84} /* Mn */, + { 0x0F86, 0x0F87} /* Mn */, { 0x0F90, 0x0F97} /* Mn */, + { 0x0F99, 0x0FBC} /* Mn */, { 0x0FC6, 0x0FC6} /* Mn */, + { 0x102D, 0x1030} /* Mn */, { 0x1032, 0x1032} /* Mn */, + { 0x1036, 0x1037} /* Mn */, { 0x1039, 0x1039} /* Mn */, + { 0x1058, 0x1059} /* Mn */, { 0x135F, 0x135F} /* Mn */, + { 0x1712, 0x1714} /* Mn */, { 0x1732, 0x1734} /* Mn */, + { 0x1752, 0x1753} /* Mn */, { 0x1772, 0x1773} /* Mn */, + { 0x17B7, 0x17BD} /* Mn */, { 0x17C6, 0x17C6} /* Mn */, + { 0x17C9, 0x17D3} /* Mn */, { 0x17DD, 0x17DD} /* Mn */, + { 0x180B, 0x180D} /* Mn */, { 0x18A9, 0x18A9} /* Mn */, + { 0x1920, 0x1922} /* Mn */, { 0x1927, 0x1928} /* Mn */, + { 0x1932, 0x1932} /* Mn */, { 0x1939, 0x193B} /* Mn */, + { 0x1A17, 0x1A18} /* Mn */, { 0x1B00, 0x1B03} /* Mn */, + { 0x1B34, 0x1B34} /* Mn */, { 0x1B36, 0x1B3A} /* Mn */, + { 0x1B3C, 0x1B3C} /* Mn */, { 0x1B42, 0x1B42} /* Mn */, + { 0x1B6B, 0x1B73} /* Mn */, { 0x1DC0, 0x1DCA} /* Mn */, + { 0x1DFE, 0x1DFF} /* Mn */, { 0x20D0, 0x20DC} /* Mn */, + { 0x20DD, 0x20E0} /* Me */, + { 0x20E1, 0x20E1} /* Mn */, + { 0x20E2, 0x20E4} /* Me */, + { 0x20E5, 0x20EF} /* Mn */, { 0x302A, 0x302F} /* Mn */, + { 0x3099, 0x309A} /* Mn */, { 0xA806, 0xA806} /* Mn */, + { 0xA80B, 0xA80B} /* Mn */, { 0xA825, 0xA826} /* Mn */, + { 0xFB1E, 0xFB1E} /* Mn */, { 0xFE00, 0xFE0F} /* Mn */, + { 0xFE20, 0xFE23} /* Mn */, { 0x10A01, 0x10A03} /* Mn */, + { 0x10A05, 0x10A06} /* Mn */, { 0x10A0C, 0x10A0F} /* Mn */, + { 0x10A38, 0x10A3A} /* Mn */, { 0x10A3F, 0x10A3F} /* Mn */, + { 0x1D167, 0x1D169} /* Mn */, { 0x1D17B, 0x1D182} /* Mn */, + { 0x1D185, 0x1D18B} /* Mn */, { 0x1D1AA, 0x1D1AD} /* Mn */, + { 0x1D242, 0x1D244} /* Mn */, { 0xE0100, 0xE01EF} /* Mn */, +}; + +/* + * Special pairs, not ranges. + */ +static struct wchar_range comb_table[] = { + {0x0644,0x0622}, {0x0644,0x0623}, {0x0644,0x0625}, {0x0644,0x0627}, +}; + +/* + * Characters with general category values + * Cc: Other, Control + * Cf: Other, Format + * Cs: Other, Surrogate + * Co: Other, Private Use + * Cn: Other, Not Assigned + * Zl: Separator, Line + * Zp: Separator, Paragraph + * Last synched with + * + * dated 2005-11-30T00:58:48Z + */ +static struct wchar_range ubin_table[] = { + { 0x0000, 0x0007} /* Cc */, + { 0x000B, 0x000C} /* Cc */, + { 0x000E, 0x001A} /* Cc */, + { 0x001C, 0x001F} /* Cc */, + { 0x007F, 0x009F} /* Cc */, +#if 0 + { 0x00AD, 0x00AD} /* Cf */, +#endif + { 0x0370, 0x0373} /* Cn */, { 0x0376, 0x0379} /* Cn */, + { 0x037F, 0x0383} /* Cn */, { 0x038B, 0x038B} /* Cn */, + { 0x038D, 0x038D} /* Cn */, { 0x03A2, 0x03A2} /* Cn */, + { 0x03CF, 0x03CF} /* Cn */, { 0x0487, 0x0487} /* Cn */, + { 0x0514, 0x0530} /* Cn */, { 0x0557, 0x0558} /* Cn */, + { 0x0560, 0x0560} /* Cn */, { 0x0588, 0x0588} /* Cn */, + { 0x058B, 0x0590} /* Cn */, { 0x05C8, 0x05CF} /* Cn */, + { 0x05EB, 0x05EF} /* Cn */, { 0x05F5, 0x05FF} /* Cn */, +#if 0 + { 0x0600, 0x0603} /* Cf */, +#endif + { 0x0604, 0x060A} /* Cn */, { 0x0616, 0x061A} /* Cn */, + { 0x061C, 0x061D} /* Cn */, { 0x0620, 0x0620} /* Cn */, + { 0x063B, 0x063F} /* Cn */, { 0x065F, 0x065F} /* Cn */, +#if 0 + { 0x06DD, 0x06DD} /* Cf */, +#endif + { 0x070E, 0x070E} /* Cn */, +#if 0 + { 0x070F, 0x070F} /* Cf */, +#endif + { 0x074B, 0x074C} /* Cn */, { 0x076E, 0x077F} /* Cn */, + { 0x07B2, 0x07BF} /* Cn */, { 0x07FB, 0x0900} /* Cn */, + { 0x093A, 0x093B} /* Cn */, { 0x094E, 0x094F} /* Cn */, + { 0x0955, 0x0957} /* Cn */, { 0x0971, 0x097A} /* Cn */, + { 0x0980, 0x0980} /* Cn */, { 0x0984, 0x0984} /* Cn */, + { 0x098D, 0x098E} /* Cn */, { 0x0991, 0x0992} /* Cn */, + { 0x09A9, 0x09A9} /* Cn */, { 0x09B1, 0x09B1} /* Cn */, + { 0x09B3, 0x09B5} /* Cn */, { 0x09BA, 0x09BB} /* Cn */, + { 0x09C5, 0x09C6} /* Cn */, { 0x09C9, 0x09CA} /* Cn */, + { 0x09CF, 0x09D6} /* Cn */, { 0x09D8, 0x09DB} /* Cn */, + { 0x09DE, 0x09DE} /* Cn */, { 0x09E4, 0x09E5} /* Cn */, + { 0x09FB, 0x0A00} /* Cn */, { 0x0A04, 0x0A04} /* Cn */, + { 0x0A0B, 0x0A0E} /* Cn */, { 0x0A11, 0x0A12} /* Cn */, + { 0x0A29, 0x0A29} /* Cn */, { 0x0A31, 0x0A31} /* Cn */, + { 0x0A34, 0x0A34} /* Cn */, { 0x0A37, 0x0A37} /* Cn */, + { 0x0A3A, 0x0A3B} /* Cn */, { 0x0A3D, 0x0A3D} /* Cn */, + { 0x0A43, 0x0A46} /* Cn */, { 0x0A49, 0x0A4A} /* Cn */, + { 0x0A4E, 0x0A58} /* Cn */, { 0x0A5D, 0x0A5D} /* Cn */, + { 0x0A5F, 0x0A65} /* Cn */, { 0x0A75, 0x0A80} /* Cn */, + { 0x0A84, 0x0A84} /* Cn */, { 0x0A8E, 0x0A8E} /* Cn */, + { 0x0A92, 0x0A92} /* Cn */, { 0x0AA9, 0x0AA9} /* Cn */, + { 0x0AB1, 0x0AB1} /* Cn */, { 0x0AB4, 0x0AB4} /* Cn */, + { 0x0ABA, 0x0ABB} /* Cn */, { 0x0AC6, 0x0AC6} /* Cn */, + { 0x0ACA, 0x0ACA} /* Cn */, { 0x0ACE, 0x0ACF} /* Cn */, + { 0x0AD1, 0x0ADF} /* Cn */, { 0x0AE4, 0x0AE5} /* Cn */, + { 0x0AF0, 0x0AF0} /* Cn */, { 0x0AF2, 0x0B00} /* Cn */, + { 0x0B04, 0x0B04} /* Cn */, { 0x0B0D, 0x0B0E} /* Cn */, + { 0x0B11, 0x0B12} /* Cn */, { 0x0B29, 0x0B29} /* Cn */, + { 0x0B31, 0x0B31} /* Cn */, { 0x0B34, 0x0B34} /* Cn */, + { 0x0B3A, 0x0B3B} /* Cn */, { 0x0B44, 0x0B46} /* Cn */, + { 0x0B49, 0x0B4A} /* Cn */, { 0x0B4E, 0x0B55} /* Cn */, + { 0x0B58, 0x0B5B} /* Cn */, { 0x0B5E, 0x0B5E} /* Cn */, + { 0x0B62, 0x0B65} /* Cn */, { 0x0B72, 0x0B81} /* Cn */, + { 0x0B84, 0x0B84} /* Cn */, { 0x0B8B, 0x0B8D} /* Cn */, + { 0x0B91, 0x0B91} /* Cn */, { 0x0B96, 0x0B98} /* Cn */, + { 0x0B9B, 0x0B9B} /* Cn */, { 0x0B9D, 0x0B9D} /* Cn */, + { 0x0BA0, 0x0BA2} /* Cn */, { 0x0BA5, 0x0BA7} /* Cn */, + { 0x0BAB, 0x0BAD} /* Cn */, { 0x0BBA, 0x0BBD} /* Cn */, + { 0x0BC3, 0x0BC5} /* Cn */, { 0x0BC9, 0x0BC9} /* Cn */, + { 0x0BCE, 0x0BD6} /* Cn */, { 0x0BD8, 0x0BE5} /* Cn */, + { 0x0BFB, 0x0C00} /* Cn */, { 0x0C04, 0x0C04} /* Cn */, + { 0x0C0D, 0x0C0D} /* Cn */, { 0x0C11, 0x0C11} /* Cn */, + { 0x0C29, 0x0C29} /* Cn */, { 0x0C34, 0x0C34} /* Cn */, + { 0x0C3A, 0x0C3D} /* Cn */, { 0x0C45, 0x0C45} /* Cn */, + { 0x0C49, 0x0C49} /* Cn */, { 0x0C4E, 0x0C54} /* Cn */, + { 0x0C57, 0x0C5F} /* Cn */, { 0x0C62, 0x0C65} /* Cn */, + { 0x0C70, 0x0C81} /* Cn */, { 0x0C84, 0x0C84} /* Cn */, + { 0x0C8D, 0x0C8D} /* Cn */, { 0x0C91, 0x0C91} /* Cn */, + { 0x0CA9, 0x0CA9} /* Cn */, { 0x0CB4, 0x0CB4} /* Cn */, + { 0x0CBA, 0x0CBB} /* Cn */, { 0x0CC5, 0x0CC5} /* Cn */, + { 0x0CC9, 0x0CC9} /* Cn */, { 0x0CCE, 0x0CD4} /* Cn */, + { 0x0CD7, 0x0CDD} /* Cn */, { 0x0CDF, 0x0CDF} /* Cn */, + { 0x0CE4, 0x0CE5} /* Cn */, { 0x0CF0, 0x0CF0} /* Cn */, + { 0x0CF3, 0x0D01} /* Cn */, { 0x0D04, 0x0D04} /* Cn */, + { 0x0D0D, 0x0D0D} /* Cn */, { 0x0D11, 0x0D11} /* Cn */, + { 0x0D29, 0x0D29} /* Cn */, { 0x0D3A, 0x0D3D} /* Cn */, + { 0x0D44, 0x0D45} /* Cn */, { 0x0D49, 0x0D49} /* Cn */, + { 0x0D4E, 0x0D56} /* Cn */, { 0x0D58, 0x0D5F} /* Cn */, + { 0x0D62, 0x0D65} /* Cn */, { 0x0D70, 0x0D81} /* Cn */, + { 0x0D84, 0x0D84} /* Cn */, { 0x0D97, 0x0D99} /* Cn */, + { 0x0DB2, 0x0DB2} /* Cn */, { 0x0DBC, 0x0DBC} /* Cn */, + { 0x0DBE, 0x0DBF} /* Cn */, { 0x0DC7, 0x0DC9} /* Cn */, + { 0x0DCB, 0x0DCE} /* Cn */, { 0x0DD5, 0x0DD5} /* Cn */, + { 0x0DD7, 0x0DD7} /* Cn */, { 0x0DE0, 0x0DF1} /* Cn */, + { 0x0DF5, 0x0E00} /* Cn */, { 0x0E3B, 0x0E3E} /* Cn */, + { 0x0E5C, 0x0E80} /* Cn */, { 0x0E83, 0x0E83} /* Cn */, + { 0x0E85, 0x0E86} /* Cn */, { 0x0E89, 0x0E89} /* Cn */, + { 0x0E8B, 0x0E8C} /* Cn */, { 0x0E8E, 0x0E93} /* Cn */, + { 0x0E98, 0x0E98} /* Cn */, { 0x0EA0, 0x0EA0} /* Cn */, + { 0x0EA4, 0x0EA4} /* Cn */, { 0x0EA6, 0x0EA6} /* Cn */, + { 0x0EA8, 0x0EA9} /* Cn */, { 0x0EAC, 0x0EAC} /* Cn */, + { 0x0EBA, 0x0EBA} /* Cn */, { 0x0EBE, 0x0EBF} /* Cn */, + { 0x0EC5, 0x0EC5} /* Cn */, { 0x0EC7, 0x0EC7} /* Cn */, + { 0x0ECE, 0x0ECF} /* Cn */, { 0x0EDA, 0x0EDB} /* Cn */, + { 0x0EDE, 0x0EFF} /* Cn */, { 0x0F48, 0x0F48} /* Cn */, + { 0x0F6B, 0x0F70} /* Cn */, { 0x0F8C, 0x0F8F} /* Cn */, + { 0x0F98, 0x0F98} /* Cn */, { 0x0FBD, 0x0FBD} /* Cn */, + { 0x0FCD, 0x0FCE} /* Cn */, { 0x0FD2, 0x0FFF} /* Cn */, + { 0x1022, 0x1022} /* Cn */, { 0x1028, 0x1028} /* Cn */, + { 0x102B, 0x102B} /* Cn */, { 0x1033, 0x1035} /* Cn */, + { 0x103A, 0x103F} /* Cn */, { 0x105A, 0x109F} /* Cn */, + { 0x10C6, 0x10CF} /* Cn */, { 0x10FD, 0x10FF} /* Cn */, + { 0x115A, 0x115E} /* Cn */, { 0x11A3, 0x11A7} /* Cn */, + { 0x11FA, 0x11FF} /* Cn */, { 0x1249, 0x1249} /* Cn */, + { 0x124E, 0x124F} /* Cn */, { 0x1257, 0x1257} /* Cn */, + { 0x1259, 0x1259} /* Cn */, { 0x125E, 0x125F} /* Cn */, + { 0x1289, 0x1289} /* Cn */, { 0x128E, 0x128F} /* Cn */, + { 0x12B1, 0x12B1} /* Cn */, { 0x12B6, 0x12B7} /* Cn */, + { 0x12BF, 0x12BF} /* Cn */, { 0x12C1, 0x12C1} /* Cn */, + { 0x12C6, 0x12C7} /* Cn */, { 0x12D7, 0x12D7} /* Cn */, + { 0x1311, 0x1311} /* Cn */, { 0x1316, 0x1317} /* Cn */, + { 0x135B, 0x135E} /* Cn */, { 0x137D, 0x137F} /* Cn */, + { 0x139A, 0x139F} /* Cn */, { 0x13F5, 0x1400} /* Cn */, + { 0x1677, 0x167F} /* Cn */, { 0x169D, 0x169F} /* Cn */, + { 0x16F1, 0x16FF} /* Cn */, { 0x170D, 0x170D} /* Cn */, + { 0x1715, 0x171F} /* Cn */, { 0x1737, 0x173F} /* Cn */, + { 0x1754, 0x175F} /* Cn */, { 0x176D, 0x176D} /* Cn */, + { 0x1771, 0x1771} /* Cn */, { 0x1774, 0x177F} /* Cn */, +#if 0 + { 0x17B4, 0x17B5} /* Cf */, +#endif + { 0x17DE, 0x17DF} /* Cn */, { 0x17EA, 0x17EF} /* Cn */, + { 0x17FA, 0x17FF} /* Cn */, { 0x180F, 0x180F} /* Cn */, + { 0x181A, 0x181F} /* Cn */, { 0x1878, 0x187F} /* Cn */, + { 0x18AA, 0x18FF} /* Cn */, { 0x191D, 0x191F} /* Cn */, + { 0x192C, 0x192F} /* Cn */, { 0x193C, 0x193F} /* Cn */, + { 0x1941, 0x1943} /* Cn */, { 0x196E, 0x196F} /* Cn */, + { 0x1975, 0x197F} /* Cn */, { 0x19AA, 0x19AF} /* Cn */, + { 0x19CA, 0x19CF} /* Cn */, { 0x19DA, 0x19DD} /* Cn */, + { 0x1A1C, 0x1A1D} /* Cn */, { 0x1A20, 0x1AFF} /* Cn */, + { 0x1B4C, 0x1B4F} /* Cn */, { 0x1B7D, 0x1CFF} /* Cn */, + { 0x1DCB, 0x1DFD} /* Cn */, { 0x1E9C, 0x1E9F} /* Cn */, + { 0x1EFA, 0x1EFF} /* Cn */, { 0x1F16, 0x1F17} /* Cn */, + { 0x1F1E, 0x1F1F} /* Cn */, { 0x1F46, 0x1F47} /* Cn */, + { 0x1F4E, 0x1F4F} /* Cn */, { 0x1F58, 0x1F58} /* Cn */, + { 0x1F5A, 0x1F5A} /* Cn */, { 0x1F5C, 0x1F5C} /* Cn */, + { 0x1F5E, 0x1F5E} /* Cn */, { 0x1F7E, 0x1F7F} /* Cn */, + { 0x1FB5, 0x1FB5} /* Cn */, { 0x1FC5, 0x1FC5} /* Cn */, + { 0x1FD4, 0x1FD5} /* Cn */, { 0x1FDC, 0x1FDC} /* Cn */, + { 0x1FF0, 0x1FF1} /* Cn */, { 0x1FF5, 0x1FF5} /* Cn */, + { 0x1FFF, 0x1FFF} /* Cn */, + { 0x200B, 0x200F} /* Cf */, + { 0x2028, 0x2028} /* Zl */, + { 0x2029, 0x2029} /* Zp */, + { 0x202A, 0x202E} /* Cf */, + { 0x2060, 0x2063} /* Cf */, + { 0x2064, 0x2069} /* Cn */, + { 0x206A, 0x206F} /* Cf */, + { 0x2072, 0x2073} /* Cn */, { 0x208F, 0x208F} /* Cn */, + { 0x2095, 0x209F} /* Cn */, { 0x20B6, 0x20CF} /* Cn */, + { 0x20F0, 0x20FF} /* Cn */, { 0x214F, 0x2152} /* Cn */, + { 0x2185, 0x218F} /* Cn */, { 0x23E8, 0x23FF} /* Cn */, + { 0x2427, 0x243F} /* Cn */, { 0x244B, 0x245F} /* Cn */, + { 0x269D, 0x269F} /* Cn */, { 0x26B3, 0x2700} /* Cn */, + { 0x2705, 0x2705} /* Cn */, { 0x270A, 0x270B} /* Cn */, + { 0x2728, 0x2728} /* Cn */, { 0x274C, 0x274C} /* Cn */, + { 0x274E, 0x274E} /* Cn */, { 0x2753, 0x2755} /* Cn */, + { 0x2757, 0x2757} /* Cn */, { 0x275F, 0x2760} /* Cn */, + { 0x2795, 0x2797} /* Cn */, { 0x27B0, 0x27B0} /* Cn */, + { 0x27BF, 0x27BF} /* Cn */, { 0x27CB, 0x27CF} /* Cn */, + { 0x27EC, 0x27EF} /* Cn */, { 0x2B1B, 0x2B1F} /* Cn */, + { 0x2B24, 0x2BFF} /* Cn */, { 0x2C2F, 0x2C2F} /* Cn */, + { 0x2C5F, 0x2C5F} /* Cn */, { 0x2C6D, 0x2C73} /* Cn */, + { 0x2C78, 0x2C7F} /* Cn */, { 0x2CEB, 0x2CF8} /* Cn */, + { 0x2D26, 0x2D2F} /* Cn */, { 0x2D66, 0x2D6E} /* Cn */, + { 0x2D70, 0x2D7F} /* Cn */, { 0x2D97, 0x2D9F} /* Cn */, + { 0x2DA7, 0x2DA7} /* Cn */, { 0x2DAF, 0x2DAF} /* Cn */, + { 0x2DB7, 0x2DB7} /* Cn */, { 0x2DBF, 0x2DBF} /* Cn */, + { 0x2DC7, 0x2DC7} /* Cn */, { 0x2DCF, 0x2DCF} /* Cn */, + { 0x2DD7, 0x2DD7} /* Cn */, { 0x2DDF, 0x2DFF} /* Cn */, + { 0x2E18, 0x2E1B} /* Cn */, { 0x2E1E, 0x2E7F} /* Cn */, + { 0x2E9A, 0x2E9A} /* Cn */, { 0x2EF4, 0x2EFF} /* Cn */, + { 0x2FD6, 0x2FEF} /* Cn */, { 0x2FFC, 0x2FFF} /* Cn */, + { 0x3040, 0x3040} /* Cn */, { 0x3097, 0x3098} /* Cn */, + { 0x3100, 0x3104} /* Cn */, { 0x312D, 0x3130} /* Cn */, + { 0x318F, 0x318F} /* Cn */, { 0x31B8, 0x31BF} /* Cn */, + { 0x31D0, 0x31EF} /* Cn */, { 0x321F, 0x321F} /* Cn */, + { 0x3244, 0x324F} /* Cn */, { 0x32FF, 0x32FF} /* Cn */, + { 0x4DB6, 0x4DBF} /* Cn */, { 0x9FBC, 0x9FFF} /* Cn */, + { 0xA48D, 0xA48F} /* Cn */, { 0xA4C7, 0xA6FF} /* Cn */, + { 0xA71B, 0xA71F} /* Cn */, { 0xA722, 0xA7FF} /* Cn */, + { 0xA82C, 0xA83F} /* Cn */, { 0xA878, 0xABFF} /* Cn */, + { 0xD7A4, 0xD7FF} /* Cn */, + { 0xD800, 0xDFFF} /* Cs */, + { 0xE000, 0xF8FF} /* Co */, + { 0xFA2E, 0xFA2F} /* Cn */, { 0xFA6B, 0xFA6F} /* Cn */, + { 0xFADA, 0xFAFF} /* Cn */, { 0xFB07, 0xFB12} /* Cn */, + { 0xFB18, 0xFB1C} /* Cn */, { 0xFB37, 0xFB37} /* Cn */, + { 0xFB3D, 0xFB3D} /* Cn */, { 0xFB3F, 0xFB3F} /* Cn */, + { 0xFB42, 0xFB42} /* Cn */, { 0xFB45, 0xFB45} /* Cn */, + { 0xFBB2, 0xFBD2} /* Cn */, { 0xFD40, 0xFD4F} /* Cn */, + { 0xFD90, 0xFD91} /* Cn */, { 0xFDC8, 0xFDEF} /* Cn */, + { 0xFDFE, 0xFDFF} /* Cn */, { 0xFE1A, 0xFE1F} /* Cn */, + { 0xFE24, 0xFE2F} /* Cn */, { 0xFE53, 0xFE53} /* Cn */, + { 0xFE67, 0xFE67} /* Cn */, { 0xFE6C, 0xFE6F} /* Cn */, + { 0xFE75, 0xFE75} /* Cn */, { 0xFEFD, 0xFEFE} /* Cn */, + { 0xFEFF, 0xFEFF} /* Cf */, + { 0xFF00, 0xFF00} /* Cn */, { 0xFFBF, 0xFFC1} /* Cn */, + { 0xFFC8, 0xFFC9} /* Cn */, { 0xFFD0, 0xFFD1} /* Cn */, + { 0xFFD8, 0xFFD9} /* Cn */, { 0xFFDD, 0xFFDF} /* Cn */, + { 0xFFE7, 0xFFE7} /* Cn */, { 0xFFEF, 0xFFF8} /* Cn */, + { 0xFFF9, 0xFFFB} /* Cf */, + { 0xFFFE, 0xFFFF} /* Cn */, { 0x1000C, 0x1000C} /* Cn */, + { 0x10027, 0x10027} /* Cn */, { 0x1003B, 0x1003B} /* Cn */, + { 0x1003E, 0x1003E} /* Cn */, { 0x1004E, 0x1004F} /* Cn */, + { 0x1005E, 0x1007F} /* Cn */, { 0x100FB, 0x100FF} /* Cn */, + { 0x10103, 0x10106} /* Cn */, { 0x10134, 0x10136} /* Cn */, + { 0x1018B, 0x102FF} /* Cn */, { 0x1031F, 0x1031F} /* Cn */, + { 0x10324, 0x1032F} /* Cn */, { 0x1034B, 0x1037F} /* Cn */, + { 0x1039E, 0x1039E} /* Cn */, { 0x103C4, 0x103C7} /* Cn */, + { 0x103D6, 0x103FF} /* Cn */, + { 0x1049E, 0x1049F} /* Cn */, { 0x104AA, 0x107FF} /* Cn */, + { 0x10806, 0x10807} /* Cn */, { 0x10809, 0x10809} /* Cn */, + { 0x10836, 0x10836} /* Cn */, { 0x10839, 0x1083B} /* Cn */, + { 0x1083D, 0x1083E} /* Cn */, { 0x10840, 0x108FF} /* Cn */, + { 0x1091A, 0x1091E} /* Cn */, { 0x10920, 0x109FF} /* Cn */, + { 0x10A04, 0x10A04} /* Cn */, { 0x10A07, 0x10A0B} /* Cn */, + { 0x10A14, 0x10A14} /* Cn */, { 0x10A18, 0x10A18} /* Cn */, + { 0x10A34, 0x10A37} /* Cn */, { 0x10A3B, 0x10A3E} /* Cn */, + { 0x10A48, 0x10A4F} /* Cn */, { 0x10A59, 0x11FFF} /* Cn */, + { 0x1236F, 0x123FF} /* Cn */, { 0x12463, 0x1246F} /* Cn */, + { 0x12474, 0x1CFFF} /* Cn */, { 0x1D0F6, 0x1D0FF} /* Cn */, + { 0x1D127, 0x1D129} /* Cn */, + { 0x1D173, 0x1D17A} /* Cf */, + { 0x1D1DE, 0x1D1FF} /* Cn */, { 0x1D246, 0x1D2FF} /* Cn */, + { 0x1D357, 0x1D35F} /* Cn */, { 0x1D372, 0x1D3FF} /* Cn */, + { 0x1D455, 0x1D455} /* Cn */, { 0x1D49D, 0x1D49D} /* Cn */, + { 0x1D4A0, 0x1D4A1} /* Cn */, { 0x1D4A3, 0x1D4A4} /* Cn */, + { 0x1D4A7, 0x1D4A8} /* Cn */, { 0x1D4AD, 0x1D4AD} /* Cn */, + { 0x1D4BA, 0x1D4BA} /* Cn */, { 0x1D4BC, 0x1D4BC} /* Cn */, + { 0x1D4C4, 0x1D4C4} /* Cn */, { 0x1D506, 0x1D506} /* Cn */, + { 0x1D50B, 0x1D50C} /* Cn */, { 0x1D515, 0x1D515} /* Cn */, + { 0x1D51D, 0x1D51D} /* Cn */, { 0x1D53A, 0x1D53A} /* Cn */, + { 0x1D53F, 0x1D53F} /* Cn */, { 0x1D545, 0x1D545} /* Cn */, + { 0x1D547, 0x1D549} /* Cn */, { 0x1D551, 0x1D551} /* Cn */, + { 0x1D6A6, 0x1D6A7} /* Cn */, { 0x1D7CC, 0x1D7CD} /* Cn */, + { 0x1D800, 0x1FFFF} /* Cn */, { 0x2A6D7, 0x2F7FF} /* Cn */, + { 0x2FA1E, 0xE0000} /* Cn */, + { 0xE0001, 0xE0001} /* Cf */, + { 0xE0002, 0xE001F} /* Cn */, + { 0xE0020, 0xE007F} /* Cf */, + { 0xE0080, 0xE00FF} /* Cn */, { 0xE01F0, 0xEFFFF} /* Cn */, + { 0xF0000, 0xFFFFD} /* Co */, + { 0xFFFFE, 0xFFFFF} /* Cn */, + {0x100000,0x10FFFD} /* Co */, + {0x10FFFE,0x10FFFF} /* Cn */, + {0x110000,0x7FFFFFFF} /* ISO 10646?? */ +}; + +/* + * Double width characters + * W: East Asian Wide + * F: East Asian Full-width + * Unassigned code points may be included when they allow ranges to be merged. + * Last synched with + * + * dated 2005-11-08T01:32:56Z + */ +static struct wchar_range wide_table[] = { + { 0x1100, 0x115F} /* W */, { 0x2329, 0x232A} /* W */, + { 0x2E80, 0x2FFB} /* W */, + { 0x3000, 0x3000} /* F */, + { 0x3001, 0x303E} /* W */, { 0x3041, 0x4DB5} /* W */, + { 0x4E00, 0x9FBB} /* W */, { 0xA000, 0xA4C6} /* W */, + { 0xAC00, 0xD7A3} /* W */, { 0xF900, 0xFAD9} /* W */, + { 0xFE10, 0xFE19} /* W */, { 0xFE30, 0xFE6B} /* W */, + { 0xFF01, 0xFF60} /* F */, { 0xFFE0, 0xFFE6} /* F */, + { 0x20000, 0x2FFFD} /* W */, { 0x30000, 0x3FFFD} /* W */, +}; + + static int +is_in_table(ch, table, tsize) + LWCHAR ch; + struct wchar_range table[]; + int tsize; +{ + int hi; + int lo; + + /* Binary search in the table. */ + if (ch < table[0].first) + return 0; + lo = 0; + hi = tsize - 1; + while (lo <= hi) + { + int mid = (lo + hi) / 2; + if (ch > table[mid].last) + lo = mid + 1; + else if (ch < table[mid].first) + hi = mid - 1; + else + return 1; + } + return 0; +} + +/* + * Is a character a UTF-8 composing character? + * If a composing character follows any char, the two combine into one glyph. + */ + public int +is_composing_char(ch) + LWCHAR ch; +{ + return is_in_table(ch, comp_table, (sizeof(comp_table) / sizeof(*comp_table))); +} + +/* + * Should this UTF-8 character be treated as binary? + */ + public int +is_ubin_char(ch) + LWCHAR ch; +{ + return is_in_table(ch, ubin_table, (sizeof(ubin_table) / sizeof(*ubin_table))); +} + +/* + * Is this a double width UTF-8 character? + */ + public int +is_wide_char(ch) + LWCHAR ch; +{ + return is_in_table(ch, wide_table, (sizeof(wide_table) / sizeof(*wide_table))); +} + +/* + * Is a character a UTF-8 combining character? + * A combining char acts like an ordinary char, but if it follows + * a specific char (not any char), the two combine into one glyph. + */ + public int +is_combining_char(ch1, ch2) + LWCHAR ch1; + LWCHAR ch2; +{ + /* The table is small; use linear search. */ + int i; + for (i = 0; i < sizeof(comb_table)/sizeof(*comb_table); i++) + { + if (ch1 == comb_table[i].first && + ch2 == comb_table[i].last) + return 1; + } + return 0; +} + diff --git a/commands/less/less/charset.h b/external/bsd/less/dist/charset.h similarity index 87% rename from commands/less/less/charset.h rename to external/bsd/less/dist/charset.h index 237a36015..0d494c3ca 100644 --- a/commands/less/less/charset.h +++ b/external/bsd/less/dist/charset.h @@ -1,5 +1,7 @@ +/* $NetBSD: charset.h,v 1.2 2011/07/03 19:51:26 tron Exp $ */ + /* - * Copyright (C) 2005 Mark Nudelman + * Copyright (C) 2005-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/commands/less/less/cmd.h b/external/bsd/less/dist/cmd.h similarity index 95% rename from commands/less/less/cmd.h rename to external/bsd/less/dist/cmd.h index 8e71f0384..442637d3c 100644 --- a/commands/less/less/cmd.h +++ b/external/bsd/less/dist/cmd.h @@ -1,5 +1,7 @@ +/* $NetBSD: cmd.h,v 1.2 2011/07/03 19:51:26 tron Exp $ */ + /* - * Copyright (C) 1984-2004 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -65,6 +67,7 @@ #define A_REMOVE_FILE 52 #define A_NEXT_TAG 53 #define A_PREV_TAG 54 +#define A_FILTER 55 #define A_INVALID 100 #define A_NOACTION 101 @@ -97,6 +100,7 @@ #define EC_F_COMPLETE 17 #define EC_B_COMPLETE 18 #define EC_LITERAL 19 +#define EC_ABORT 20 #define EC_NOACTION 101 #define EC_UINVALID 102 diff --git a/commands/less/less/cmdbuf.c b/external/bsd/less/dist/cmdbuf.c similarity index 94% rename from commands/less/less/cmdbuf.c rename to external/bsd/less/dist/cmdbuf.c index 06a7764e1..f51c17eb9 100644 --- a/commands/less/less/cmdbuf.c +++ b/external/bsd/less/dist/cmdbuf.c @@ -1,7 +1,7 @@ -/* $NetBSD: cmdbuf.c,v 1.7 2006/10/26 01:33:08 mrg Exp $ */ +/* $NetBSD: cmdbuf.c,v 1.3 2011/07/03 20:14:12 tron Exp $ */ /* - * Copyright (C) 1984-2005 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -22,6 +22,9 @@ #if HAVE_STAT #include #endif +#if HAVE_ERRNO_H +#include +#endif extern int sc_width; extern int utf_mode; @@ -86,22 +89,23 @@ struct mlist struct mlist *prev; struct mlist *curr_mp; char *string; + int modified; }; /* * These are the various command histories that exist. */ struct mlist mlist_search = - { &mlist_search, &mlist_search, &mlist_search, NULL }; + { &mlist_search, &mlist_search, &mlist_search, NULL, 0 }; public void * constant ml_search = (void *) &mlist_search; struct mlist mlist_examine = - { &mlist_examine, &mlist_examine, &mlist_examine, NULL }; + { &mlist_examine, &mlist_examine, &mlist_examine, NULL, 0 }; public void * constant ml_examine = (void *) &mlist_examine; #if SHELL_ESCAPE || PIPEC struct mlist mlist_shell = - { &mlist_shell, &mlist_shell, &mlist_shell, NULL }; + { &mlist_shell, &mlist_shell, &mlist_shell, NULL, 0 }; public void * constant ml_shell = (void *) &mlist_shell; #endif @@ -142,12 +146,11 @@ cmd_reset() } /* - * Clear command line on display. + * Clear command line. */ public void clear_cmd() { - clear_bot(); cmd_col = prompt_col = 0; cmd_mbc_buf_len = 0; } @@ -680,12 +683,14 @@ set_mlist(mlist, cmdflags) void *mlist; int cmdflags; { +#if CMD_HISTORY curr_mlist = (struct mlist *) mlist; curr_cmdflags = cmdflags; /* Make sure the next up-arrow moves to the last string in the mlist. */ if (curr_mlist != NULL) curr_mlist->curr_mp = curr_mlist; +#endif } #if CMD_HISTORY @@ -785,6 +790,7 @@ cmd_accept() if (curr_mlist == NULL) return; cmd_addhist(curr_mlist, cmdbuf); + curr_mlist->modified = 1; #endif } @@ -872,6 +878,10 @@ cmd_edit(c) case EC_LINEKILL: not_in_completion(); return (cmd_kill()); + case EC_ABORT: + not_in_completion(); + (void) cmd_kill(); + return (CC_QUIT); case EC_W_BACKSPACE: not_in_completion(); return (cmd_werase()); @@ -1293,13 +1303,21 @@ cmd_char(c) * Return the number currently in the command buffer. */ public LINENUM -cmd_int() +cmd_int(frac) + long *frac; { - register char *p; + char *p; LINENUM n = 0; + int err; - for (p = cmdbuf; *p != '\0'; p++) - n = (10 * n) + (*p - '0'); + for (p = cmdbuf; *p >= '0' && *p <= '9'; p++) + n = (n * 10) + (*p - '0'); + *frac = 0; + if (*p++ == '.') + { + *frac = getfraction(&p, NULL, &err); + /* {{ do something if err is set? }} */ + } return (n); } @@ -1312,6 +1330,19 @@ get_cmdbuf() return (cmdbuf); } +#if CMD_HISTORY +/* + * Return the last (most recent) string in the current command history. + */ + public char * +cmd_lastpattern() +{ + if (curr_mlist == NULL) + return (NULL); + return (curr_mlist->curr_mp->prev->string); +} +#endif + #if CMD_HISTORY /* * Get the name of the history file. @@ -1327,7 +1358,7 @@ histfile_name() name = lgetenv("LESSHISTFILE"); if (name != NULL && *name != '\0') { - if (strcmp(name, "-") == 0) + if (strcmp(name, "-") == 0 || strcmp(name, "/dev/null") == 0) /* $LESSHISTFILE == "-" means don't use a history file. */ return (NULL); return (save(name)); @@ -1362,10 +1393,20 @@ init_cmdhist() char *filename; FILE *f; char *p; +#ifdef HAVE_STAT + struct stat st; +#endif filename = histfile_name(); if (filename == NULL) return; +#ifdef HAVE_STAT + /* ignore devices/fifos; allow symlinks */ + if (stat(filename, &st) < 0) + return; + if (!S_ISREG(st.st_mode)) + return; +#endif f = fopen(filename, "r"); free(filename); if (f == NULL) @@ -1388,11 +1429,14 @@ init_cmdhist() } if (strcmp(line, HISTFILE_SEARCH_SECTION) == 0) ml = &mlist_search; -#if SHELL_ESCAPE || PIPEC else if (strcmp(line, HISTFILE_SHELL_SECTION) == 0) + { +#if SHELL_ESCAPE || PIPEC ml = &mlist_shell; +#else + ml = NULL; #endif - else if (*line == '"') + } else if (*line == '"') { if (ml != NULL) cmd_addhist(ml, line+1); @@ -1442,17 +1486,37 @@ save_cmdhist() #if CMD_HISTORY char *filename; FILE *f; + int modified = 0; filename = histfile_name(); if (filename == NULL) return; + if (mlist_search.modified) + modified = 1; +#if SHELL_ESCAPE || PIPEC + if (mlist_shell.modified) + modified = 1; +#endif + if (!modified) + return; f = fopen(filename, "w"); free(filename); if (f == NULL) return; #if HAVE_FCHMOD +{ /* Make history file readable only by owner. */ - fchmod(fileno(f), 0600); + int do_chmod = 1; +#if HAVE_STAT + struct stat statbuf; + int r = fstat(fileno(f), &statbuf); + if (r < 0 || !S_ISREG(statbuf.st_mode)) + /* Don't chmod if not a regular file. */ + do_chmod = 0; +#endif + if (do_chmod) + fchmod(fileno(f), 0600); +} #endif fprintf(f, "%s\n", HISTFILE_FIRST_LINE); diff --git a/commands/less/less/command.c b/external/bsd/less/dist/command.c similarity index 74% rename from commands/less/less/command.c rename to external/bsd/less/dist/command.c index 042ce18fb..1913a27b7 100644 --- a/commands/less/less/command.c +++ b/external/bsd/less/dist/command.c @@ -1,7 +1,7 @@ -/* $NetBSD: command.c,v 1.14 2008/02/16 07:20:54 matt Exp $ */ +/* $NetBSD: command.c,v 1.4 2011/07/04 12:31:53 joerg Exp $ */ /* - * Copyright (C) 1984-2005 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -25,10 +25,8 @@ extern int erase_char, erase2_char, kill_char; extern int sigs; -extern int quit_at_eof; extern int quit_if_one_screen; extern int squished; -extern int hit_eof; extern int sc_width; extern int sc_height; extern int swindow; @@ -40,16 +38,15 @@ extern int ignore_eoi; 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[]; extern struct scrpos initial_scrpos; extern IFILE curr_ifile; -extern void *constant ml_search; -extern void *constant ml_examine; +extern void constant *ml_search; +extern void * constant ml_examine; #if SHELL_ESCAPE || PIPEC -extern void *constant ml_shell; +extern void * constant ml_shell; #endif #if EDITOR extern char *editor; @@ -57,19 +54,22 @@ extern char *editproto; #endif extern int screen_trashed; /* The screen has been overwritten */ extern int shift_count; +extern int oldbot; +extern int forw_prompt; extern int be_helpful; +extern int more_mode; -public int helpprompt; +static int helpprompt; -static char ungot[UNGOT_SIZE]; -static char *ungotp = NULL; #if SHELL_ESCAPE static char *shellcmd = NULL; /* For holding last shell command for "!!" */ #endif static int mca; /* The multicharacter command (action) */ static int search_type; /* The previous type of search */ static LINENUM number; /* The number typed by the user */ -static char optchar; +static long fraction; /* The fractional part of the number */ +static struct loption *curropt; +static int opt_lower; static int optflag; static int optgetname; static POSITION bottompos; @@ -78,25 +78,27 @@ static int save_hshift; static char pipec; #endif -static void cmd_exec __P((void)); -static void start_mca __P((int, char *, constant void *, int)); -static void mca_search __P((void)); -static void exec_mca __P((void)); -static int mca_char __P((int)); -static void make_display __P((void)); -static void prompt __P((void)); -static void multi_search __P((char *, int)); +struct ungot { + struct ungot *ug_next; + char ug_char; +}; +static struct ungot* ungot = NULL; +static int unget_end = 0; + +static void multi_search(); /* - * Move the cursor to lower left before executing a command. + * Move the cursor to start of prompt line before executing a command. * This looks nicer if the command takes a long time before * updating the screen. */ static void cmd_exec() { +#if HILITE_SEARCH clear_attn(); - lower_left(); +#endif + clear_bot(); flush(); } @@ -107,10 +109,11 @@ cmd_exec() start_mca(action, prompt, mlist, cmdflags) int action; char *prompt; - constant void *mlist; + void *mlist; int cmdflags; { mca = action; + clear_bot(); clear_cmd(); cmd_putstr(prompt); set_mlist(mlist, cmdflags); @@ -128,11 +131,17 @@ in_mca() static void mca_search() { +#if HILITE_SEARCH + if (search_type & SRCH_FILTER) + mca = A_FILTER; + else +#endif if (search_type & SRCH_FORW) mca = A_F_SEARCH; else mca = A_B_SEARCH; + clear_bot(); clear_cmd(); if (search_type & SRCH_NO_MATCH) @@ -146,6 +155,11 @@ mca_search() if (search_type & SRCH_NO_REGEX) cmd_putstr("Regex-off "); +#if HILITE_SEARCH + if (search_type & SRCH_FILTER) + cmd_putstr("&/"); + else +#endif if (search_type & SRCH_FORW) cmd_putstr("/"); else @@ -168,6 +182,7 @@ mca_opt_toggle() dash = (flag == OPT_NO_TOGGLE) ? "_" : "-"; mca = A_OPT_TOGGLE; + clear_bot(); clear_cmd(); cmd_putstr(dash); if (optgetname) @@ -203,6 +218,12 @@ exec_mca() case A_B_SEARCH: multi_search(cbuf, (int) number); break; +#if HILITE_SEARCH + case A_FILTER: + search_type ^= SRCH_NO_MATCH; + set_filter_pattern(cbuf, search_type); + break; +#endif case A_FIRSTCMD: /* * Skip leading spaces or + signs in the string. @@ -217,8 +238,8 @@ exec_mca() every_first_cmd = save(cbuf); break; case A_OPT_TOGGLE: - toggle_option((unsigned char)optchar, cbuf, optflag); - optchar = '\0'; + toggle_option(curropt, opt_lower, cbuf, optflag); + curropt = NULL; break; case A_F_BRACKET: match_brac(cbuf[0], cbuf[1], 1, (int) number); @@ -271,22 +292,254 @@ exec_mca() } /* - * Add a character to a multi-character command. + * Is a character an erase or kill char? */ static int -mca_char(c) +is_erase_char(c) + int c; +{ + return (c == erase_char || c == erase2_char || c == kill_char); +} + +/* + * Handle the first char of an option (after the initial dash). + */ + static int +mca_opt_first_char(c) + int c; +{ + int flag = (optflag & ~OPT_NO_PROMPT); + if (flag == OPT_NO_TOGGLE) + { + switch (c) + { + case '_': + /* "__" = long option name. */ + optgetname = TRUE; + mca_opt_toggle(); + return (MCA_MORE); + } + } else + { + switch (c) + { + case '+': + /* "-+" = UNSET. */ + optflag = (flag == OPT_UNSET) ? + OPT_TOGGLE : OPT_UNSET; + mca_opt_toggle(); + return (MCA_MORE); + case '!': + /* "-!" = SET */ + optflag = (flag == OPT_SET) ? + OPT_TOGGLE : OPT_SET; + mca_opt_toggle(); + return (MCA_MORE); + case CONTROL('P'): + optflag ^= OPT_NO_PROMPT; + mca_opt_toggle(); + return (MCA_MORE); + case '-': + /* "--" = long option name. */ + optgetname = TRUE; + mca_opt_toggle(); + return (MCA_MORE); + } + } + /* Char was not handled here. */ + return (NO_MCA); +} + +/* + * Add a char to a long option name. + * See if we've got a match for an option name yet. + * If so, display the complete name and stop + * accepting chars until user hits RETURN. + */ + static int +mca_opt_nonfirst_char(c) int c; { char *p; - int flag; - char buf[3]; + char *oname; + + if (curropt != NULL) + { + /* + * Already have a match for the name. + * Don't accept anything but erase/kill. + */ + if (is_erase_char(c)) + return (MCA_DONE); + return (MCA_MORE); + } + /* + * Add char to cmd buffer and try to match + * the option name. + */ + if (cmd_char(c) == CC_QUIT) + return (MCA_DONE); + p = get_cmdbuf(); + opt_lower = ASCII_IS_LOWER(p[0]); + curropt = findopt_name(&p, &oname, NULL); + if (curropt != NULL) + { + /* + * Got a match. + * Remember the option and + * display the full option name. + */ + cmd_reset(); + mca_opt_toggle(); + for (p = oname; *p != '\0'; p++) + { + c = *p; + if (!opt_lower && ASCII_IS_LOWER(c)) + c = ASCII_TO_UPPER(c); + if (cmd_char(c) != CC_OK) + return (MCA_DONE); + } + } + return (MCA_MORE); +} + +/* + * Handle a char of an option toggle command. + */ + static int +mca_opt_char(c) + int c; +{ PARG parg; + /* + * This may be a short option (single char), + * or one char of a long option name, + * or one char of the option parameter. + */ + if (curropt == NULL && len_cmdbuf() == 0) + { + int ret = mca_opt_first_char(c); + if (ret != NO_MCA) + return (ret); + } + if (optgetname) + { + /* We're getting a long option name. */ + if (c != '\n' && c != '\r') + return (mca_opt_nonfirst_char(c)); + if (curropt == NULL) + { + parg.p_string = get_cmdbuf(); + error("There is no --%s option", &parg); + return (MCA_DONE); + } + optgetname = FALSE; + cmd_reset(); + } else + { + if (is_erase_char(c)) + return (NO_MCA); + if (curropt != NULL) + /* We're getting the option parameter. */ + return (NO_MCA); + curropt = findopt(c); + if (curropt == NULL) + { + parg.p_string = propt(c); + error("There is no %s option", &parg); + return (MCA_DONE); + } + } + /* + * If the option which was entered does not take a + * parameter, toggle the option immediately, + * so user doesn't have to hit RETURN. + */ + if ((optflag & ~OPT_NO_PROMPT) != OPT_TOGGLE || + !opt_has_param(curropt)) + { + toggle_option(curropt, ASCII_IS_LOWER(c), "", optflag); + return (MCA_DONE); + } + /* + * Display a prompt appropriate for the option parameter. + */ + start_mca(A_OPT_TOGGLE, opt_prompt(curropt), (void*)NULL, 0); + return (MCA_MORE); +} + +/* + * Handle a char of a search command. + */ + static int +mca_search_char(c) + int c; +{ + int flag = 0; + + /* + * Certain characters as the first char of + * the pattern have special meaning: + * ! Toggle the NO_MATCH flag + * * Toggle the PAST_EOF flag (less extension) + * @ Toggle the FIRST_FILE flag (less extension) + */ + if (len_cmdbuf() > 0) + return (NO_MCA); + + switch (c) + { + case '*': + if (more_mode) + break; + case CONTROL('E'): /* ignore END of file */ + if (mca != A_FILTER) + flag = SRCH_PAST_EOF; + break; + case '@': + if (more_mode) + break; + case CONTROL('F'): /* FIRST file */ + if (mca != A_FILTER) + flag = SRCH_FIRST_FILE; + break; + case CONTROL('K'): /* KEEP position */ + if (mca != A_FILTER) + flag = SRCH_NO_MOVE; + break; + case CONTROL('R'): /* Don't use REGULAR EXPRESSIONS */ + flag = SRCH_NO_REGEX; + break; + case CONTROL('N'): /* NOT match */ + case '!': + flag = SRCH_NO_MATCH; + break; + } + + if (flag != 0) + { + search_type ^= flag; + mca_search(); + return (MCA_MORE); + } + return (NO_MCA); +} + +/* + * Handle a character of a multi-character command. + */ + static int +mca_char(c) + int c; +{ + int ret; + switch (mca) { case 0: /* - * Not in a multicharacter command. + * We're not in a multicharacter command. */ return (NO_MCA); @@ -304,14 +557,15 @@ mca_char(c) * Entering digits of a number. * Terminated by a non-digit. */ - if ((c < '0' || c > '9') && + if (!((c >= '0' && c <= '9') || c == '.') && editchar(c, EC_PEEK|EC_NOHISTORY|EC_NOCOMPLETE|EC_NORIGHTLEFT) == A_INVALID) { /* * Not part of the number. - * Treat as a normal command character. + * End the number and treat this char + * as a normal command character. */ - number = cmd_int(); + number = cmd_int(&fraction); mca = 0; cmd_accept(); return (NO_MCA); @@ -319,214 +573,26 @@ mca_char(c) break; case A_OPT_TOGGLE: - /* - * Special case for the TOGGLE_OPTION command. - * If the option letter which was entered is a - * single-char option, execute the command immediately, - * so user doesn't have to hit RETURN. - * If the first char is + or -, this indicates - * OPT_UNSET or OPT_SET respectively, instead of OPT_TOGGLE. - * "--" begins inputting a long option name. - */ - if (optchar == '\0' && len_cmdbuf() == 0) - { - flag = (optflag & ~OPT_NO_PROMPT); - if (flag == OPT_NO_TOGGLE) - { - switch (c) - { - case '_': - /* "__" = long option name. */ - optgetname = TRUE; - mca_opt_toggle(); - return (MCA_MORE); - } - } else - { - switch (c) - { - case '+': - /* "-+" = UNSET. */ - optflag = (flag == OPT_UNSET) ? - OPT_TOGGLE : OPT_UNSET; - mca_opt_toggle(); - return (MCA_MORE); - case '!': - /* "-!" = SET */ - optflag = (flag == OPT_SET) ? - OPT_TOGGLE : OPT_SET; - mca_opt_toggle(); - return (MCA_MORE); - case CONTROL('P'): - optflag ^= OPT_NO_PROMPT; - mca_opt_toggle(); - return (MCA_MORE); - case '-': - /* "--" = long option name. */ - optgetname = TRUE; - mca_opt_toggle(); - return (MCA_MORE); - } - } - } - if (optgetname) - { - /* - * We're getting a long option name. - * See if we've matched an option name yet. - * If so, display the complete name and stop - * accepting chars until user hits RETURN. - */ - struct loption *o; - char *oname; - int lc; - - if (c == '\n' || c == '\r') - { - /* - * When the user hits RETURN, make sure - * we've matched an option name, then - * pretend he just entered the equivalent - * option letter. - */ - if (optchar == '\0') - { - parg.p_string = get_cmdbuf(); - error("There is no --%s option", &parg); - return (MCA_DONE); - } - optgetname = FALSE; - cmd_reset(); - c = optchar; - } else - { - if (optchar != '\0') - { - /* - * Already have a match for the name. - * Don't accept anything but erase/kill. - */ - if (c == erase_char || - c == erase2_char || - c == kill_char) - return (MCA_DONE); - return (MCA_MORE); - } - /* - * Add char to cmd buffer and try to match - * the option name. - */ - if (cmd_char(c) == CC_QUIT) - return (MCA_DONE); - p = get_cmdbuf(); - lc = ASCII_IS_LOWER(p[0]); - o = findopt_name(&p, &oname, NULL); - if (o != NULL) - { - /* - * Got a match. - * Remember the option letter and - * display the full option name. - */ - optchar = o->oletter; - if (!lc && ASCII_IS_LOWER(optchar)) - optchar = ASCII_TO_UPPER(optchar); - cmd_reset(); - mca_opt_toggle(); - for (p = oname; *p != '\0'; p++) - { - c = *p; - if (!lc && ASCII_IS_LOWER(c)) - c = ASCII_TO_UPPER(c); - if (cmd_char(c) != CC_OK) - return (MCA_DONE); - } - } - return (MCA_MORE); - } - } else - { - if (c == erase_char || c == erase2_char || c == kill_char) - break; - if (optchar != '\0') - /* We already have the option letter. */ - break; - } - - optchar = c; - if ((optflag & ~OPT_NO_PROMPT) != OPT_TOGGLE || - single_char_option(c)) - { - toggle_option(c, "", optflag); - return (MCA_DONE); - } - /* - * Display a prompt appropriate for the option letter. - */ - if ((p = opt_prompt(c)) == NULL) - { - buf[0] = '-'; - buf[1] = c; - buf[2] = '\0'; - p = buf; - } - start_mca(A_OPT_TOGGLE, p, (void*)NULL, 0); - return (MCA_MORE); + ret = mca_opt_char(c); + if (ret != NO_MCA) + return (ret); + break; case A_F_SEARCH: case A_B_SEARCH: - /* - * Special case for search commands. - * Certain characters as the first char of - * the pattern have special meaning: - * ! Toggle the NO_MATCH flag - * * Toggle the PAST_EOF flag (less extension) - * @ Toggle the FIRST_FILE flag (less extension) - */ - if (len_cmdbuf() > 0) - /* - * Only works for the first char of the pattern. - */ - break; + case A_FILTER: + ret = mca_search_char(c); + if (ret != NO_MCA) + return (ret); + break; - flag = 0; - switch (c) - { - case '*': - if (more_mode) - break; - case CONTROL('E'): /* ignore END of file */ - flag = SRCH_PAST_EOF; - break; - case '@': - if (more_mode) - break; - case CONTROL('F'): /* FIRST file */ - flag = SRCH_FIRST_FILE; - break; - case CONTROL('K'): /* KEEP position */ - flag = SRCH_NO_MOVE; - break; - case CONTROL('R'): /* Don't use REGULAR EXPRESSIONS */ - flag = SRCH_NO_REGEX; - break; - case CONTROL('N'): /* NOT match */ - case '!': - flag = SRCH_NO_MATCH; - break; - } - if (flag != 0) - { - search_type ^= flag; - mca_search(); - return (MCA_MORE); - } + default: + /* Other multicharacter command. */ break; } /* - * Any other multicharacter command - * is terminated by a newline. + * The multichar command is terminated by a newline. */ if (c == '\n' || c == '\r') { @@ -563,6 +629,21 @@ mca_char(c) return (MCA_MORE); } +/* + * Discard any buffered file data. + */ + static void +clear_buffers() +{ + if (!(ch_getflags() & CH_CANSEEK)) + return; + ch_flush(); + clr_linenum(); +#if HILITE_SEARCH + clr_hilite(); +#endif +} + /* * Make sure the screen is displayed. */ @@ -586,11 +667,20 @@ make_display() jump_loc(initial_scrpos.pos, initial_scrpos.ln); } else if (screen_trashed) { - int save_top_scroll; - save_top_scroll = top_scroll; + int save_top_scroll = top_scroll; + int save_ignore_eoi = ignore_eoi; top_scroll = 1; + ignore_eoi = 0; + if (screen_trashed == 2) + { + /* Special case used by ignore_eoi: re-open the input file + * and jump to the end of the file. */ + reopen_curr_ifile(); + jump_forw(); + } repaint(); top_scroll = save_top_scroll; + ignore_eoi = save_ignore_eoi; } } @@ -602,7 +692,7 @@ prompt() { register char *p; - if (ungotp != NULL && ungotp > ungot) + if (ungot != NULL) { /* * No prompt necessary if commands are from @@ -618,25 +708,20 @@ prompt() bottompos = position(BOTTOM_PLUS_ONE); /* - * If we've hit EOF on the last file, and the -E flag is set - * (or -F is set and this is the first prompt), then quit. - * {{ Relying on "first prompt" to detect a single-screen file - * fails if +G is used, for example. }} + * If we've hit EOF on the last file and the -E flag is set, quit. */ - if ((quit_at_eof == OPT_ONPLUS || quit_if_one_screen) && - hit_eof && !(ch_getflags() & CH_HELPFILE) && + if (get_quit_at_eof() == OPT_ONPLUS && + eof_displayed() && !(ch_getflags() & CH_HELPFILE) && next_ifile(curr_ifile) == NULL_IFILE) quit(QUIT_OK); - quit_if_one_screen = FALSE; -#if 0 /* This doesn't work well because some "te"s clear the screen. */ + /* - * If the -e flag is set and we've hit EOF on the last file, - * and the file is squished (shorter than the screen), quit. + * If the entire file is displayed and the -F flag is set, quit. */ - if (quit_at_eof && squished && + if (quit_if_one_screen && + entire_file_displayed() && !(ch_getflags() & CH_HELPFILE) && next_ifile(curr_ifile) == NULL_IFILE) quit(QUIT_OK); -#endif #if MSDOS_COMPILER==WIN32C /* @@ -648,7 +733,20 @@ prompt() /* * Select the proper prompt and display it. */ + /* + * If the previous action was a forward movement, + * don't clear the bottom line of the display; + * just print the prompt since the forward movement guarantees + * that we're in the right position to display the prompt. + * Clearing the line could cause a problem: for example, if the last + * line displayed ended at the right screen edge without a newline, + * then clearing would clear the last displayed line rather than + * the prompt line. + */ + if (!forw_prompt) + clear_bot(); clear_cmd(); + forw_prompt = 0; if (helpprompt) { at_enter(AT_STANDOUT); putstr("[Press 'h' for instructions.]"); @@ -656,17 +754,18 @@ prompt() helpprompt = 0; } else { p = pr_string(); + if (is_filtering()) + putstr("& "); if (p == NULL || *p == '\0') putchr(':'); else { at_enter(AT_STANDOUT); putstr(p); - if (be_helpful) - putstr(" [Press space to continue, 'q' to quit.]"); at_exit(); } } + clear_eol(); } /* @@ -690,48 +789,59 @@ dispversion() public int getcc() { - if (ungotp == NULL) + if (unget_end) + { /* - * Normal case: no ungotten chars, so get one from the user. + * We have just run out of ungotten chars. */ - return (getchr()); - - if (ungotp > ungot) + unget_end = 0; + if (len_cmdbuf() == 0 || !empty_screen()) + return (getchr()); /* - * Return the next ungotten char. + * Command is incomplete, so try to complete it. */ - return (*--ungotp); + switch (mca) + { + case A_DIGIT: + /* + * We have a number but no command. Treat as #g. + */ + return ('g'); - /* - * We have just run out of ungotten chars. - */ - ungotp = NULL; - if (len_cmdbuf() == 0 || !empty_screen()) - return (getchr()); - /* - * Command is incomplete, so try to complete it. - */ - switch (mca) - { - case A_DIGIT: - /* - * We have a number but no command. Treat as #g. - */ - return ('g'); + case A_F_SEARCH: + case A_B_SEARCH: + /* + * We have "/string" but no newline. Add the \n. + */ + return ('\n'); - case A_F_SEARCH: - case A_B_SEARCH: - /* - * We have "/string" but no newline. Add the \n. - */ - return ('\n'); + default: + /* + * Some other incomplete command. Let user complete it. + */ + return (getchr()); + } + } - default: + if (ungot == NULL) + { /* - * Some other incomplete command. Let user complete it. + * Normal case: no ungotten chars, so get one from the user. */ return (getchr()); } + + /* + * Return the next ungotten char. + */ + { + struct ungot *ug = ungot; + char c = ug->ug_char; + ungot = ug->ug_next; + free(ug); + unget_end = (ungot == NULL); + return (c); + } } /* @@ -742,14 +852,12 @@ getcc() ungetcc(c) int c; { - if (ungotp == NULL) - ungotp = ungot; - if (ungotp >= ungot + sizeof(ungot)) - { - error("ungetcc overflow", NULL_PARG); - quit(QUIT_ERROR); - } - *ungotp++ = c; + struct ungot *ug = (struct ungot *) ecalloc(1, sizeof(struct ungot)); + + ug->ug_char = c; + ug->ug_next = ungot; + ungot = ug; + unget_end = 0; } /* @@ -871,7 +979,7 @@ multi_search(pattern, n) public void commands() { - register int c = 0; + register int c; register int action; register char *cbuf; int newaction; @@ -892,7 +1000,7 @@ commands() mca = 0; cmd_accept(); number = 0; - optchar = '\0'; + curropt = NULL; /* * See if any signals need processing. @@ -1114,9 +1222,11 @@ commands() cmd_exec(); jump_forw(); ignore_eoi = 1; - hit_eof = 0; while (!sigs) + { + make_display(); forward(1, 0, 0); + } ignore_eoi = 0; /* * This gets us back in "F mode" after processing @@ -1155,14 +1265,7 @@ commands() * Flush buffers, then repaint screen. * Don't flush the buffers on a pipe! */ - if (ch_getflags() & CH_CANSEEK) - { - ch_flush(); - clr_linenum(); -#if HILITE_SEARCH - clr_hilite(); -#endif - } + clear_buffers(); /* FALLTHRU */ case A_REPAINT: /* @@ -1187,11 +1290,17 @@ commands() * Go to a specified percentage into the file. */ if (number < 0) + { number = 0; + fraction = 0; + } if (number > 100) + { number = 100; + fraction = 0; + } cmd_exec(); - jump_percent((int) number); + jump_percent((int) number, fraction); break; case A_GOEND: @@ -1258,7 +1367,8 @@ commands() /* * Define abbreviation for a commonly used sequence below. */ -#define DO_SEARCH() if (number <= 0) number = 1; \ +#define DO_SEARCH() \ + if (number <= 0) number = 1; \ mca_search(); \ cmd_exec(); \ multi_search((char *)NULL, (int) number); @@ -1288,6 +1398,17 @@ commands() c = getcc(); goto again; + case A_FILTER: +#if HILITE_SEARCH + search_type = SRCH_FORW | SRCH_FILTER; + mca_search(); + c = getcc(); + goto again; +#else + error("Command not available", NULL_PARG); + break; +#endif + case A_AGAIN_SEARCH: /* * Repeat previous search. @@ -1412,7 +1533,7 @@ commands() number = 1; if (edit_next((int) number)) { - if (quit_at_eof && hit_eof && + if (get_quit_at_eof() && eof_displayed() && !(ch_getflags() & CH_HELPFILE)) quit(QUIT_OK); parg.p_string = (number > 1) ? "(N-th) " : ""; @@ -1576,6 +1697,7 @@ commands() if (c == erase_char || c == erase2_char || c == kill_char || c == '\n' || c == '\r') break; + cmd_exec(); gomark(c); break; diff --git a/external/bsd/less/dist/configure b/external/bsd/less/dist/configure new file mode 100755 index 000000000..f2a7c8c73 --- /dev/null +++ b/external/bsd/less/dist/configure @@ -0,0 +1,6740 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.67 for less 1. +# +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +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 +IFS=$as_save_IFS + + ;; +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 + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + # We cannot yet assume a decent shell, so we have to provide a + # neutralization value for shells without unset; and this also + # works around shells that cannot unset nonexistent variables. + BASH_ENV=/dev/null + ENV=/dev/null + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV + export CONFIG_SHELL + exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; 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 + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_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 sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval 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="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='less' +PACKAGE_TARNAME='less' +PACKAGE_VERSION='1' +PACKAGE_STRING='less 1' +PACKAGE_BUGREPORT='' +PACKAGE_URL='' + +ac_unique_file="forwback.c" +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='LTLIBOBJS +LIBOBJS +REGEX_O +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +EGREP +GREP +CPP +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_largefile +with_secure +with_no_float +with_regex +with_editor +' + ac_precious_vars='build_alias +host_alias +target_alias +CC +CFLAGS +LDFLAGS +LIBS +CPPFLAGS +CPP' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +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. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + 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 ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -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_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$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 ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + 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 ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + 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 | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + 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-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-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + 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 ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + 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-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 ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_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 + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# 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 + $as_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 + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# 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 the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + 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=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# 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 \`..'] + +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] + --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] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/less] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_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-option-checking ignore unrecognized --enable/--with options + --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-secure Compile in secure mode + --with-no-float Do not use floating point + --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 if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + 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. + +Report bugs to the package provider. +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested 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 + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +less configure 1 +generated by GNU Autoconf 2.67 + +Copyright (C) 2010 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 +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval "test \"\${$3+set}\"" = set; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_header_compile + +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_type + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval "test \"\${$3+set}\"" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* 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_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} + +} # ac_fn_c_check_func +cat >config.log <<_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.67. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +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` +/usr/bin/hostinfo = `(/usr/bin/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=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&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. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# 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: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > 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 + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5 ; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_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 $ac_precious_vars; 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,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_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 + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_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. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +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 + + + +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : + $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +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 $# != 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 + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_CC+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if test "${ac_cv_prog_ac_ct_CC+set}" = set; then : + $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5 ; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# 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. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5 ; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; 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 | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5 ; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5 ; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if test "${ac_cv_objext+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5 ; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if test "${ac_cv_c_compiler_gnu+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if test "${ac_cv_prog_cc_g+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if test "${ac_cv_prog_cc_c89+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +/* 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; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +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 +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +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 + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing strerror" >&5 +$as_echo_n "checking for library containing strerror... " >&6; } +if test "${ac_cv_search_strerror+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char strerror (); +int +main () +{ +return strerror (); + ; + return 0; +} +_ACEOF +for ac_lib in '' cposix; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_strerror=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if test "${ac_cv_search_strerror+set}" = set; then : + break +fi +done +if test "${ac_cv_search_strerror+set}" = set; then : + +else + ac_cv_search_strerror=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_strerror" >&5 +$as_echo "$ac_cv_search_strerror" >&6; } +ac_res=$ac_cv_search_strerror +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + +fi + +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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + # 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. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$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. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5 ; } +fi + +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 + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if test "${ac_cv_path_GREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if test "${ac_cv_path_EGREP+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +if test $ac_cv_c_compiler_gnu = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5 +$as_echo_n "checking whether $CC needs -traditional... " >&6; } +if test "${ac_cv_prog_gcc_traditional+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_pattern="Autoconf.*'x'" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +Autoconf TIOCGETP +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "$ac_pattern" >/dev/null 2>&1; then : + ac_cv_prog_gcc_traditional=yes +else + ac_cv_prog_gcc_traditional=no +fi +rm -f conftest* + + + if test $ac_cv_prog_gcc_traditional = no; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +Autoconf TCGETA +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "$ac_pattern" >/dev/null 2>&1; then : + ac_cv_prog_gcc_traditional=yes +fi +rm -f conftest* + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gcc_traditional" >&5 +$as_echo "$ac_cv_prog_gcc_traditional" >&6; } + if test $ac_cv_prog_gcc_traditional = yes; then + CC="$CC -traditional" + fi +fi + +ac_aux_dir= +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + 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 + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# 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" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if test "${ac_cv_path_install+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + 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/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /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 { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$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 + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$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}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + + +# Checks for compilation model. +# Check whether --enable-largefile was given. +if test "${enable_largefile+set}" = set; then : + enableval=$enable_largefile; +fi + +if test "$enable_largefile" != no; then + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 +$as_echo_n "checking for special C compiler options needed for large files... " >&6; } +if test "${ac_cv_sys_largefile_CC+set}" = set; then : + $as_echo_n "(cached) " >&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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* 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 + if ac_fn_c_try_compile "$LINENO"; then : + break +fi +rm -f core conftest.err conftest.$ac_objext + CC="$CC -n32" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_largefile_CC=' -n32'; break +fi +rm -f core conftest.err conftest.$ac_objext + break + done + CC=$ac_save_CC + rm -f conftest.$ac_ext + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 +$as_echo "$ac_cv_sys_largefile_CC" >&6; } + if test "$ac_cv_sys_largefile_CC" != no; then + CC=$CC$ac_cv_sys_largefile_CC + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } +if test "${ac_cv_sys_file_offset_bits+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* 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 +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_file_offset_bits=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _FILE_OFFSET_BITS 64 +#include + /* 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 +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_file_offset_bits=64; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_file_offset_bits=unknown + break +done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 +$as_echo "$ac_cv_sys_file_offset_bits" >&6; } +case $ac_cv_sys_file_offset_bits in #( + no | unknown) ;; + *) +cat >>confdefs.h <<_ACEOF +#define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits +_ACEOF +;; +esac +rm -rf conftest* + if test $ac_cv_sys_file_offset_bits = unknown; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 +$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } +if test "${ac_cv_sys_large_files+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + /* 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 +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_large_files=no; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#define _LARGE_FILES 1 +#include + /* 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 +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_sys_large_files=1; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_cv_sys_large_files=unknown + break +done +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 +$as_echo "$ac_cv_sys_large_files" >&6; } +case $ac_cv_sys_large_files in #( + no | unknown) ;; + *) +cat >>confdefs.h <<_ACEOF +#define _LARGE_FILES $ac_cv_sys_large_files +_ACEOF +;; +esac +rm -rf conftest* + fi +fi + + +# Checks for general libraries. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgoto in -ltinfo" >&5 +$as_echo_n "checking for tgoto in -ltinfo... " >&6; } +if test "${ac_cv_lib_tinfo_tgoto+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ltinfo $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char tgoto (); +int +main () +{ +return tgoto (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_tinfo_tgoto=yes +else + ac_cv_lib_tinfo_tgoto=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_tinfo_tgoto" >&5 +$as_echo "$ac_cv_lib_tinfo_tgoto" >&6; } +if test "x$ac_cv_lib_tinfo_tgoto" = x""yes; then : + have_tinfo=yes +else + have_tinfo=no +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lxcurses" >&5 +$as_echo_n "checking for initscr in -lxcurses... " >&6; } +if test "${ac_cv_lib_xcurses_initscr+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lxcurses $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char initscr (); +int +main () +{ +return initscr (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_xcurses_initscr=yes +else + ac_cv_lib_xcurses_initscr=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_xcurses_initscr" >&5 +$as_echo "$ac_cv_lib_xcurses_initscr" >&6; } +if test "x$ac_cv_lib_xcurses_initscr" = x""yes; then : + have_xcurses=yes +else + have_xcurses=no +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lncursesw" >&5 +$as_echo_n "checking for initscr in -lncursesw... " >&6; } +if test "${ac_cv_lib_ncursesw_initscr+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lncursesw $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char initscr (); +int +main () +{ +return initscr (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_ncursesw_initscr=yes +else + ac_cv_lib_ncursesw_initscr=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncursesw_initscr" >&5 +$as_echo "$ac_cv_lib_ncursesw_initscr" >&6; } +if test "x$ac_cv_lib_ncursesw_initscr" = x""yes; then : + have_ncursesw=yes +else + have_ncursesw=no +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lncurses" >&5 +$as_echo_n "checking for initscr in -lncurses... " >&6; } +if test "${ac_cv_lib_ncurses_initscr+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lncurses $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char initscr (); +int +main () +{ +return initscr (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_ncurses_initscr=yes +else + ac_cv_lib_ncurses_initscr=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncurses_initscr" >&5 +$as_echo "$ac_cv_lib_ncurses_initscr" >&6; } +if test "x$ac_cv_lib_ncurses_initscr" = x""yes; then : + have_ncurses=yes +else + have_ncurses=no +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for initscr in -lcurses" >&5 +$as_echo_n "checking for initscr in -lcurses... " >&6; } +if test "${ac_cv_lib_curses_initscr+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lcurses $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char initscr (); +int +main () +{ +return initscr (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_curses_initscr=yes +else + ac_cv_lib_curses_initscr=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_curses_initscr" >&5 +$as_echo "$ac_cv_lib_curses_initscr" >&6; } +if test "x$ac_cv_lib_curses_initscr" = x""yes; then : + have_curses=yes +else + have_curses=no +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -ltermcap" >&5 +$as_echo_n "checking for tgetent in -ltermcap... " >&6; } +if test "${ac_cv_lib_termcap_tgetent+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ltermcap $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char tgetent (); +int +main () +{ +return tgetent (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_termcap_tgetent=yes +else + ac_cv_lib_termcap_tgetent=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_termcap_tgetent" >&5 +$as_echo "$ac_cv_lib_termcap_tgetent" >&6; } +if test "x$ac_cv_lib_termcap_tgetent" = x""yes; then : + have_termcap=yes +else + have_termcap=no +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for tgetent in -ltermlib" >&5 +$as_echo_n "checking for tgetent in -ltermlib... " >&6; } +if test "${ac_cv_lib_termlib_tgetent+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ltermlib $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char tgetent (); +int +main () +{ +return tgetent (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_termlib_tgetent=yes +else + ac_cv_lib_termlib_tgetent=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_termlib_tgetent" >&5 +$as_echo "$ac_cv_lib_termlib_tgetent" >&6; } +if test "x$ac_cv_lib_termlib_tgetent" = x""yes; then : + have_termlib=yes +else + have_termlib=no +fi + +# Regular expressions (regcmp) are in -lgen on Solaris 2, +# and in -lintl on SCO Unix. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for regcmp in -lgen" >&5 +$as_echo_n "checking for regcmp in -lgen... " >&6; } +if test "${ac_cv_lib_gen_regcmp+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgen $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char regcmp (); +int +main () +{ +return regcmp (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_gen_regcmp=yes +else + ac_cv_lib_gen_regcmp=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_gen_regcmp" >&5 +$as_echo "$ac_cv_lib_gen_regcmp" >&6; } +if test "x$ac_cv_lib_gen_regcmp" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBGEN 1 +_ACEOF + + LIBS="-lgen $LIBS" + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for regcmp in -lintl" >&5 +$as_echo_n "checking for regcmp in -lintl... " >&6; } +if test "${ac_cv_lib_intl_regcmp+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lintl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char regcmp (); +int +main () +{ +return regcmp (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_intl_regcmp=yes +else + ac_cv_lib_intl_regcmp=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_regcmp" >&5 +$as_echo "$ac_cv_lib_intl_regcmp" >&6; } +if test "x$ac_cv_lib_intl_regcmp" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBINTL 1 +_ACEOF + + LIBS="-lintl $LIBS" + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for regcmp in -lPW" >&5 +$as_echo_n "checking for regcmp in -lPW... " >&6; } +if test "${ac_cv_lib_PW_regcmp+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lPW $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char regcmp (); +int +main () +{ +return regcmp (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_PW_regcmp=yes +else + ac_cv_lib_PW_regcmp=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_PW_regcmp" >&5 +$as_echo "$ac_cv_lib_PW_regcmp" >&6; } +if test "x$ac_cv_lib_PW_regcmp" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_LIBPW 1 +_ACEOF + + LIBS="-lPW $LIBS" + +fi + + +# Checks for terminal libraries +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working terminal libraries" >&5 +$as_echo_n "checking for working terminal libraries... " >&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 + 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 + +# -- Try tinfo. +if test "x$TERMLIBS" = x; then + if test $have_tinfo = yes; then + TERMLIBS="-ltinfo" + SAVE_LIBS=$LIBS + LIBS="$LIBS $TERMLIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + termok=yes +else + termok=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS=$SAVE_LIBS + if test $termok = no; then TERMLIBS=""; fi + fi +fi + +# -- Try xcurses. +if test "x$TERMLIBS" = x; then + if test $have_xcurses = yes; then + TERMLIBS="-lxcurses" + SAVE_LIBS=$LIBS + LIBS="$LIBS $TERMLIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + termok=yes +else + termok=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS=$SAVE_LIBS + if test $termok = no; then TERMLIBS=""; fi + fi +fi + +# -- Try ncursesw. +if test "x$TERMLIBS" = x; then + if test $have_ncursesw = yes; then + TERMLIBS="-lncursesw" + SAVE_LIBS=$LIBS + LIBS="$LIBS $TERMLIBS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + termok=yes +else + termok=no +fi +rm -f core conftest.err 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + termok=yes +else + termok=no +fi +rm -f core conftest.err 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + termok=yes +else + termok=no +fi +rm -f core conftest.err 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + termok=yes +else + termok=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS=$SAVE_LIBS + if test $termok = no; then TERMLIBS=""; fi + fi + fi +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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + termok=yes +else + termok=no +fi +rm -f core conftest.err 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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +tgetent(0,0); tgetflag(0); tgetnum(0); tgetstr(0,0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + termok=yes +else + termok=no +fi +rm -f core conftest.err 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 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: Cannot find terminal libraries - configure failed" >&5 +$as_echo "Cannot find terminal libraries - configure failed" >&6; } + exit 1 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: using $TERMLIBS" >&5 +$as_echo "using $TERMLIBS" >&6; } +LIBS="$LIBS $TERMLIBS" + +# Checks for header files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if test "${ac_cv_header_stdc+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +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 : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#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)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +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=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_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 wctype.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +# Checks for typedefs, structures, and compiler characteristics. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat file-mode macros are broken" >&5 +$as_echo_n "checking whether stat file-mode macros are broken... " >&6; } +if test "${ac_cv_header_stat_broken+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include + +#if defined S_ISBLK && defined S_IFDIR +extern char c1[S_ISBLK (S_IFDIR) ? -1 : 1]; +#endif + +#if defined S_ISBLK && defined S_IFCHR +extern char c2[S_ISBLK (S_IFCHR) ? -1 : 1]; +#endif + +#if defined S_ISLNK && defined S_IFREG +extern char c3[S_ISLNK (S_IFREG) ? -1 : 1]; +#endif + +#if defined S_ISSOCK && defined S_IFREG +extern char c4[S_ISSOCK (S_IFREG) ? -1 : 1]; +#endif + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stat_broken=no +else + ac_cv_header_stat_broken=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stat_broken" >&5 +$as_echo "$ac_cv_header_stat_broken" >&6; } +if test $ac_cv_header_stat_broken = yes; then + +$as_echo "#define STAT_MACROS_BROKEN 1" >>confdefs.h + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 +$as_echo_n "checking for an ANSI C-conforming const... " >&6; } +if test "${ac_cv_c_const+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +/* FIXME: Include the comments suggested by Paul. */ +#ifndef __cplusplus + /* Ultrix mips cc rejects this. */ + typedef int charset[2]; + const charset cs; + /* SunOS 4.1.1 cc rejects this. */ + char const *const *pcpcc; + char **ppc; + /* 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"; + pcpcc = &g + (g ? g-g : 0); + /* HPUX 7.0 cc rejects these. */ + ++pcpcc; + ppc = (char**) pcpcc; + pcpcc = (char const *const *) ppc; + { /* SCO 3.2v4 cc rejects this. */ + char *t; + char const *s = 0 ? (char *) 0 : (char const *) 0; + + *t++ = 0; + if (s) return 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; + if (!foo) return 0; + } + return !cs[0] && !zero.x; +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_const=yes +else + ac_cv_c_const=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 +$as_echo "$ac_cv_c_const" >&6; } +if test $ac_cv_c_const = no; then + +$as_echo "#define const /**/" >>confdefs.h + +fi + +ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" +if test "x$ac_cv_type_off_t" = x""yes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define off_t long int +_ACEOF + +fi + +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = x""yes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned int +_ACEOF + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 +$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } +if test "${ac_cv_header_time+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include + +int +main () +{ +if ((struct tm *) 0) +return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_time=yes +else + ac_cv_header_time=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 +$as_echo "$ac_cv_header_time" >&6; } +if test $ac_cv_header_time = yes; then + +$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h + +fi + + +# Autoheader templates for symbols defined later by AC_DEFINE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# Checks for identifiers. +ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" +if test "x$ac_cv_type_off_t" = x""yes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define off_t long int +_ACEOF + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for void" >&5 +$as_echo_n "checking for void... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +void *foo = 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; }; $as_echo "#define HAVE_VOID 1" >>confdefs.h + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for const" >&5 +$as_echo_n "checking for const... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +const int foo = 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; }; $as_echo "#define HAVE_CONST 1" >>confdefs.h + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for time_t" >&5 +$as_echo_n "checking for time_t... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +time_t t = 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; }; $as_echo "#define HAVE_TIME_T 1" >>confdefs.h + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for st_ino in struct stat" >&5 +$as_echo_n "checking for st_ino in struct stat... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +int +main () +{ +struct stat s; dev_t dev = s.st_dev; ino_t ino = s.st_ino; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; }; $as_echo "#define HAVE_STAT_INO 1" >>confdefs.h + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +# Checks for library functions. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 +$as_echo_n "checking return type of signal handlers... " >&6; } +if test "${ac_cv_type_signal+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include + +int +main () +{ +return *(signal (0, 0)) (0) == 1; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_type_signal=int +else + ac_cv_type_signal=void +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5 +$as_echo "$ac_cv_type_signal" >&6; } + +cat >>confdefs.h <<_ACEOF +#define RETSIGTYPE $ac_cv_type_signal +_ACEOF + + +for ac_func in fsync popen _setjmp sigprocmask sigsetmask snprintf stat system fchmod +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + +# AC_CHECK_FUNCS may not work for inline functions, so test these separately. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for memcpy" >&5 +$as_echo_n "checking for memcpy... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#if HAVE_STRING_H +#include +#endif +int +main () +{ +memcpy(0,0,0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; }; $as_echo "#define HAVE_MEMCPY 1" >>confdefs.h + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for strchr" >&5 +$as_echo_n "checking for strchr... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#if HAVE_STRING_H +#include +#endif +int +main () +{ +strchr("x",'x'); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; }; $as_echo "#define HAVE_STRCHR 1" >>confdefs.h + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for strstr" >&5 +$as_echo_n "checking for strstr... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#if HAVE_STRING_H +#include +#endif +int +main () +{ +strstr("x","x"); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; }; $as_echo "#define HAVE_STRSTR 1" >>confdefs.h + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +# Some systems have termios.h but not the corresponding functions. +ac_fn_c_check_func "$LINENO" "tcgetattr" "ac_cv_func_tcgetattr" +if test "x$ac_cv_func_tcgetattr" = x""yes; then : + $as_echo "#define HAVE_TERMIOS_FUNCS 1" >>confdefs.h + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fileno" >&5 +$as_echo_n "checking for fileno... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#if HAVE_STDIO_H +#include +#endif +int +main () +{ +static int x; x = fileno(stdin); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; }; $as_echo "#define HAVE_FILENO 1" >>confdefs.h + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for strerror" >&5 +$as_echo_n "checking for strerror... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#if HAVE_STDIO_H +#include +#endif +#if HAVE_STRING_H +#include +#endif +#if HAVE_ERRNO_H +#include +#endif +int +main () +{ +static char *x; x = strerror(0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; }; $as_echo "#define HAVE_STRERROR 1" >>confdefs.h + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sys_errlist" >&5 +$as_echo_n "checking for sys_errlist... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +extern char *sys_errlist[]; static char **x; x = sys_errlist; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; }; $as_echo "#define HAVE_SYS_ERRLIST 1" >>confdefs.h + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +ac_fn_c_check_type "$LINENO" "sigset_t" "ac_cv_type_sigset_t" "#include +" +if test "x$ac_cv_type_sigset_t" = x""yes; then : + +cat >>confdefs.h <<_ACEOF +#define HAVE_SIGSET_T 1 +_ACEOF + + +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sigemptyset" >&5 +$as_echo_n "checking for sigemptyset... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include + +int +main () +{ +sigset_t s; sigemptyset(&s); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; }; $as_echo "#define HAVE_SIGEMPTYSET 1" >>confdefs.h + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +have_errno=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for errno" >&5 +$as_echo_n "checking for errno... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#if HAVE_ERRNO_H +#include +#endif +int +main () +{ +static int x; x = errno; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes - in errno.h" >&5 +$as_echo "yes - in errno.h" >&6; }; $as_echo "#define HAVE_ERRNO 1" >>confdefs.h + have_errno=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test $have_errno = no; then +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#if HAVE_ERRNO_H +#include +#endif +int +main () +{ +extern int errno; static int x; x = errno; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes - must define" >&5 +$as_echo "yes - must define" >&6; }; $as_echo "#define HAVE_ERRNO 1" >>confdefs.h + $as_echo "#define MUST_DEFINE_ERRNO 1" >>confdefs.h + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for locale" >&5 +$as_echo_n "checking for locale... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +int +main () +{ +setlocale(LC_CTYPE,""); isprint(0); iscntrl(0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; }; $as_echo "#define HAVE_LOCALE 1" >>confdefs.h + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ctype functions" >&5 +$as_echo_n "checking for ctype functions... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#if HAVE_CTYPE_H +#include +#endif +int +main () +{ +static int x; x = isupper(x); x = tolower(x); x = toupper(x); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; }; $as_echo "#define HAVE_UPPER_LOWER 1" >>confdefs.h + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for wctype functions" >&5 +$as_echo_n "checking for wctype functions... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +iswlower(0); iswupper(0); towlower(0); towupper(0); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; }; $as_echo "#define HAVE_WCTYPE 1" >>confdefs.h + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +# Checks for external variable ospeed in the termcap library. +have_ospeed=no +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking termcap for ospeed" >&5 +$as_echo_n "checking termcap for ospeed... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#if HAVE_TERMIOS_H +#include +#endif +#if HAVE_TERMCAP_H +#include +#endif +int +main () +{ +ospeed = 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes - in termcap.h" >&5 +$as_echo "yes - in termcap.h" >&6; }; $as_echo "#define HAVE_OSPEED 1" >>confdefs.h + have_ospeed=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +if test $have_ospeed = no; then +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +extern short ospeed; ospeed = 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes - must define" >&5 +$as_echo "yes - must define" >&6; }; $as_echo "#define HAVE_OSPEED 1" >>confdefs.h + $as_echo "#define MUST_DEFINE_OSPEED 1" >>confdefs.h + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi + +# Compile in secure mode? + +# Check whether --with-secure was given. +if test "${with_secure+set}" = set; then : + withval=$with_secure; $as_echo "#define SECURE_COMPILE 1" >>confdefs.h + +else + $as_echo "#define SECURE_COMPILE 0" >>confdefs.h + +fi + + +# Should we use floating point? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for floating point" >&5 +$as_echo_n "checking for floating point... " >&6; } + +# Check whether --with-no-float was given. +if test "${with_no_float+set}" = set; then : + withval=$with_no_float; WANT_NO_FLOAT=1 +else + WANT_NO_FLOAT=0 +fi + +if test $WANT_NO_FLOAT = 0; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +double f1 = 12.5; double f2 = f1*f1/2.5; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; }; $as_echo "#define HAVE_FLOAT 1" >>confdefs.h + +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: disabled by user" >&5 +$as_echo "disabled by user" >&6; } +fi + +# Checks for regular expression functions. +have_regex=no +have_posix_regex=unknown +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for regcomp" >&5 +$as_echo_n "checking for regcomp... " >&6; } + +# Select a regular expression library. +WANT_REGEX=auto + +# Check whether --with-regex was given. +if test "${with_regex+set}" = set; then : + withval=$with_regex; WANT_REGEX="$withval" +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 confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +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); } +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + have_posix_regex=yes +else + have_posix_regex=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +if test $have_posix_regex = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: using POSIX regcomp" >&5 +$as_echo "using POSIX regcomp" >&6; } + $as_echo "#define HAVE_POSIX_REGCOMP 1" >>confdefs.h + + have_regex=yes +elif test $have_posix_regex = unknown; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +int +main () +{ +regex_t *r; regfree(r); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: using POSIX regcomp" >&5 +$as_echo "using POSIX regcomp" >&6; } + $as_echo "#define HAVE_POSIX_REGCOMP 1" >>confdefs.h + have_regex=yes +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +fi +fi + +if test $have_regex = no; then +if test $WANT_REGEX = auto -o $WANT_REGEX = pcre; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for pcre_compile in -lpcre" >&5 +$as_echo_n "checking for pcre_compile in -lpcre... " >&6; } +if test "${ac_cv_lib_pcre_pcre_compile+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lpcre $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char pcre_compile (); +int +main () +{ +return pcre_compile (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_pcre_pcre_compile=yes +else + ac_cv_lib_pcre_pcre_compile=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pcre_pcre_compile" >&5 +$as_echo "$ac_cv_lib_pcre_pcre_compile" >&6; } +if test "x$ac_cv_lib_pcre_pcre_compile" = x""yes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: using pcre" >&5 +$as_echo "using pcre" >&6; }; $as_echo "#define HAVE_PCRE 1" >>confdefs.h + LIBS="$LIBS -lpcre" have_regex=yes +fi + +fi +fi + +if test $have_regex = no; then +if test $WANT_REGEX = auto -o $WANT_REGEX = regcmp; then +ac_fn_c_check_func "$LINENO" "regcmp" "ac_cv_func_regcmp" +if test "x$ac_cv_func_regcmp" = x""yes; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: using regcmp" >&5 +$as_echo "using regcmp" >&6; }; $as_echo "#define HAVE_REGCMP 1" >>confdefs.h + have_regex=yes +fi + +fi +fi + +if test $have_regex = no; then +if test $WANT_REGEX = auto -o $WANT_REGEX = regcomp; then +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include "regexp.h" +int +main () +{ +regcomp(""); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: using V8 regcomp" >&5 +$as_echo "using V8 regcomp" >&6; }; $as_echo "#define HAVE_V8_REGCOMP 1" >>confdefs.h + have_regex=yes +fi +rm -f core conftest.err 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 +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: using V8 regcomp -- local source" >&5 +$as_echo "using V8 regcomp -- local source" >&6; }; $as_echo "#define HAVE_V8_REGCOMP 1" >>confdefs.h + $as_echo "#define HAVE_REGEXEC2 1" >>confdefs.h + REGEX_O='regexp.$(O)' have_regex=yes +fi +fi + +if test $have_regex = no; then +if test $WANT_REGEX = auto -o $WANT_REGEX = re_comp; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: using re_comp" >&5 +$as_echo "using re_comp" >&6; }; ac_fn_c_check_func "$LINENO" "re_comp" "ac_cv_func_re_comp" +if test "x$ac_cv_func_re_comp" = x""yes; then : + $as_echo "#define HAVE_RE_COMP 1" >>confdefs.h + have_regex=yes +fi + +fi +fi + +if test $have_regex = no; then +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: cannot find regular expression library" >&5 +$as_echo "cannot find regular expression library" >&6; }; $as_echo "#define NO_REGEX 1" >>confdefs.h + +fi + + +# Check whether --with-editor was given. +if test "${with_editor+set}" = set; then : + withval=$with_editor; cat >>confdefs.h <<_ACEOF +#define EDIT_PGM "$withval" +_ACEOF + +else + $as_echo "#define EDIT_PGM \"vi\"" >>confdefs.h + +fi + + + + +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, 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. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `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, we kill variables containing newlines. +# 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. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}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 "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + test "x$cache_file" != "x/dev/null" && + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + cat confcache >$cache_file + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + +: ${CONFIG_STATUS=./config.status} +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +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 +IFS=$as_save_IFS + + ;; +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 + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; 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 + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# 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 + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval 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="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by less $as_me 1, which was +generated by GNU Autoconf 2.67. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -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 the package provider." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +less config.status 1 +configured by $0, generated by GNU Autoconf 2.67, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2010 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "defines.h") CONFIG_HEADERS="$CONFIG_HEADERS defines.h" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;; + 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 + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= + trap 'exit_status=$? + { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -n "$tmp" && test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries 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[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_t=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_t"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #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. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS " +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # 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. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$tmp/stdin" + case $ac_file in + -) cat "$tmp/out" && rm -f "$tmp/out";; + *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" + } >"$tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi + ;; + + + esac + +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# 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=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || 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 || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + diff --git a/external/bsd/less/dist/configure.ac b/external/bsd/less/dist/configure.ac new file mode 100644 index 000000000..0b386b075 --- /dev/null +++ b/external/bsd/less/dist/configure.ac @@ -0,0 +1,666 @@ +# Process this file with autoconf to produce a configure script. + +# Copyright (C) 1984-2011 Mark Nudelman +# +# You may distribute under the terms of either the GNU General Public +# License or the Less License, as specified in the README file. +# +# For more information about less, or for information on how to +# contact the author, see the README file. + +# Autoconf initialization. +AC_INIT(less, 1) +AC_CONFIG_SRCDIR([forwback.c]) +AC_CONFIG_HEADER([defines.h]) + +# Checks for programs. +AC_PROG_CC +AC_ISC_POSIX +AC_PROG_GCC_TRADITIONAL +AC_PROG_INSTALL + +# Checks for compilation model. +AC_SYS_LARGEFILE + +# Checks for general libraries. +AC_CHECK_LIB(tinfo, tgoto, [have_tinfo=yes], [have_tinfo=no]) +AC_CHECK_LIB(xcurses, initscr, [have_xcurses=yes], [have_xcurses=no]) +AC_CHECK_LIB(ncursesw, initscr, [have_ncursesw=yes], [have_ncursesw=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]) +# 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) + +# Checks for terminal libraries +AC_MSG_CHECKING([for working terminal libraries]) +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 + 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 + +# -- Try tinfo. +if test "x$TERMLIBS" = x; then + if test $have_tinfo = yes; then + TERMLIBS="-ltinfo" + 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 + +# -- 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 + +# -- Try ncursesw. +if test "x$TERMLIBS" = x; then + if test $have_ncursesw = yes; then + TERMLIBS="-lncursesw" + 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 + +# -- 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 + +# -- 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 + +# -- 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 + +# -- 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 + +# -- 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" + +# Checks for header files. +AC_HEADER_STDC +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 wctype.h]) + +# Checks for typedefs, structures, and compiler characteristics. +AC_HEADER_STAT +AC_C_CONST +AC_TYPE_OFF_T +AC_TYPE_SIZE_T +AC_HEADER_TIME + +# Autoheader templates for symbols defined later by AC_DEFINE. +AH_TEMPLATE([HAVE_POSIX_REGCOMP], + [POSIX regcomp() and regex.h]) +AH_TEMPLATE([HAVE_PCRE], + [PCRE (Perl-compatible regular expression) library]) +AH_TEMPLATE([HAVE_RE_COMP], + [BSD re_comp()]) +AH_TEMPLATE([HAVE_REGCMP], + [System V regcmp()]) +AH_TEMPLATE([HAVE_V8_REGCOMP], + [Henry Spencer V8 regcomp() and regexp.h]) +AH_TEMPLATE([NO_REGEX], + [pattern matching is supported, but without metacharacters.]) +AH_TEMPLATE([HAVE_REGEXEC2], + []) +AH_TEMPLATE([HAVE_VOID], + [Define HAVE_VOID if your compiler supports the "void" type.]) +AH_TEMPLATE([HAVE_FLOAT], + [Define HAVE_FLOAT if your compiler supports the "double" type.]) +AH_TEMPLATE([HAVE_CONST], + [Define HAVE_CONST if your compiler supports the "const" modifier.]) +AH_TEMPLATE([HAVE_STAT_INO], + [Define HAVE_STAT_INO if your struct stat has st_ino and st_dev.]) +AH_TEMPLATE([HAVE_TIME_T], + [Define HAVE_TIME_T if your system supports the "time_t" type.]) +AH_TEMPLATE([HAVE_STRERROR], + [Define HAVE_STRERROR if you have the strerror() function.]) +AH_TEMPLATE([HAVE_FILENO], + [Define HAVE_FILENO if you have the fileno() macro.]) +AH_TEMPLATE([HAVE_ERRNO], + [Define HAVE_ERRNO if you have the errno variable.]) +AH_TEMPLATE([MUST_DEFINE_ERRNO], + [Define MUST_DEFINE_ERRNO if you have errno but it is not define in errno.h.]) +AH_TEMPLATE([HAVE_SYS_ERRLIST], + [Define HAVE_SYS_ERRLIST if you have the sys_errlist[] variable.]) +AH_TEMPLATE([HAVE_OSPEED], + [Define HAVE_OSPEED if your termcap library has the ospeed variable.]) +AH_TEMPLATE([MUST_DEFINE_OSPEED], + [Define MUST_DEFINE_OSPEED if you have ospeed but it is not defined in termcap.h.]) +AH_TEMPLATE([HAVE_LOCALE], + [Define HAVE_LOCALE if you have locale.h and setlocale.]) +AH_TEMPLATE([HAVE_TERMIOS_FUNCS], + [Define HAVE_TERMIOS_FUNCS if you have tcgetattr/tcsetattr.]) +AH_TEMPLATE([HAVE_UPPER_LOWER], + [Define HAVE_UPPER_LOWER if you have isupper, islower, toupper, tolower.]) +AH_TEMPLATE([HAVE_WCTYPE], + [Define HAVE_WCTYPE if you have iswupper, iswlower, towupper, towlower.]) +AH_TEMPLATE([HAVE_SIGSET_T], + [Define HAVE_SIGSET_T you have the sigset_t type.]) +AH_TEMPLATE([HAVE_SIGEMPTYSET], + [Define HAVE_SIGEMPTYSET if you have the sigemptyset macro.]) +AH_TEMPLATE([EDIT_PGM], + [Define EDIT_PGM to your editor.]) +AH_TEMPLATE([SECURE_COMPILE], + [Define SECURE_COMPILE=1 to build a secure version of less.]) + +# 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_t t = 0;], + [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_TIME_T)], [AC_MSG_RESULT(no)]) +AC_MSG_CHECKING(for st_ino in struct stat) +AC_TRY_COMPILE([#include +#include ], + [struct stat s; dev_t dev = s.st_dev; ino_t ino = s.st_ino;], + [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STAT_INO)], [AC_MSG_RESULT(no)]) + +# Checks for library functions. +AC_TYPE_SIGNAL +AC_CHECK_FUNCS([fsync popen _setjmp sigprocmask sigsetmask snprintf stat system fchmod]) + +# AC_CHECK_FUNCS may not work for inline functions, so test these separately. +AC_MSG_CHECKING(for memcpy) +AC_TRY_LINK([ +#if HAVE_STRING_H +#include +#endif], [memcpy(0,0,0);], + [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_MEMCPY)], [AC_MSG_RESULT(no)]) + +AC_MSG_CHECKING(for strchr) +AC_TRY_LINK([ +#if HAVE_STRING_H +#include +#endif], [strchr("x",'x');], + [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STRCHR)], [AC_MSG_RESULT(no)]) + +AC_MSG_CHECKING(for strstr) +AC_TRY_LINK([ +#if HAVE_STRING_H +#include +#endif], [strstr("x","x");], + [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_STRSTR)], [AC_MSG_RESULT(no)]) + +# 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 +#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 +#endif +#if HAVE_STRING_H +#include +#endif +#if HAVE_ERRNO_H +#include +#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_CHECK_TYPES([sigset_t],,,[#include ]) + +AC_MSG_CHECKING(for sigemptyset) +AC_TRY_LINK([ +#include +], [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 +#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 +#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 +#include +#include ], [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 +#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)]) + +AC_MSG_CHECKING(for wctype functions) +AC_TRY_LINK([#include ], [iswlower(0); iswupper(0); towlower(0); towupper(0);], + [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_WCTYPE)], [AC_MSG_RESULT(no)]) + +# Checks for external variable ospeed in the termcap library. +have_ospeed=no +AC_MSG_CHECKING(termcap for ospeed) +AC_TRY_LINK([ +#include +#if HAVE_TERMIOS_H +#include +#endif +#if HAVE_TERMCAP_H +#include +#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 + +# Compile in secure mode? +AC_ARG_WITH(secure, + [ --with-secure Compile in secure mode], + AC_DEFINE(SECURE_COMPILE, 1), AC_DEFINE(SECURE_COMPILE, 0)) + +# Should we use floating point? +AC_MSG_CHECKING(for floating point) +AC_ARG_WITH(no-float, + [ --with-no-float Do not use floating point], + WANT_NO_FLOAT=1, WANT_NO_FLOAT=0) +if test $WANT_NO_FLOAT = 0; then + AC_TRY_LINK(, [double f1 = 12.5; double f2 = f1*f1/2.5;], + [AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FLOAT)], [AC_MSG_RESULT(no)]) +else + AC_MSG_RESULT(disabled by user) +fi + +# Checks for regular expression functions. +have_regex=no +have_posix_regex=unknown +AC_MSG_CHECKING(for regcomp) + +# 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]], + 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_TRY_RUN([ +#include +#include +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 +#include ], + [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_DEFINE(EDIT_PGM, "vi")) + +AH_TOP([ +/* 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. + * SECURE_COMPILE is set by the --with-secure configure option. + */ +#define SECURE SECURE_COMPILE + +/* + * 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). + * LESSHISTFILE is the filename of the history file + * (in the HOME directory). + */ +#define LESSKEYFILE ".less" +#define LESSKEYFILE_SYS SYSDIR "/sysless" +#define DEF_LESSKEYINFILE ".lesskey" +#define LESSHISTFILE ".lesshst" + + +/* Settings always true on Unix. */ + +/* + * Define MSDOS_COMPILER if compiling under Microsoft C. + */ +#define MSDOS_COMPILER 0 + +/* + * Pathname separator character. + */ +#define PATHNAME_SEP "/" + +/* + * The value returned from tgetent on success. + * Some HP-UX systems return 0 on success. + */ +#define TGETENT_OK 1 + +/* + * HAVE_SYS_TYPES_H is 1 if your system has . + */ +#define HAVE_SYS_TYPES_H 1 + +/* + * Define if you have the 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 + +/* Define to 1 if you have the memcpy() function. */ +#define HAVE_MEMCPY 1 + +/* Define to 1 if you have the strchr() function. */ +#define HAVE_STRCHR 1 + +/* Define to 1 if you have the strstr() function. */ +#define HAVE_STRSTR 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. */ +]) + +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT diff --git a/external/bsd/less/dist/cvt.c b/external/bsd/less/dist/cvt.c new file mode 100644 index 000000000..e8817d265 --- /dev/null +++ b/external/bsd/less/dist/cvt.c @@ -0,0 +1,122 @@ +/* $NetBSD: cvt.c,v 1.2 2011/07/03 19:51:26 tron Exp $ */ + +/* + * Copyright (C) 1984-2011 Mark Nudelman + * + * You may distribute under the terms of either the GNU General Public + * License or the Less License, as specified in the README file. + * + * For more information about less, or for information on how to + * contact the author, see the README file. + */ + +/* + * Routines to convert text in various ways. Used by search. + */ + +#include "less.h" +#include "charset.h" + +extern int utf_mode; + +/* + * Get the length of a buffer needed to convert a string. + */ + public int +cvt_length(len, ops) + int len; + int ops; +{ + if (utf_mode) + /* + * Just copying a string in UTF-8 mode can cause it to grow + * in length. + * Four output bytes for one input byte is the worst case. + */ + len *= 4; + return (len + 1); +} + +/* + * Allocate a chpos array for use by cvt_text. + */ + public int * +cvt_alloc_chpos(len) + int len; +{ + int i; + int *chpos = (int *) ecalloc(sizeof(int), len); + /* Initialize all entries to an invalid position. */ + for (i = 0; i < len; i++) + chpos[i] = -1; + return (chpos); +} + +/* + * Convert text. Perform the transformations specified by ops. + * Returns converted text in odst. The original offset of each + * odst character (when it was in osrc) is returned in the chpos array. + */ + public void +cvt_text(odst, osrc, chpos, lenp, ops) + char *odst; + char *osrc; + int *chpos; + int *lenp; + int ops; +{ + char *dst; + char *src; + register char *src_end; + LWCHAR ch; + + if (lenp != NULL) + src_end = osrc + *lenp; + else + src_end = osrc + strlen(osrc); + + for (src = osrc, dst = odst; src < src_end; ) + { + int src_pos = src - osrc; + int dst_pos = dst - odst; + ch = step_char(&src, +1, src_end); + if ((ops & CVT_BS) && ch == '\b' && dst > odst) + { + /* Delete backspace and preceding char. */ + do { + dst--; + } while (dst > odst && + !IS_ASCII_OCTET(*dst) && !IS_UTF8_LEAD(*dst)); + } else if ((ops & CVT_ANSI) && IS_CSI_START(ch)) + { + /* Skip to end of ANSI escape sequence. */ + src++; /* skip the CSI start char */ + while (src < src_end) + if (!is_ansi_middle(*src++)) + break; + } else + { + /* Just copy the char to the destination buffer. */ + if ((ops & CVT_TO_LC) && IS_UPPER(ch)) + ch = TO_LOWER(ch); + put_wchar(&dst, ch); + /* + * Record the original position of the char. + * But if we've already recorded a position + * for this char (due to a backspace), leave + * it alone; if multiple source chars map to + * one destination char, we want the position + * of the first one. + */ + if (chpos != NULL && chpos[dst_pos] < 0) + chpos[dst_pos] = src_pos; + } + } + if ((ops & CVT_CRLF) && dst > odst && dst[-1] == '\r') + dst--; + *dst = '\0'; + if (lenp != NULL) + *lenp = dst - odst; + if (chpos != NULL) + chpos[dst - odst] = src - osrc; +} diff --git a/commands/less/less/decode.c b/external/bsd/less/dist/decode.c similarity index 98% rename from commands/less/less/decode.c rename to external/bsd/less/dist/decode.c index 712e57369..b6e585d47 100644 --- a/commands/less/less/decode.c +++ b/external/bsd/less/dist/decode.c @@ -1,7 +1,7 @@ -/* $NetBSD: decode.c,v 1.8 2006/10/26 01:33:08 mrg Exp $ */ +/* $NetBSD: decode.c,v 1.3 2011/07/03 20:14:12 tron Exp $ */ /* - * Copyright (C) 1984-2004 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -122,6 +122,7 @@ static unsigned char cmdtable[] = '7',0, A_DIGIT, '8',0, A_DIGIT, '9',0, A_DIGIT, + '.',0, A_DIGIT, '=',0, A_STAT, CONTROL('G'),0, A_STAT, @@ -134,6 +135,7 @@ static unsigned char cmdtable[] = ESC,'n',0, A_T_AGAIN_SEARCH, 'N',0, A_REVERSE_SEARCH, ESC,'N',0, A_T_REVERSE_SEARCH, + '&',0, A_FILTER, 'm',0, A_SETMARK, '\'',0, A_GOMARK, CONTROL('X'),CONTROL('X'),0, A_GOMARK, @@ -202,6 +204,7 @@ static unsigned char edittable[] = SK(SK_UP_ARROW),0, EC_UP, /* UPARROW */ ESC,'j',0, EC_DOWN, /* ESC j */ SK(SK_DOWN_ARROW),0, EC_DOWN, /* DOWNARROW */ + CONTROL('G'),0, EC_ABORT, /* CTRL-G */ }; /* @@ -688,7 +691,7 @@ lesskey(filename, sysvar) close(f); return (-1); } - if (lseek(f, (off_t)0, 0) == BAD_LSEEK) + if (lseek(f, (off_t)0, SEEK_SET) == BAD_LSEEK) { free(buf); close(f); diff --git a/external/bsd/less/dist/defines.ds b/external/bsd/less/dist/defines.ds new file mode 100644 index 000000000..4dbbd6518 --- /dev/null +++ b/external/bsd/less/dist/defines.ds @@ -0,0 +1,400 @@ +/* + * Copyright (C) 1984-2011 Mark Nudelman + * + * You may distribute under the terms of either the GNU General Public + * License or the Less License, as specified in the README file. + * + * For more information about less, or for information on how to + * contact the author, see the README file. + */ + + +/* DOS definition file for less. */ +/* + * This file has 2 sections: + * User preferences. + * Settings always true for MS-DOS systems. + */ + +/* 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) +#define EDIT_PGM "vi" + +/* + * 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. + */ +#ifdef __DJGPP__ +#define GLOB (!SECURE) +#else +#define GLOB 0 +#endif + +/* + * PIPEC is 1 if you wish to have the "|" command + * which allows the user to pipe data into a shell command. + */ +#ifdef __DJGPP__ +#define PIPEC (!SECURE) +#else +#define PIPEC 0 +#endif + +/* + * 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). + * LESSHISTFILE is the filename of the history file + * (in the HOME directory). + */ +#define LESSKEYFILE "_less" +#define LESSKEYFILE_SYS "c:\\_sysless" +#define DEF_LESSKEYINFILE "_lesskey" +#define LESSHISTFILE "_lesshst" + + +/* Settings always true for MS-DOS systems. */ + +/* + * Define MSDOS_COMPILER if compiling for MS-DOS. + */ +#ifdef __DJGPP__ +#define MSDOS_COMPILER DJGPPC +#else +#ifdef __BORLANDC__ +#define MSDOS_COMPILER BORLANDC +#else +#define MSDOS_COMPILER MSOFTC +#endif +#endif + +/* + * Pathname separator character. + */ +#define PATHNAME_SEP "\\" + +/* + * HAVE_SYS_TYPES_H is 1 if your system has . + */ +#define HAVE_SYS_TYPES_H 1 + +/* + * Define if you have the header file. + */ +#define HAVE_SGSTAT_H 0 + +/* + * 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 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. + */ +#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 */ + +/* Define to `long' if doesn't define. */ +#if MSDOS_COMPILER==BORLANDC +#define off_t long +#endif + +/* 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 + + +/* + * Regular expression library. + * Define exactly one of the following to be 1: + * HAVE_POSIX_REGCOMP: POSIX regcomp() and regex.h + * 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_RE_COMP */ +/* #undef HAVE_REGCMP */ +/* #undef HAVE_V8_REGCOMP */ +#if MSDOS_COMPILER==DJGPPC +#define HAVE_POSIX_REGCOMP 1 +#else +#define NO_REGEX 1 +#endif + +/* Define HAVE_VOID if your compiler supports the "void" type. */ +#define HAVE_VOID 1 + +/* 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 HAVE_STRERROR if you have the strerror() function. */ +#define HAVE_STRERROR 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 defined + * in errno.h */ +#if MSDOS_COMPILER==MSOFTC || MSDOS_COMPILER==DJGPPC +#define HAVE_ERRNO 1 +#define MUST_DEFINE_ERRNO 0 +#else +#define HAVE_ERRNO 1 +#define MUST_DEFINE_ERRNO 1 +#endif + +/* Define HAVE_SYS_ERRLIST if you have the sys_errlist[] variable */ +#define HAVE_SYS_ERRLIST 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 0 +#define MUST_DEFINE_OSPEED 0 + +/* Define HAVE_LOCALE if you have locale.h and setlocale. */ +#define HAVE_LOCALE 0 + +/* Define HAVE_TERMIOS_FUNCS if you have tcgetattr/tcsetattr */ +#define HAVE_TERMIOS_FUNCS 0 + +/* Define HAVE_UPPER_LOWER if you have isupper, islower, toupper, tolower */ +#define HAVE_UPPER_LOWER 1 + +/* Define if you have the _setjmp function. */ +#if MSDOS_COMPILER==MSOFTC || MSDOS_COMPILER==DJGPPC +#define HAVE__SETJMP 0 +#else +#define HAVE__SETJMP 1 +#endif + +/* Define if you have the memcpy function. */ +#define HAVE_MEMCPY 1 + +/* Define if you have the popen function. */ +#if MSDOS_COMPILER==DJGPPC +#define HAVE_POPEN 1 +#else +#define HAVE_POPEN 0 +#endif + +/* Define if you have the sigsetmask function. */ +#define HAVE_SIGSETMASK 0 + +/* Define if you have the sigprocmask function. */ +#define HAVE_SIGPROCMASK 0 + +/* Define if you have the sigset_t type and sigemptyset macro */ +#define HAVE_SIGSET_T 0 +#define HAVE_SIGEMPTYSET 0 + +/* Define if you have the stat function. */ +#define HAVE_STAT 1 + +/* Define if you have the strchr function. */ +#define HAVE_STRCHR 1 + +/* Define if you have the system function. */ +#define HAVE_SYSTEM 1 + +/* Define if you have the snprintf function. */ +#define HAVE_SNPRINTF 0 + +/* Define if you have the header file. */ +#define HAVE_CTYPE_H 1 + +/* Define if you have the header file. */ +#define HAVE_WCTYPE_H 0 + +/* Define if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define if you have the header file. */ +#define HAVE_SYS_IOCTL_H 0 + +/* Define if you have the header file. */ +#define HAVE_SYS_PTEM_H 0 + +/* Define if you have the header file. */ +#define HAVE_SYS_STREAM_H 0 + +/* Define if you have the header file. */ +#define HAVE_TERMCAP_H 0 + +/* Define if you have the header file. */ +#define HAVE_TERMIO_H 0 + +/* Define if you have the header file. */ +#define HAVE_TERMIOS_H 0 + +/* Define if you have the header file. */ +#define HAVE_TIME_H 1 + +/* Define if you have the header file. */ +#if MSDOS_COMPILER==DJGPPC +#define HAVE_UNISTD_H 1 +#else +#define HAVE_UNISTD_H 0 +#endif + +/* Define if you have the header file. */ +#if MSDOS_COMPILER==MSOFTC +#define HAVE_VALUES_H 0 +#else +#define HAVE_VALUES_H 1 +#endif + +#if MSDOS_COMPILER == MSOFTC && _MSC_VER >= 700 +/* + * The names of these things changed in Microsoft C version 7.0. + */ +#define videoconfig _videoconfig +#define rccoord _rccoord +#define O_RDONLY _O_RDONLY +#define O_WRONLY _O_WRONLY +#define O_APPEND _O_APPEND +#define O_BINARY _O_BINARY +#define O_TEXT _O_TEXT +#define find_t _find_t +#define stat _stat +#define S_IFMT _S_IFMT +#define S_IFDIR _S_IFDIR +#define S_IFREG _S_IFREG +#define dup _dup +#define open _open +#define lseek _lseek +#define write _write +#define creat _creat +#define fstat _fstat +#define isatty _isatty +#define close _close +#define read _read +#define ungetch _ungetch +#define kbhit _kbhit +#define getch _getch +#endif diff --git a/commands/less/less/defines.h b/external/bsd/less/dist/defines.h similarity index 89% rename from commands/less/less/defines.h rename to external/bsd/less/dist/defines.h index 4e673ef48..786117735 100644 --- a/commands/less/less/defines.h +++ b/external/bsd/less/dist/defines.h @@ -1,6 +1,6 @@ -/* $NetBSD: defines.h,v 1.7 2006/10/26 01:33:08 mrg Exp $ */ +/* $NetBSD: defines.h,v 1.2 2011/07/03 19:51:26 tron Exp $ */ -/* defines.h. Generated by configure. */ +/* defines.h. Generated from defines.h.in by configure. */ /* defines.h.in. Generated from configure.ac by autoheader. */ @@ -49,7 +49,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 @@ -67,7 +67,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) @@ -104,10 +104,10 @@ #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). * LESSHISTFILE is the filename of the history file * (in the HOME directory). @@ -130,6 +130,12 @@ */ #define PATHNAME_SEP "/" +/* + * The value returned from tgetent on success. + * Some HP-UX systems return 0 on success. + */ +#define TGETENT_OK 1 + /* * HAVE_SYS_TYPES_H is 1 if your system has . */ @@ -159,14 +165,23 @@ /* * 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 +/* Define to 1 if you have the memcpy() function. */ +#define HAVE_MEMCPY 1 + +/* Define to 1 if you have the strchr() function. */ +#define HAVE_STRCHR 1 + +/* Define to 1 if you have the strstr() function. */ +#define HAVE_STRSTR 1 + /* * Sizes of various buffers. */ @@ -207,6 +222,9 @@ /* Define HAVE_FILENO if you have the fileno() macro. */ #define HAVE_FILENO 1 +/* Define HAVE_FLOAT if your compiler supports the "double" type. */ +#define HAVE_FLOAT 1 + /* Define to 1 if you have the `fsync' function. */ #define HAVE_FSYNC 1 @@ -226,16 +244,13 @@ #define HAVE_LIMITS_H 1 /* Define HAVE_LOCALE if you have locale.h and setlocale. */ -#define HAVE_LOCALE 0 - -/* Define to 1 if you have the `memcpy' function. */ -#define HAVE_MEMCPY 1 +#define HAVE_LOCALE 1 /* Define to 1 if you have the header file. */ #define HAVE_MEMORY_H 1 /* Define HAVE_OSPEED if your termcap library has the ospeed variable. */ -#define HAVE_OSPEED 0 +#define HAVE_OSPEED 1 /* PCRE (Perl-compatible regular expression) library */ /* #undef HAVE_PCRE */ @@ -264,7 +279,7 @@ /* Define to 1 if you have the `sigsetmask' function. */ #define HAVE_SIGSETMASK 1 -/* Define HAVE_SIGSET_T you have the sigset_t type. */ +/* Define to 1 if the system has the type `sigset_t'. */ #define HAVE_SIGSET_T 1 /* Define to 1 if you have the `snprintf' function. */ @@ -273,6 +288,9 @@ /* Define to 1 if you have the `stat' function. */ #define HAVE_STAT 1 +/* Define HAVE_STAT_INO if your struct stat has st_ino and st_dev. */ +#define HAVE_STAT_INO 1 + /* Define to 1 if you have the header file. */ #define HAVE_STDINT_H 1 @@ -282,9 +300,6 @@ /* Define to 1 if you have the header file. */ #define HAVE_STDLIB_H 1 -/* Define to 1 if you have the `strchr' function. */ -#define HAVE_STRCHR 1 - /* Define HAVE_STRERROR if you have the strerror() function. */ #define HAVE_STRERROR 1 @@ -294,9 +309,6 @@ /* Define to 1 if you have the header file. */ #define HAVE_STRING_H 1 -/* Define to 1 if you have the `strstr' function. */ -#define HAVE_STRSTR 1 - /* Define to 1 if you have the `system' function. */ #define HAVE_SYSTEM 1 @@ -306,9 +318,6 @@ /* Define to 1 if you have the header file. */ #define HAVE_SYS_IOCTL_H 1 -/* Define to 1 if you have the header file. */ -/* #undef HAVE_SYS_PTEM_H */ - /* Define to 1 if you have the header file. */ #define HAVE_SYS_STAT_H 1 @@ -351,6 +360,12 @@ /* Define HAVE_VOID if your compiler supports the "void" type. */ #define HAVE_VOID 1 +/* Define HAVE_WCTYPE if you have iswupper, iswlower, towupper, towlower. */ +#define HAVE_WCTYPE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_WCTYPE_H 1 + /* Define to 1 if you have the `_setjmp' function. */ #define HAVE__SETJMP 1 @@ -377,6 +392,9 @@ /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "less" +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + /* Define to the version of this package. */ #define PACKAGE_VERSION "1" @@ -404,8 +422,8 @@ /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ -/* Define to `long' if does not define. */ +/* Define to `long int' if does not define. */ /* #undef off_t */ -/* Define to `unsigned' if does not define. */ +/* Define to `unsigned int' if does not define. */ /* #undef size_t */ diff --git a/external/bsd/less/dist/defines.h.in b/external/bsd/less/dist/defines.h.in new file mode 100644 index 000000000..8d4506383 --- /dev/null +++ b/external/bsd/less/dist/defines.h.in @@ -0,0 +1,426 @@ +/* defines.h.in. Generated from configure.ac by autoheader. */ + + +/* 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. + * SECURE_COMPILE is set by the --with-secure configure option. + */ +#define SECURE SECURE_COMPILE + +/* + * 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). + * LESSHISTFILE is the filename of the history file + * (in the HOME directory). + */ +#define LESSKEYFILE ".less" +#define LESSKEYFILE_SYS SYSDIR "/sysless" +#define DEF_LESSKEYINFILE ".lesskey" +#define LESSHISTFILE ".lesshst" + + +/* Settings always true on Unix. */ + +/* + * Define MSDOS_COMPILER if compiling under Microsoft C. + */ +#define MSDOS_COMPILER 0 + +/* + * Pathname separator character. + */ +#define PATHNAME_SEP "/" + +/* + * The value returned from tgetent on success. + * Some HP-UX systems return 0 on success. + */ +#define TGETENT_OK 1 + +/* + * HAVE_SYS_TYPES_H is 1 if your system has . + */ +#define HAVE_SYS_TYPES_H 1 + +/* + * Define if you have the 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 + +/* Define to 1 if you have the memcpy() function. */ +#define HAVE_MEMCPY 1 + +/* Define to 1 if you have the strchr() function. */ +#define HAVE_STRCHR 1 + +/* Define to 1 if you have the strstr() function. */ +#define HAVE_STRSTR 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. */ + + +/* Define EDIT_PGM to your editor. */ +#undef EDIT_PGM + +/* Define HAVE_CONST if your compiler supports the "const" modifier. */ +#undef HAVE_CONST + +/* Define to 1 if you have the header file. */ +#undef HAVE_CTYPE_H + +/* Define HAVE_ERRNO if you have the errno variable. */ +#undef HAVE_ERRNO + +/* Define to 1 if you have the header file. */ +#undef HAVE_ERRNO_H + +/* Define to 1 if you have the `fchmod' function. */ +#undef HAVE_FCHMOD + +/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H + +/* Define HAVE_FILENO if you have the fileno() macro. */ +#undef HAVE_FILENO + +/* Define HAVE_FLOAT if your compiler supports the "double" type. */ +#undef HAVE_FLOAT + +/* Define to 1 if you have the `fsync' function. */ +#undef HAVE_FSYNC + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* 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 header file. */ +#undef HAVE_LIMITS_H + +/* Define HAVE_LOCALE if you have locale.h and setlocale. */ +#undef HAVE_LOCALE + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define HAVE_OSPEED if your termcap library has the ospeed variable. */ +#undef HAVE_OSPEED + +/* PCRE (Perl-compatible regular expression) library */ +#undef HAVE_PCRE + +/* Define to 1 if you have the `popen' function. */ +#undef HAVE_POPEN + +/* POSIX regcomp() and regex.h */ +#undef HAVE_POSIX_REGCOMP + +/* System V regcmp() */ +#undef HAVE_REGCMP + +/* */ +#undef HAVE_REGEXEC2 + +/* BSD re_comp() */ +#undef HAVE_RE_COMP + +/* 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 to 1 if you have the `sigsetmask' function. */ +#undef HAVE_SIGSETMASK + +/* Define to 1 if the system has the type `sigset_t'. */ +#undef HAVE_SIGSET_T + +/* Define to 1 if you have the `snprintf' function. */ +#undef HAVE_SNPRINTF + +/* Define to 1 if you have the `stat' function. */ +#undef HAVE_STAT + +/* Define HAVE_STAT_INO if your struct stat has st_ino and st_dev. */ +#undef HAVE_STAT_INO + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define HAVE_STRERROR if you have the strerror() function. */ +#undef HAVE_STRERROR + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the `system' function. */ +#undef HAVE_SYSTEM + +/* Define HAVE_SYS_ERRLIST if you have the sys_errlist[] variable. */ +#undef HAVE_SYS_ERRLIST + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_IOCTL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STREAM_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_TERMCAP_H + +/* Define HAVE_TERMIOS_FUNCS if you have tcgetattr/tcsetattr. */ +#undef HAVE_TERMIOS_FUNCS + +/* Define to 1 if you have the header file. */ +#undef HAVE_TERMIOS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_TERMIO_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_TIME_H + +/* Define HAVE_TIME_T if your system supports the "time_t" type. */ +#undef HAVE_TIME_T + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* 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 header file. */ +#undef HAVE_VALUES_H + +/* Define HAVE_VOID if your compiler supports the "void" type. */ +#undef HAVE_VOID + +/* Define HAVE_WCTYPE if you have iswupper, iswlower, towupper, towlower. */ +#undef HAVE_WCTYPE + +/* Define to 1 if you have the header file. */ +#undef HAVE_WCTYPE_H + +/* Define to 1 if you have the `_setjmp' function. */ +#undef HAVE__SETJMP + +/* 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 home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define as the return type of signal handlers (`int' or `void'). */ +#undef RETSIGTYPE + +/* Define SECURE_COMPILE=1 to build a secure version of less. */ +#undef SECURE_COMPILE + +/* Define to 1 if the `S_IS*' macros in 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 and . */ +#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 int' if does not define. */ +#undef off_t + +/* Define to `unsigned int' if does not define. */ +#undef size_t diff --git a/external/bsd/less/dist/defines.o2 b/external/bsd/less/dist/defines.o2 new file mode 100644 index 000000000..0fd8cc735 --- /dev/null +++ b/external/bsd/less/dist/defines.o2 @@ -0,0 +1,328 @@ +/* + * Copyright (C) 1984-2011 Mark Nudelman + * + * You may distribute under the terms of either the GNU General Public + * License or the Less License, as specified in the README file. + * + * For more information about less, or for information on how to + * contact the author, see the README file. + */ + + +/* OS/2 definition file for less. */ +/* + * This file has 2 sections: + * User preferences. + * Settings always true for the emx compiler for OS/2 systems. + */ + + +/* 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) +#define EDIT_PGM "vi" + +/* + * 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). + * LESSHISTFILE is the filename of the history file + * (in the HOME directory). + */ +#define LESSKEYFILE "less.ini" +#define LESSKEYFILE_SYS "C:\\sysless.ini" +#define DEF_LESSKEYINFILE "lesskey.ini" +#define LESSHISTFILE "lesshst.ini" + + +/* Settings always true for the emx compiler for OS/2 systems. */ +#define OS2 1 + +/* + * Pathname separator character. + */ +#define PATHNAME_SEP "\\" + +/* + * HAVE_SYS_TYPES_H is 1 if your system has . + */ +#define HAVE_SYS_TYPES_H 1 + +/* + * Define if you have the header file. + */ +#define HAVE_SGSTAT_H 0 + +/* + * 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 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. + */ +#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 */ + +/* Define to `long' if doesn't define. */ +/* #define off_t long */ + +/* 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 + + +/* + * Regular expression library. + * Define exactly one of the following to be 1: + * HAVE_POSIX_REGCOMP: POSIX regcomp() and regex.h + * 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_RE_COMP */ +/* #undef HAVE_REGCMP */ +#define HAVE_V8_REGCOMP 1 +/* #undef NO_REGEX */ +#define HAVE_REGEXEC2 1 + +/* Define HAVE_VOID if your compiler supports the "void" type. */ +#define HAVE_VOID 1 + +/* 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 HAVE_STRERROR if you have the strerror() function. */ +#define HAVE_STRERROR 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 HAVE_SYS_ERRLIST if you have the sys_errlist[] variable */ +#define HAVE_SYS_ERRLIST 1 + +/* Define HAVE_OSPEED if your termcap library has the ospeed variable */ +#define HAVE_OSPEED 1 +/* Define MUST_DEFINE_OSPEED if you have ospeed but it is not defined + * in termcap.h. */ +#define MUST_DEFINE_OSPEED 0 + +/* 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 if you have the _setjmp function. */ +#define HAVE__SETJMP 0 + +/* Define if you have the memcpy function. */ +#define HAVE_MEMCPY 1 + +/* Define if you have the popen function. */ +#define HAVE_POPEN 1 + +/* Define if you have the sigsetmask function. */ +#define HAVE_SIGSETMASK 0 + +/* Define if you have the sigprocmask function. */ +#define HAVE_SIGPROCMASK 1 + +/* Define if you have the sigset_t type and sigemptyset macro */ +#define HAVE_SIGSET_T 1 +#define HAVE_SIGEMPTYSET 1 + +/* Define if you have the stat function. */ +#define HAVE_STAT 1 + +/* Define if you have the strchr function. */ +#define HAVE_STRCHR 1 + +/* Define if you have the strstr function. */ +#define HAVE_STRSTR 1 + +/* Define if you have the system function. */ +#define HAVE_SYSTEM 1 + +/* Define if you have the snprintf function. */ +#define HAVE_SNPRINTF 0 + +/* Define if you have the header file. */ +#define HAVE_CTYPE_H 1 + +/* Define if you have the header file. */ +#define HAVE_WCTYPE_H 0 + +/* Define if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define if you have the header file. */ +#define HAVE_FCNTL_H 1 + +/* Define if you have the header file. */ +#define HAVE_LIMITS_H 1 + +/* Define if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define if you have the header file. */ +#define HAVE_SYS_IOCTL_H 1 + +/* Define if you have the header file. */ +#define HAVE_SYS_PTEM_H 0 + +/* Define if you have the header file. */ +#define HAVE_SYS_STREAM_H 0 + +/* Define if you have the header file. */ +#define HAVE_TERMCAP_H 1 + +/* Define if you have the header file. */ +#define HAVE_TERMIO_H 1 + +/* Define if you have the header file. */ +#define HAVE_TERMIOS_H 1 + +/* Define if you have the header file. */ +#define HAVE_TIME_H 1 + +/* Define if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define if you have the header file. */ +#define HAVE_VALUES_H 0 diff --git a/external/bsd/less/dist/defines.o9 b/external/bsd/less/dist/defines.o9 new file mode 100644 index 000000000..3bb1d2cb8 --- /dev/null +++ b/external/bsd/less/dist/defines.o9 @@ -0,0 +1,340 @@ +/* + * Copyright (C) 1984-2011 Mark Nudelman + * + * You may distribute under the terms of either the GNU General Public + * License or the Less License, as specified in the README file. + * + * For more information about less, or for information on how to + * contact the author, see the README file. + */ + + +/* OS/9 definition file for less. */ +/* + * This file has 2 sections: + * User preferences. + * Settings always true for OS-9 systems. + */ + +/* 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 1 + +/* + * 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) +#define EDIT_PGM "umacs" + +/* + * 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). + * LESSHISTFILE is the filename of the history file + * (in the HOME directory). + */ +#define LESSKEYFILE ".less" +#define LESSKEYFILE_SYS "/.sysless" +#define DEF_LESSKEYINFILE ".lesskey" +#define LESSHISTFILE ".lesshst" + + +/* Settings always true for OS-9. */ + +/* This is not needed; it is defined by the compiler. */ +/* #define _OSK 1 */ +#define OS2 0 +#define MSDOS_COMPILER 0 + +/* + * Pathname separator character. + */ +#define PATHNAME_SEP "/" + +/* + * HAVE_SYS_TYPES_H is 1 if your system has . + */ +#define HAVE_SYS_TYPES_H 0 + +/* + * Define if you have the header file. + */ +#define HAVE_SGSTAT_H 1 + +/* + * HAVE_PERROR is 1 if your system has the perror() call. + * (Actually, if it has sys_errlist, sys_nerr and errno.) + */ +#if _OSK_MWC32 +#define HAVE_PERROR 0 +#else +#define HAVE_PERROR 1 +#endif + +/* + * 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 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. + */ +#define HAVE_DUP 0 + +/* + * 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 */ + +/* Define to `long' if doesn't define. */ +#define off_t long + +/* Define if you need to in order for stat and other things to work. */ +#define _POSIX_SOURCE 0 + +/* Define as the return type of signal handlers (int or void). */ +#if _OSK_MWC32 +#define RETSIGTYPE int +#else +#define RETSIGTYPE void +#endif + + +/* + * Regular expression library. + * Define exactly one of the following to be 1: + * HAVE_POSIX_REGCOMP: POSIX regcomp() and regex.h + * 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 0 +#define HAVE_RE_COMP 0 +#define HAVE_REGCMP 0 +#define HAVE_V8_REGCOMP 1 +#define NO_REGEX 0 +#define HAVE_REGEXEC2 1 + +/* Define HAVE_VOID if your compiler supports the "void" type. */ +#define HAVE_VOID 1 + +/* Define HAVE_CONST if your compiler supports the "const" modifier. */ +#define HAVE_CONST 0 + +/* Define HAVE_TIME_T if your system supports the "time_t" type. */ +#define HAVE_TIME_T 1 + +/* Define HAVE_STRERROR if you have the strerror() function. */ +#define HAVE_STRERROR 0 + +/* 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 +#define MUST_DEFINE_ERRNO 0 + +/* Define HAVE_SYS_ERRLIST if you have the sys_errlist[] variable */ +#define HAVE_SYS_ERRLIST 0 + +/* 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 0 +#define MUST_DEFINE_OSPEED 0 + +/* Define HAVE_LOCALE if you have locale.h and setlocale. */ +#define HAVE_LOCALE 0 + +/* Define HAVE_TERMIOS_FUNCS if you have tcgetattr/tcsetattr */ +#define HAVE_TERMIOS_FUNCS 0 + +/* Define HAVE_UPPER_LOWER if you have isupper, islower, toupper, tolower */ +#define HAVE_UPPER_LOWER 1 + +/* Define if you have the _setjmp function. */ +#define HAVE__SETJMP 1 + +/* Define if you have the memcpy function. */ +#define HAVE_MEMCPY 1 + +/* Define if you have the popen function. */ +#define HAVE_POPEN 1 + +/* Define if you have the sigsetmask function. */ +#define HAVE_SIGSETMASK 0 + +/* Define if you have the sigprocmask function. */ +#define HAVE_SIGPROCMASK 0 + +/* Define if you have the sigset_t type and sigemptyset macro */ +#define HAVE_SIGSET_T 0 +#define HAVE_SIGEMPTYSET 0 + +/* Define if you have the stat function. */ +#define HAVE_STAT 0 + +/* Define if you have the strchr function. */ +#define HAVE_STRCHR 0 + +/* Define if you have the system function. */ +#define HAVE_SYSTEM 1 + +/* Define if you have the snprintf function. */ +#define HAVE_SNPRINTF 0 + +/* Define if you have the header file. */ +#define HAVE_CTYPE_H 1 + +/* Define if you have the header file. */ +#define HAVE_WCTYPE_H 0 + +/* Define if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define if you have the header file. */ +#define HAVE_FCNTL_H 0 + +/* Define if you have the header file. */ +#define HAVE_LIMITS_H 0 + +/* Define if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define if you have the header file. */ +#if _OSK_MWC32 +#define HAVE_STDLIB_H 0 +#else +#define HAVE_STDLIB_H 1 +#endif + +/* Define if you have the header file. */ +#define HAVE_SYS_IOCTL_H 0 + +/* Define if you have the header file. */ +#define HAVE_SYS_PTEM_H 0 + +/* Define if you have the header file. */ +#define HAVE_SYS_STREAM_H 0 + +/* Define if you have the header file. */ +#define HAVE_TERMCAP_H 1 + +/* Define if you have the header file. */ +#define HAVE_TERMIO_H 0 + +/* Define if you have the header file. */ +#define HAVE_TERMIOS_H 0 + +/* Define if you have the header file. */ +#define HAVE_TIME_H 1 + +/* Define if you have the header file. */ +#define HAVE_UNISTD_H 0 + +/* Define if you have the header file. */ +#define HAVE_VALUES_H 0 diff --git a/external/bsd/less/dist/defines.wn b/external/bsd/less/dist/defines.wn new file mode 100644 index 000000000..416a548e7 --- /dev/null +++ b/external/bsd/less/dist/defines.wn @@ -0,0 +1,339 @@ +/* + * Copyright (C) 1984-2011 Mark Nudelman + * + * You may distribute under the terms of either the GNU General Public + * License or the Less License, as specified in the README file. + * + * For more information about less, or for information on how to + * contact the author, see the README file. + */ + + +/* Windows definition file for less. */ +/* + * This file has 2 sections: + * User preferences. + * Settings always true for Windows systems. + */ + + +/* 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) +#define EDIT_PGM "edit" + +/* + * 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 0 + +/* + * PIPEC is 1 if you wish to have the "|" command + * which allows the user to pipe data into a shell command. + */ +#define PIPEC 1 + +/* + * 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). + * LESSHISTFILE is the filename of the history file + * (in the HOME directory). + */ +#define LESSKEYFILE "_less" +#define LESSKEYFILE_SYS "c:\\_sysless" +#define DEF_LESSKEYINFILE "_lesskey" +#define LESSHISTFILE "_lesshst" + + +/* Settings always true for Windows systems. */ + +#define MSDOS_COMPILER WIN32C + +/* + * Pathname separator character. + */ +#define PATHNAME_SEP "\\" + +/* + * HAVE_SYS_TYPES_H is 1 if your system has . + */ +#define HAVE_SYS_TYPES_H 1 + +/* + * Define if you have the header file. + */ +#define HAVE_SGSTAT_H 0 + +/* + * 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 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. + */ +#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 */ + +/* Define to `long' if doesn't define. */ +/* #define off_t long */ + +/* 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 + + +/* + * Regular expression library. + * Define exactly one of the following to be 1: + * HAVE_POSIX_REGCOMP: POSIX regcomp() and regex.h + * 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_RE_COMP */ +/* #undef HAVE_REGCMP */ +#define HAVE_V8_REGCOMP 1 +/* #undef NO_REGEX */ +#define HAVE_REGEXEC2 1 + +/* Define HAVE_VOID if your compiler supports the "void" type. */ +#define HAVE_VOID 1 + +/* 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 HAVE_STRERROR if you have the strerror() function. */ +#define HAVE_STRERROR 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 +#define MUST_DEFINE_ERRNO 1 + +/* Define HAVE_SYS_ERRLIST if you have the sys_errlist[] variable */ +#define HAVE_SYS_ERRLIST 1 + +/* Define HAVE_OSPEED if your termcap library has the ospeed variable */ +#define HAVE_OSPEED 0 +/* Define MUST_DEFINE_OSPEED if you have ospeed but it is not defined + * in termcap.h. */ +#define MUST_DEFINE_OSPEED 0 + +/* Define HAVE_LOCALE if you have locale.h and setlocale. */ +#define HAVE_LOCALE 0 + +/* Define HAVE_TERMIOS_FUNCS if you have tcgetattr/tcsetattr */ +#define HAVE_TERMIOS_FUNCS 0 + +/* Define HAVE_UPPER_LOWER if you have isupper, islower, toupper, tolower */ +#define HAVE_UPPER_LOWER 1 + +/* Define if you have the _setjmp function. */ +#define HAVE__SETJMP 1 + +/* Define if you have the memcpy function. */ +#define HAVE_MEMCPY 1 + +/* Define if you have the popen function. */ +#define HAVE_POPEN 1 + +/* Define if you have the sigsetmask function. */ +#define HAVE_SIGSETMASK 0 + +/* Define if you have the sigprocmask function. */ +#define HAVE_SIGPROCMASK 0 + +/* Define if you have the sigset_t type and sigemptyset macro */ +#define HAVE_SIGSET_T 0 +#define HAVE_SIGEMPTYSET 0 + +/* Define if you have the stat function. */ +#define HAVE_STAT 1 + +/* Define if you have the strchr function. */ +#define HAVE_STRCHR 1 + +/* Define if you have the system function. */ +#define HAVE_SYSTEM 1 + +/* Define if you have the snprintf function. */ +#define HAVE_SNPRINTF 1 + +/* Define if you have the header file. */ +#define HAVE_CTYPE_H 1 + +/* Define if you have the header file. */ +#define HAVE_WCTYPE_H 1 + +/* Define if you have the header file. */ +#define HAVE_ERRNO_H 1 + +/* Define if you have the 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 header file. */ +#define HAVE_LIMITS_H 1 + +/* Define if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define if you have the header file. */ +#define HAVE_SYS_IOCTL_H 0 + +/* Define if you have the header file. */ +#define HAVE_SYS_PTEM_H 0 + +/* Define if you have the header file. */ +#define HAVE_SYS_STREAM_H 0 + +/* Define if you have the header file. */ +#define HAVE_TERMCAP_H 0 + +/* Define if you have the header file. */ +#define HAVE_TERMIO_H 0 + +/* Define if you have the header file. */ +#define HAVE_TERMIOS_H 0 + +/* Define if you have the header file. */ +#define HAVE_TIME_H 1 + +/* Define if you have the header file. */ +#define HAVE_UNISTD_H 0 + +/* Define if you have the header file. */ +#ifdef _MSC_VER +#define HAVE_VALUES_H 0 +#else +#define HAVE_VALUES_H 1 +#endif + +#define popen _popen +#define pclose _pclose +#define snprintf _snprintf + +#pragma warning(disable:4996) diff --git a/commands/less/less/edit.c b/external/bsd/less/dist/edit.c similarity index 95% rename from commands/less/less/edit.c rename to external/bsd/less/dist/edit.c index 1c58d95f5..20f1230e3 100644 --- a/commands/less/less/edit.c +++ b/external/bsd/less/dist/edit.c @@ -1,7 +1,7 @@ -/* $NetBSD: edit.c,v 1.9 2008/02/16 07:20:54 matt Exp $ */ +/* $NetBSD: edit.c,v 1.3 2011/07/03 20:14:12 tron Exp $ */ /* - * Copyright (C) 1984-2005 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -12,6 +12,9 @@ #include "less.h" +#if HAVE_STAT +#include +#endif public int fd0 = 0; @@ -38,6 +41,11 @@ extern int force_logfile; extern char *namelogfile; #endif +#if HAVE_STAT_INO +public dev_t curr_dev; +public ino_t curr_ino; +#endif + char *curr_altfilename = NULL; static void *curr_altpipe; @@ -185,6 +193,9 @@ close_file() curr_altfilename = NULL; } curr_ifile = NULL_IFILE; +#if HAVE_STAT_INO + curr_ino = curr_dev = 0; +#endif } /* @@ -367,7 +378,6 @@ edit_ifile(ifile) } } } - free(qopen_filename); /* * Get the new ifile. @@ -391,11 +401,24 @@ edit_ifile(ifile) #if LOGFILE if (namelogfile != NULL && is_tty) use_logfile(namelogfile); +#endif +#if HAVE_STAT_INO + /* Remember the i-number and device of the opened file. */ + { + struct stat statbuf; + int r = stat(qopen_filename, &statbuf); + if (r == 0) + { + curr_ino = statbuf.st_ino; + curr_dev = statbuf.st_dev; + } + } #endif if (every_first_cmd != NULL) ungetsc(every_first_cmd); } + free(qopen_filename); no_display = !any_display; flush(); any_display = TRUE; @@ -664,6 +687,14 @@ reedit_ifile(save_ifile) quit(QUIT_ERROR); } + public void +reopen_curr_ifile() +{ + IFILE save_ifile = save_curr_ifile(); + close_file(); + reedit_ifile(save_ifile); +} + /* * Edit standard input. */ @@ -755,7 +786,7 @@ loop: * Append: open the file and seek to the end. */ logfile = open(filename, OPEN_APPEND); - if (lseek(logfile, (off_t)0, 2) == BAD_LSEEK) + if (lseek(logfile, (off_t)0, SEEK_END) == BAD_LSEEK) { close(logfile); logfile = -1; diff --git a/commands/less/less/filename.c b/external/bsd/less/dist/filename.c similarity index 93% rename from commands/less/less/filename.c rename to external/bsd/less/dist/filename.c index 60521e117..de4decbe9 100644 --- a/commands/less/less/filename.c +++ b/external/bsd/less/dist/filename.c @@ -1,7 +1,7 @@ -/* $NetBSD: filename.c,v 1.7 2006/10/26 01:33:08 mrg Exp $ */ +/* $NetBSD: filename.c,v 1.3 2011/07/03 20:14:12 tron Exp $ */ /* - * Copyright (C) 1984-2005 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -53,6 +53,8 @@ extern int force_open; extern int secure; extern int use_lessopen; +extern int ctldisp; +extern int utf_mode; extern IFILE curr_ifile; extern IFILE old_ifile; #if SPACES_IN_FILENAMES @@ -406,6 +408,7 @@ fexpand(s) return (e); } + #if TAB_COMPLETE_FILENAME /* @@ -476,19 +479,34 @@ fcomplete(s) bin_file(f) int f; { - int i; int n; - unsigned char data[64]; + int bin_count = 0; + char data[256]; + char* p; + char* pend; if (!seekable(f)) return (0); - if (lseek(f, (off_t)0, 0) == BAD_LSEEK) + if (lseek(f, (off_t)0, SEEK_SET) == BAD_LSEEK) return (0); n = read(f, data, sizeof(data)); - for (i = 0; i < n; i++) - if (binary_char(data[i])) - return (1); - return (0); + pend = &data[n]; + for (p = data; p < pend; ) + { + LWCHAR c = step_char(&p, +1, pend); + if (ctldisp == OPT_ONPLUS && IS_CSI_START(c)) + { + do { + c = step_char(&p, +1, pend); + } while (p < pend && is_ansi_middle(c)); + } else if (binary_char(c)) + bin_count++; + } + /* + * Call it a binary file if there are more than 5 binary characters + * in the first 256 bytes of the file. + */ + return (bin_count > 5); } /* @@ -500,7 +518,7 @@ seek_filesize(f) { off_t spos; - spos = lseek(f, (off_t)0, 2); + spos = lseek(f, (off_t)0, SEEK_END); if (spos == BAD_LSEEK) return (NULL_POSITION); return ((POSITION) spos); @@ -822,22 +840,29 @@ open_altfile(filename, pf, pfd) ch_ungetchar(-1); if ((lessopen = lgetenv("LESSOPEN")) == NULL) return (NULL); - if (strcmp(filename, "-") == 0) - return (NULL); if (*lessopen == '|') { /* * If LESSOPEN starts with a |, it indicates * a "pipe preprocessor". */ -#if HAVE_FILENO - lessopen++; - returnfd = 1; -#else +#if !HAVE_FILENO error("LESSOPEN pipe is not supported", NULL_PARG); return (NULL); +#else + lessopen++; + returnfd = 1; #endif } + if (*lessopen == '-') { + /* + * Lessopen preprocessor will accept "-" as a filename. + */ + lessopen++; + } else { + if (strcmp(filename, "-") == 0) + return (NULL); + } len = strlen(lessopen) + strlen(filename) + 2; cmd = (char *) ecalloc(len, sizeof(char)); @@ -974,7 +999,7 @@ bad_file(filename) register char *m = NULL; filename = shell_unquote(filename); - if (is_dir(filename)) + if (!force_open && is_dir(filename)) { static char is_a_dir[] = " is a directory"; @@ -1041,3 +1066,22 @@ shell_coption() { return ("-c"); } + +/* + * Return last component of a pathname. + */ + public char * +last_component(name) + char *name; +{ + char *slash; + + for (slash = name + strlen(name); slash > name; ) + { + --slash; + if (*slash == *PATHNAME_SEP || *slash == '/') + return (slash + 1); + } + return (name); +} + diff --git a/commands/less/less/forwback.c b/external/bsd/less/dist/forwback.c similarity index 86% rename from commands/less/less/forwback.c rename to external/bsd/less/dist/forwback.c index 769fa0128..82e290140 100644 --- a/commands/less/less/forwback.c +++ b/external/bsd/less/dist/forwback.c @@ -1,7 +1,7 @@ -/* $NetBSD: forwback.c,v 1.10 2006/10/26 01:33:08 mrg Exp $ */ +/* $NetBSD: forwback.c,v 1.3 2011/07/03 20:14:12 tron Exp $ */ /* - * Copyright (C) 1984-2005 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -19,16 +19,15 @@ #include "less.h" #include "position.h" -public int hit_eof; /* Keeps track of how many times we hit end of file */ public int screen_trashed; public int squished; public int no_back_scroll = 0; +public int forw_prompt; extern int sigs; extern int top_scroll; 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; @@ -36,13 +35,13 @@ extern int back_scroll; extern int ignore_eoi; extern int clear_bg; extern int final_attr; +extern int oldbot; #if TAGS extern char *tagoption; #endif static void eof_bell __P((void)); static void eof_check __P((void)); -static void squish_check __P((void)); /* * Sound the bell to indicate user is trying to move past end of file. @@ -57,25 +56,47 @@ eof_bell() } /* - * Check to see if the end of file is currently "displayed". + * Check to see if the end of file is currently displayed. */ - static void -eof_check() + public int +eof_displayed() { POSITION pos; if (ignore_eoi) - return; - if (ABORT_SIGS()) - return; + return (0); + + if (ch_length() == NULL_POSITION) + /* + * If the file length is not known, + * we can't possibly be displaying EOF. + */ + return (0); + /* * If the bottom line is empty, we are at EOF. * If the bottom line ends at the file length, * we must be just at EOF. */ pos = position(BOTTOM_PLUS_ONE); - if (pos == NULL_POSITION || pos == ch_length()) - hit_eof++; + return (pos == NULL_POSITION || pos == ch_length()); +} + +/* + * Check to see if the entire file is currently displayed. + */ + public int +entire_file_displayed() +{ + POSITION pos; + + /* Make sure last line of file is displayed. */ + if (!eof_displayed()) + return (0); + + /* Make sure first line of file is displayed. */ + pos = position(0); + return (pos == NULL_POSITION || pos == 0); } /* @@ -84,7 +105,7 @@ eof_check() * of the screen; this can happen when we display a short file * for the first time. */ - static void + public void squish_check() { if (!squished) @@ -142,16 +163,8 @@ forw(n, pos, force, only_last, nblank) pos_clear(); add_forw_pos(pos); force = 1; - if (more_mode == 0) - { - if (top_scroll == OPT_ONPLUS || - (first_time && top_scroll != OPT_ON)) - clear(); - home(); - } - } else - { - clear_bot(); + clear(); + home(); } if (pos != position(BOTTOM_PLUS_ONE) || empty_screen()) @@ -166,8 +179,7 @@ forw(n, pos, force, only_last, nblank) force = 1; if (top_scroll) { - if (top_scroll == OPT_ONPLUS) - clear(); + clear(); home(); } else if (!first_time) { @@ -242,9 +254,16 @@ forw(n, pos, force, only_last, nblank) squished = 1; continue; } - if (top_scroll == OPT_ON) - clear_eol(); put_line(); +#if 0 + /* {{ + * Can't call clear_eol here. The cursor might be at end of line + * on an ignaw terminal, so clear_eol would clear the last char + * of the current line instead of all of the next line. + * If we really need to do this on clear_bg terminals, we need + * to find a better way. + * }} + */ if (clear_bg && apply_at_specials(final_attr) != AT_NORMAL) { /* @@ -256,14 +275,10 @@ forw(n, pos, force, only_last, nblank) */ clear_eol(); } +#endif + forw_prompt = 1; } - if (ignore_eoi) - hit_eof = 0; - else if (eof && !ABORT_SIGS()) - hit_eof++; - else - eof_check(); if (nlines == 0) eof_bell(); else if (do_repaint) @@ -287,7 +302,6 @@ back(n, pos, force, only_last) squish_check(); do_repaint = (n > get_back_scroll() || (only_last && n > sc_height-1)); - hit_eof = 0; while (--n >= 0) { /* @@ -316,11 +330,12 @@ back(n, pos, force, only_last) } } - eof_check(); if (nlines == 0) eof_bell(); else if (do_repaint) repaint(); + else if (!oldbot) + lower_left(); (void) currline(BOTTOM); } @@ -336,7 +351,7 @@ forward(n, force, only_last) { POSITION pos; - if (quit_at_eof && hit_eof && !(ch_getflags() & CH_HELPFILE)) + if (get_quit_at_eof() && eof_displayed() && !(ch_getflags() & CH_HELPFILE)) { /* * If the -e flag is set and we're trying to go @@ -370,7 +385,6 @@ forward(n, force, only_last) } else { eof_bell(); - hit_eof++; return; } } diff --git a/commands/less/less/funcs.h b/external/bsd/less/dist/funcs.h similarity index 87% rename from commands/less/less/funcs.h rename to external/bsd/less/dist/funcs.h index 8abb65b25..def617e11 100644 --- a/commands/less/less/funcs.h +++ b/external/bsd/less/dist/funcs.h @@ -1,4 +1,4 @@ -/* $NetBSD: funcs.h,v 1.9 2006/10/26 01:33:08 mrg Exp $ */ +/* $NetBSD: funcs.h,v 1.3 2011/07/03 20:14:12 tron Exp $ */ public char * save (); public VOID_POINTER ecalloc (); @@ -16,6 +16,7 @@ public void remove_top (); public void win32_scroll_up (); public void lower_left (); + public void line_left (); public void check_winch (); public void goto_line (); public void vbell (); @@ -31,6 +32,8 @@ public void backspace (); public void putbs (); public char WIN32getch (); + public void WIN32setcolors (); + public void WIN32textout (); public void match_brac (); public void ch_ungetchar (); public void end_logfile (); @@ -57,6 +60,7 @@ public int utf_len (); public int is_utf8_well_formed (); public LWCHAR get_wchar (); + public void put_wchar (); public LWCHAR step_char (); public int is_composing_char (); public int is_ubin_char (); @@ -72,6 +76,7 @@ public int cmd_char (); public LINENUM cmd_int (); public char * get_cmdbuf (); + public char * cmd_lastpattern (); public void init_cmdhist (); public void save_cmdhist (); public int in_mca (); @@ -80,6 +85,9 @@ public void ungetcc (); public void ungetsc (); public void commands (); + public int cvt_length (); + public int * cvt_alloc_chpos (); + public void cvt_text (); public void init_cmds (); public void add_fcmd_table (); public void add_ecmd_table (); @@ -103,6 +111,7 @@ public IFILE save_curr_ifile (); public void unsave_ifile (); public void reedit_ifile (); + public void reopen_curr_ifile (); public int edit_stdin (); public void cat_file (); public void use_logfile (); @@ -120,6 +129,10 @@ public char * bad_file (); public POSITION filesize (); public char * shell_coption (); + public char * last_component (); + public int eof_displayed (); + public int entire_file_displayed (); + public void squish_check (); public void forw (); public void back (); public void forward (); @@ -161,6 +174,7 @@ public int pappend (); public int pflushmbc (); public void pdone (); + public void set_status_col (); public int gline (); public void null_line (); public POSITION forw_raw_line (); @@ -182,7 +196,10 @@ public void unmark (); public void opt_o (); public void opt__O (); - public void opt_l (); + public void opt_j (); + public void calc_jump_sline (); + public void opt_shift (); + public void calc_shift_count (); public void opt_k (); public void opt_t (); public void opt__T (); @@ -196,13 +213,16 @@ public void opt_quote (); public void opt_query (); public int get_swindow (); + public char * propt (); public void scan_option (); public void toggle_option (); - public int single_char_option (); + public int opt_has_param (); public char * opt_prompt (); public int isoptpending (); public void nopendopt (); public int getnum (); + public long getfraction (); + public int get_quit_at_eof (); public void init_option (); public struct loption * findopt (); public struct loption * findopt_name (); @@ -221,6 +241,10 @@ public void error (); public void ierror (); public int query (); + public int compile_pattern (); + public void uncompile_pattern (); + public int is_null_pattern (); + public int match_pattern (); public POSITION position (); public void add_forw_pos (); public void add_back_pos (); @@ -236,15 +260,21 @@ public char * eq_message (); public char * pr_string (); public char * wait_message (); + public void init_search (); public void repaint_hilite (); public void clear_attn (); public void undo_search (); + public void clr_hlist (); public void clr_hilite (); + public void clr_filter (); + public int is_filtered (); public int is_hilited (); public void chg_caseless (); public void chg_hilite (); public int search (); public void prep_hilite (); + public void set_filter_pattern (); + public int is_filtering (); public RETSIGTYPE winch (); public RETSIGTYPE winch (); public void init_signals (); diff --git a/commands/less/less/help.c b/external/bsd/less/dist/help.c similarity index 95% rename from commands/less/less/help.c rename to external/bsd/less/dist/help.c index c7da7139b..4f5f9833f 100644 --- a/commands/less/less/help.c +++ b/external/bsd/less/dist/help.c @@ -1,4 +1,4 @@ -/* $NetBSD: help.c,v 1.6 2006/11/20 22:06:26 dsl Exp $ */ +/* $NetBSD: help.c,v 1.3 2011/07/03 20:14:12 tron Exp $ */ /* This file was generated by mkhelp from less.hlp */ #include "less.h" @@ -46,6 +46,7 @@ constant char helpdata[] = { ' ',' ','E','S','C','-','n',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','R','e','p','e','a','t',' ','p','r','e','v','i','o','u','s',' ','s','e','a','r','c','h',',',' ','s','p','a','n','n','i','n','g',' ','f','i','l','e','s','.','\n', ' ',' ','E','S','C','-','N',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','R','e','p','e','a','t',' ','p','r','e','v','i','o','u','s',' ','s','e','a','r','c','h',',',' ','r','e','v','e','r','s','e',' ','d','i','r','.',' ','&',' ','s','p','a','n','n','i','n','g',' ','f','i','l','e','s','.','\n', ' ',' ','E','S','C','-','u',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','U','n','d','o',' ','(','t','o','g','g','l','e',')',' ','s','e','a','r','c','h',' ','h','i','g','h','l','i','g','h','t','i','n','g','.','\n', +' ',' ','&','_','\b','p','_','\b','a','_','\b','t','_','\b','t','_','\b','e','_','\b','r','_','\b','n',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','*',' ',' ','D','i','s','p','l','a','y',' ','o','n','l','y',' ','m','a','t','c','h','i','n','g',' ','l','i','n','e','s','\n', ' ',' ',' ',' ',' ',' ',' ',' ','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\n', ' ',' ',' ',' ',' ',' ',' ',' ','S','e','a','r','c','h',' ','p','a','t','t','e','r','n','s',' ','m','a','y',' ','b','e',' ','m','o','d','i','f','i','e','d',' ','b','y',' ','o','n','e',' ','o','r',' ','m','o','r','e',' ','o','f',':','\n', ' ',' ',' ',' ',' ',' ',' ',' ','^','N',' ','o','r',' ','!',' ',' ','S','e','a','r','c','h',' ','f','o','r',' ','N','O','N','-','m','a','t','c','h','i','n','g',' ','l','i','n','e','s','.','\n', @@ -53,7 +54,6 @@ constant char helpdata[] = { ' ',' ',' ',' ',' ',' ',' ',' ','^','F',' ','o','r',' ','@',' ',' ','S','t','a','r','t',' ','s','e','a','r','c','h',' ','a','t',' ','F','I','R','S','T',' ','f','i','l','e',' ','(','f','o','r',' ','/',')',' ','o','r',' ','l','a','s','t',' ','f','i','l','e',' ','(','f','o','r',' ','?',')','.','\n', ' ',' ',' ',' ',' ',' ',' ',' ','^','K',' ',' ',' ',' ',' ',' ',' ','H','i','g','h','l','i','g','h','t',' ','m','a','t','c','h','e','s',',',' ','b','u','t',' ','d','o','n','\'','t',' ','m','o','v','e',' ','(','K','E','E','P',' ','p','o','s','i','t','i','o','n',')','.','\n', ' ',' ',' ',' ',' ',' ',' ',' ','^','R',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','u','s','e',' ','R','E','G','U','L','A','R',' ','E','X','P','R','E','S','S','I','O','N','S','.','\n', -' ',' ',' ',' ',' ',' ',' ',' ','*',' ','a','n','d',' ','@',' ','m','o','d','i','f','i','e','r','s',' ','a','r','e',' ','r','e','c','o','g','n','i','z','e','d',' ','i','n',' ','l','e','s','s',' ','m','o','d','e',' ','o','n','l','y','.','\n', ' ','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\n', '\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','J','\b','J','U','\b','U','M','\b','M','P','\b','P','I','\b','I','N','\b','N','G','\b','G','\n', @@ -120,12 +120,14 @@ constant char helpdata[] = { ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','i','s','p','l','a','y',' ','h','e','l','p',' ','(','f','r','o','m',' ','c','o','m','m','a','n','d',' ','l','i','n','e',')','.','\n', ' ',' ','-','a',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','s','e','a','r','c','h','-','s','k','i','p','-','s','c','r','e','e','n','\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','F','o','r','w','a','r','d',' ','s','e','a','r','c','h',' ','s','k','i','p','s',' ','c','u','r','r','e','n','t',' ','s','c','r','e','e','n','.','\n', +' ',' ','-','A',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','S','E','A','R','C','H','-','S','K','I','P','-','S','C','R','E','E','N','\n', +' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','F','o','r','w','a','r','d',' ','s','e','a','r','c','h',' ','a','l','w','a','y','s',' ','s','k','i','p','s',' ','t','a','r','g','e','t',' ','l','i','n','e','.','\n', ' ',' ','-','b',' ','[','_','\b','N',']',' ',' ','.','.','.','.',' ',' ','-','-','b','u','f','f','e','r','s','=','[','_','\b','N',']','\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','N','u','m','b','e','r',' ','o','f',' ','b','u','f','f','e','r','s','.','\n', ' ',' ','-','B',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','a','u','t','o','-','b','u','f','f','e','r','s','\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','a','u','t','o','m','a','t','i','c','a','l','l','y',' ','a','l','l','o','c','a','t','e',' ','b','u','f','f','e','r','s',' ','f','o','r',' ','p','i','p','e','s','.','\n', -' ',' ','-','c',' ',' ','-','C',' ',' ','.','.','.','.',' ',' ','-','-','c','l','e','a','r','-','s','c','r','e','e','n',' ',' ','-','-','C','L','E','A','R','-','S','C','R','E','E','N','\n', -' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','R','e','p','a','i','n','t',' ','b','y',' ','s','c','r','o','l','l','i','n','g','/','c','l','e','a','r','i','n','g','.','\n', +' ',' ','-','c',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','c','l','e','a','r','-','s','c','r','e','e','n','\n', +' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','R','e','p','a','i','n','t',' ','b','y',' ','c','l','e','a','r','i','n','g',' ','r','a','t','h','e','r',' ','t','h','a','n',' ','s','c','r','o','l','l','i','n','g','.','\n', ' ',' ','-','d',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','d','u','m','b','\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','u','m','b',' ','t','e','r','m','i','n','a','l','.','\n', ' ',' ','-','D',' ','[','_','\b','x','_','\b','n','_','\b','.','_','\b','n',']',' ',' ','.',' ',' ','-','-','c','o','l','o','r','=','_','\b','x','_','\b','n','_','\b','.','_','\b','n','\n', @@ -152,12 +154,14 @@ constant char helpdata[] = { ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','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', +' ',' ','-','K',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','-','-','q','u','i','t','-','o','n','-','i','n','t','r','\n', +' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','x','i','t',' ','l','e','s','s',' ','i','n',' ','r','e','s','p','o','n','s','e',' ','t','o',' ','c','t','r','l','-','C','.','\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', -' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','U','s','e',' ','l','i','n','e',' ','n','u','m','b','e','r','s','.','\n', +' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','u','s','e',' ','l','i','n','e',' ','n','u','m','b','e','r','s','.','\n', ' ',' ','-','o',' ','[','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']',' ',' ','.',' ',' ','-','-','l','o','g','-','f','i','l','e','=','[','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']','\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','C','o','p','y',' ','t','o',' ','l','o','g',' ','f','i','l','e',' ','(','s','t','a','n','d','a','r','d',' ','i','n','p','u','t',' ','o','n','l','y',')','.','\n', ' ',' ','-','O',' ','[','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']',' ',' ','.',' ',' ','-','-','L','O','G','-','F','I','L','E','=','[','_','\b','f','_','\b','i','_','\b','l','_','\b','e',']','\n', @@ -202,6 +206,11 @@ constant char helpdata[] = { ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','d','i','s','p','l','a','y',' ','t','i','l','d','e','s',' ','a','f','t','e','r',' ','e','n','d',' ','o','f',' ','f','i','l','e','.','\n', ' ',' ','-','#',' ','[','_','\b','N',']',' ',' ','.','.','.','.',' ',' ','-','-','s','h','i','f','t','=','[','_','\b','N',']','\n', ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','H','o','r','i','z','o','n','t','a','l',' ','s','c','r','o','l','l',' ','a','m','o','u','n','t',' ','(','0',' ','=',' ','o','n','e',' ','h','a','l','f',' ','s','c','r','e','e','n',' ','w','i','d','t','h',')','\n', +' ',' ',' ',' ',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','n','o','-','k','e','y','p','a','d','\n', +' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','D','o','n','\'','t',' ','s','e','n','d',' ','k','e','y','p','a','d',' ','i','n','i','t','/','d','e','i','n','i','t',' ','s','e','q','u','e','n','c','e','.','\n', +' ',' ',' ',' ',' ',' ','.','.','.','.','.','.','.','.',' ',' ','-','-','f','o','l','l','o','w','-','n','a','m','e','\n', +' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','T','h','e',' ','F',' ','c','o','m','m','a','n','d',' ','c','h','a','n','g','e','s',' ','f','i','l','e','s',' ','i','f',' ','t','h','e',' ','i','n','p','u','t',' ','f','i','l','e',' ','i','s',' ','r','e','n','a','m','e','d','.','\n', +'\n', '\n', ' ','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','\n', '\n', @@ -226,6 +235,7 @@ constant char helpdata[] = { ' ','T','A','B',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','C','o','m','p','l','e','t','e',' ','f','i','l','e','n','a','m','e',' ','&',' ','c','y','c','l','e','.','\n', ' ','S','H','I','F','T','-','T','A','B',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','E','S','C','-','T','A','B',' ',' ',' ','C','o','m','p','l','e','t','e',' ','f','i','l','e','n','a','m','e',' ','&',' ','r','e','v','e','r','s','e',' ','c','y','c','l','e','.','\n', ' ','C','N','T','L','-','L',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ','C','o','m','p','l','e','t','e',' ','f','i','l','e','n','a','m','e',',',' ','l','i','s','t',' ','a','l','l','.','\n', +'\n', '\n', 0 }; #endif diff --git a/commands/less/less/ifile.c b/external/bsd/less/dist/ifile.c similarity index 98% rename from commands/less/less/ifile.c rename to external/bsd/less/dist/ifile.c index 11c1af909..60ccd48b9 100644 --- a/commands/less/less/ifile.c +++ b/external/bsd/less/dist/ifile.c @@ -1,7 +1,7 @@ -/* $NetBSD: ifile.c,v 1.6 2006/10/26 01:33:08 mrg Exp $ */ +/* $NetBSD: ifile.c,v 1.3 2011/07/03 20:14:12 tron Exp $ */ /* - * Copyright (C) 1984-2004 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/commands/less/less/input.c b/external/bsd/less/dist/input.c similarity index 82% rename from commands/less/less/input.c rename to external/bsd/less/dist/input.c index 645cf23ca..5df9dbaf3 100644 --- a/commands/less/less/input.c +++ b/external/bsd/less/dist/input.c @@ -1,5 +1,7 @@ +/* $NetBSD: input.c,v 1.2 2011/07/03 19:51:26 tron Exp $ */ + /* - * Copyright (C) 1984-2005 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -53,13 +55,14 @@ forw_line(curr_pos) int endline; int backchars; +get_forw_line: if (curr_pos == NULL_POSITION) { null_line(); return (NULL_POSITION); } #if HILITE_SEARCH - if (hilite_search == OPT_ONPLUS || status_col) + if (hilite_search == OPT_ONPLUS || is_filtering() || status_col) /* * If we are ignoring EOI (command F), only prepare * one line ahead, to avoid getting stuck waiting for @@ -76,6 +79,9 @@ forw_line(curr_pos) return (NULL_POSITION); } + /* + * Step back to the beginning of the line. + */ base_pos = curr_pos; for (;;) { @@ -95,10 +101,14 @@ forw_line(curr_pos) --base_pos; } + /* + * Read forward again to the position we should start at. + */ prewind(); plinenum(base_pos); (void) ch_seek(base_pos); - while (base_pos < curr_pos) + new_pos = base_pos; + while (new_pos < curr_pos) { if (ABORT_SIGS()) { @@ -106,12 +116,12 @@ forw_line(curr_pos) return (NULL_POSITION); } c = ch_forw_get(); - backchars = pappend(c, base_pos); - base_pos++; + backchars = pappend(c, new_pos); + new_pos++; if (backchars > 0) { pshift_all(); - base_pos -= backchars; + new_pos -= backchars; while (--backchars >= 0) (void) ch_back_get(); } @@ -119,6 +129,9 @@ forw_line(curr_pos) (void) pflushmbc(); pshift_all(); + /* + * Read the first character to display. + */ c = ch_forw_get(); if (c == EOI) { @@ -127,6 +140,9 @@ forw_line(curr_pos) } blankline = (c == '\n' || c == '\r'); + /* + * Read each character in the line and append to the line buffer. + */ for (;;) { if (ABORT_SIGS()) @@ -167,6 +183,11 @@ forw_line(curr_pos) { do { + if (ABORT_SIGS()) + { + null_line(); + return (NULL_POSITION); + } c = ch_forw_get(); } while (c != '\n' && c != EOI); new_pos = ch_tell(); @@ -181,7 +202,23 @@ forw_line(curr_pos) } c = ch_forw_get(); } - pdone(endline); + + pdone(endline, 1); + +#if HILITE_SEARCH + if (is_filtered(base_pos)) + { + /* + * We don't want to display this line. + * Get the next line. + */ + curr_pos = new_pos; + goto get_forw_line; + } + + if (status_col && is_hilited(base_pos, ch_tell()-1, 1, NULL)) + set_status_col('*'); +#endif if (squeeze && blankline) { @@ -215,18 +252,19 @@ forw_line(curr_pos) back_line(curr_pos) POSITION curr_pos; { - POSITION new_pos, begin_new_pos; + POSITION new_pos, begin_new_pos, base_pos; int c; int endline; int backchars; +get_back_line: if (curr_pos == NULL_POSITION || curr_pos <= ch_zero()) { null_line(); return (NULL_POSITION); } #if HILITE_SEARCH - if (hilite_search == OPT_ONPLUS || status_col) + if (hilite_search == OPT_ONPLUS || is_filtering() || status_col) prep_hilite((curr_pos < 3*size_linebuf) ? 0 : curr_pos - 3*size_linebuf, curr_pos, -1); #endif @@ -241,9 +279,9 @@ back_line(curr_pos) /* * Find out if the "current" line was blank. */ - (void) ch_forw_get(); /* Skip the newline */ - c = ch_forw_get(); /* First char of "current" line */ - (void) ch_back_get(); /* Restore our position */ + (void) ch_forw_get(); /* Skip the newline */ + c = ch_forw_get(); /* First char of "current" line */ + (void) ch_back_get(); /* Restore our position */ (void) ch_back_get(); if (c == '\n' || c == '\r') @@ -285,7 +323,7 @@ back_line(curr_pos) * This is the newline ending the previous line. * We have hit the beginning of the line. */ - new_pos = ch_tell() + 1; + base_pos = ch_tell() + 1; break; } if (c == EOI) @@ -295,7 +333,7 @@ back_line(curr_pos) * This must be the first line in the file. * This must, of course, be the beginning of the line. */ - new_pos = ch_tell(); + base_pos = ch_tell(); break; } } @@ -309,6 +347,7 @@ back_line(curr_pos) * are much longer than the screen width, * but I don't know of any better way. }} */ + new_pos = base_pos; if (ch_seek(new_pos)) { null_line(); @@ -366,7 +405,22 @@ back_line(curr_pos) } } while (new_pos < curr_pos); - pdone(endline); + pdone(endline, 0); + +#if HILITE_SEARCH + if (is_filtered(base_pos)) + { + /* + * We don't want to display this line. + * Get the previous line. + */ + curr_pos = begin_new_pos; + goto get_back_line; + } + + if (status_col && is_hilited(base_pos, ch_tell()-1, 1, NULL)) + set_status_col('*'); +#endif return (begin_new_pos); } diff --git a/external/bsd/less/dist/install.sh b/external/bsd/less/dist/install.sh new file mode 100644 index 000000000..41ea84f9e --- /dev/null +++ b/external/bsd/less/dist/install.sh @@ -0,0 +1,119 @@ +#!/bin/sh + +# +# install - install a program, script, or datafile +# This comes from X11R5; it is not part of GNU. +# +# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $ +# +# This script is compatible with the BSD install script, but was written +# from scratch. +# + + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit="${DOITPROG-}" + + +# put in absolute paths if you don't have them in your path; or use env. vars. + +mvprog="${MVPROG-mv}" +cpprog="${CPPROG-cp}" +chmodprog="${CHMODPROG-chmod}" +chownprog="${CHOWNPROG-chown}" +chgrpprog="${CHGRPPROG-chgrp}" +stripprog="${STRIPPROG-strip}" +rmprog="${RMPROG-rm}" + +instcmd="$mvprog" +chmodcmd="" +chowncmd="" +chgrpcmd="" +stripcmd="" +rmcmd="$rmprog -f" +mvcmd="$mvprog" +src="" +dst="" + +while [ x"$1" != x ]; do + case $1 in + -c) instcmd="$cpprog" + shift + continue;; + + -m) chmodcmd="$chmodprog $2" + shift + shift + continue;; + + -o) chowncmd="$chownprog $2" + shift + shift + continue;; + + -g) chgrpcmd="$chgrpprog $2" + shift + shift + continue;; + + -s) stripcmd="$stripprog" + shift + continue;; + + *) if [ x"$src" = x ] + then + src=$1 + else + dst=$1 + fi + shift + continue;; + esac +done + +if [ x"$src" = x ] +then + echo "install: no input file specified" + exit 1 +fi + +if [ x"$dst" = x ] +then + echo "install: no destination specified" + exit 1 +fi + + +# If destination is a directory, append the input filename; if your system +# does not like double slashes in filenames, you may need to add some logic + +if [ -d $dst ] +then + dst="$dst"/`basename $src` +fi + +# Make a temp file name in the proper directory. + +dstdir=`dirname $dst` +dsttmp=$dstdir/_inst.$$_ + +# Move or copy the file name to the temp name + +$doit $instcmd $src $dsttmp + +# and set any options; do chmod last to preserve setuid bits + +if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi +if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi +if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi +if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi + +# Now rename the file to the real destination. + +$doit $rmcmd $dst +$doit $mvcmd $dsttmp $dst + + +exit 0 diff --git a/commands/less/less/jump.c b/external/bsd/less/dist/jump.c similarity index 89% rename from commands/less/less/jump.c rename to external/bsd/less/dist/jump.c index 38132ccf9..fdfc554d4 100644 --- a/commands/less/less/jump.c +++ b/external/bsd/less/dist/jump.c @@ -1,5 +1,7 @@ +/* $NetBSD: jump.c,v 1.2 2011/07/03 19:51:26 tron Exp $ */ + /* - * Copyright (C) 1984-2005 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -16,7 +18,6 @@ #include "less.h" #include "position.h" -extern int hit_eof; extern int jump_sline; extern int squished; extern int screen_trashed; @@ -31,22 +32,35 @@ extern int top_scroll; jump_forw() { POSITION pos; + POSITION end_pos; if (ch_end_seek()) { error("Cannot seek to end of file", NULL_PARG); return; } + /* + * Note; lastmark will be called later by jump_loc, but it fails + * because the position table has been cleared by pos_clear below. + * So call it here before calling pos_clear. + */ + lastmark(); /* * Position the last line in the file at the last screen line. * Go back one line from the end of the file * to get to the beginning of the last line. */ - pos = back_line(ch_tell()); + pos_clear(); + end_pos = ch_tell(); + pos = back_line(end_pos); if (pos == NULL_POSITION) jump_loc((POSITION)0, sc_height-1); else + { jump_loc(pos, sc_height-1); + if (position(sc_height-1) != end_pos) + repaint(); + } } /* @@ -102,8 +116,9 @@ repaint() * Jump to a specified percentage into the file. */ public void -jump_percent(percent) +jump_percent(percent, fraction) int percent; + long fraction; { POSITION pos, len; @@ -121,7 +136,7 @@ jump_percent(percent) error("Don't know length of file", NULL_PARG); return; } - pos = percent_pos(len, percent); + pos = percent_pos(len, percent, fraction); if (pos >= len) pos = len-1; @@ -186,8 +201,10 @@ jump_loc(pos, sline) forw(nline, position(BOTTOM_PLUS_ONE), 1, 0, 0); else back(-nline, position(TOP), 1, 0); +#if HILITE_SEARCH if (show_attn) repaint_hilite(1); +#endif return; } @@ -225,8 +242,10 @@ jump_loc(pos, sline) * that we can just scroll there after all. */ forw(sc_height-sline+nline-1, bpos, 1, 0, 0); +#if HILITE_SEARCH if (show_attn) repaint_hilite(1); +#endif return; } pos = back_line(pos); @@ -242,7 +261,6 @@ jump_loc(pos, sline) } } lastmark(); - hit_eof = 0; squished = 0; screen_trashed = 0; forw(sc_height-1, pos, 1, 0, sline-nline); @@ -274,13 +292,15 @@ jump_loc(pos, sline) * that we can just scroll there after all. */ back(nline+1, tpos, 1, 0); +#if HILITE_SEARCH if (show_attn) repaint_hilite(1); +#endif return; } } lastmark(); - if (top_scroll != OPT_ON) + if (!top_scroll) clear(); else home(); diff --git a/commands/less/less/less.1 b/external/bsd/less/dist/less.1 similarity index 84% rename from commands/less/less/less.1 rename to external/bsd/less/dist/less.1 index e74a2ca83..004c43f65 100644 --- a/commands/less/less/less.1 +++ b/external/bsd/less/dist/less.1 @@ -1,8 +1,6 @@ -.\" $NetBSD: less.1,v 1.17 2006/12/17 16:16:53 jmmv Exp $ -.\" -.TH LESS 1 "Version 394: 03 Dec 2005" +.TH LESS 1 "Version 444: 09 Jun 2011" .SH NAME -less \- opposite of more (a filter for browsing text files) +less \- opposite of more .SH SYNOPSIS .B "less \-?" .br @@ -12,7 +10,7 @@ less \- opposite of more (a filter for browsing text files) .br .B "less \-\-version" .br -.B "less [\-[+]aBcCdeEfFgGiIJKLmMnNqQrRsSuUVwWX~]" +.B "less [\-[+]aABcCdeEfFgGiIJKLmMnNqQrRsSuUVwWX~]" .br .B " [\-b \fIspace\fP] [\-h \fIlines\fP] [\-j \fIline\fP] [\-k \fIkeyfile\fP]" .br @@ -22,43 +20,20 @@ less \- opposite of more (a filter for browsing text files) .br .B " [\-# \fIshift\fP] [+[+]\fIcmd\fP] [\-\-] [\fIfilename\fP]..." .br -.B "more [options]" -.br -.B "page [options]" -.br (See the OPTIONS section for alternate option syntax with long option names.) .SH DESCRIPTION .I Less -is a program similar to +is a program similar to .I more -(1), a filter that shows text one page at a time. -In NetBSD the two utilities are implemented by the same binary but they -expose slightly different behavior. -Their differences are detailed below: -.IP \(bu 4 -.I less -allows backward movement in the file as well as forward movement. -.IP \(bu 4 +(1), but which allows backward movement +in the file as well as forward movement. +Also, .I less does not have to read the entire input file before starting, so with large input files it starts up faster than text editors like .I vi (1). -.IP \(bu 4 -.I more -ignores * and @ in search commands. -.IP \(bu 4 -.I less -does not clear the screen or squish it to the bottom, for the first -page, or when exiting. -.IP \(bu 4 -.I more -sets the -E -m -G -f flags automatically. -.IP \(bu 4 -.I more -uses $MORE instead of $LESS for extra options. -.PP .I Less uses termcap (or terminfo on some systems), so it can run on a variety of terminals. @@ -70,7 +45,7 @@ Commands are based on both .I more and .I vi. -Commands may be preceded by a decimal number, +Commands may be preceded by a decimal number, called N in the descriptions below. The number is used by some commands, as indicated. @@ -90,12 +65,12 @@ Like SPACE, but if N is specified, it becomes the new window size. .IP "ESC-SPACE" Like SPACE, but scrolls a full screenful, even if it reaches end-of-file in the process. -.IP "RETURN or ^N or e or ^E or j or ^J" +.IP "ENTER or RETURN or ^N or e or ^E or j or ^J" Scroll forward N lines, default 1. The entire N lines are displayed, even if N is more than the screen size. .IP "d or ^D" Scroll forward N lines, default one half of the screen size. -If N is specified, it becomes the new default for +If N is specified, it becomes the new default for subsequent d and u commands. .IP "b or ^B or ESC-v" Scroll backward N lines, default one window (see option \-z below). @@ -108,7 +83,7 @@ The entire N lines are displayed, even if N is more than the screen size. Warning: some systems use ^Y as a special job control character. .IP "u or ^U" Scroll backward N lines, default one half of the screen size. -If N is specified, it becomes the new default for +If N is specified, it becomes the new default for subsequent d and u commands. .IP "ESC-) or RIGHTARROW" Scroll horizontally right N characters, default half the screen width @@ -134,17 +109,19 @@ Normally this command would be used when already at the end of the file. It is a way to monitor the tail of a file which is growing while it is being viewed. (The behavior is similar to the "tail \-f" command.) -.IP "g or \*[Lt] or ESC-\*[Lt]" +.IP "g or < or ESC-<" Go to line N in the file, default 1 (beginning of file). (Warning: this may be slow if N is large.) -.IP "G or \*[Gt] or ESC-\*[Gt]" +.IP "G or > or ESC->" Go to line N in the file, default the end of the file. (Warning: this may be slow if N is large, or if N is not specified and standard input, rather than a file, is being read.) .IP "p or %" Go to a position N percent into the file. -N should be between 0 and 100. +N should be between 0 and 100, and may contain a decimal point. +.IP "P" +Go to the line containing byte offset N in the file. .IP "{" If a left curly bracket appears in the top line displayed on the screen, @@ -173,16 +150,16 @@ Like }, but applies to square brackets rather than curly brackets. Followed by two characters, acts like {, but uses the two characters as open and close brackets, respectively. -For example, "ESC ^F \*[Lt] \*[Gt]" could be used to -go forward to the \*[Gt] which matches the \*[Lt] in the top displayed line. +For example, "ESC ^F < >" could be used to +go forward to the > which matches the < in the top displayed line. .IP "ESC-^B" Followed by two characters, acts like }, but uses the two characters as open and close brackets, respectively. -For example, "ESC ^B \*[Lt] \*[Gt]" could be used to -go backward to the \*[Lt] which matches the \*[Gt] in the bottom displayed line. +For example, "ESC ^B < >" could be used to +go backward to the < which matches the > in the bottom displayed line. .IP m -Followed by any lowercase letter, +Followed by any lowercase letter, marks the current position with that letter. .IP "'" (Single quote.) @@ -199,10 +176,9 @@ Same as single quote. .IP /pattern Search forward in the file for the N-th line containing the pattern. N defaults to 1. -When invoked as less, the pattern is an extended regular expression. -Otherwise, the pattern is a basic regular expression, as recognized by -.I ed. -The search starts at the second line displayed +The pattern is a regular expression, as recognized by +the regular expression library supplied by your system. +The search starts at the first line displayed (but see the \-a and \-j options, which change this). .sp Certain characters are special @@ -213,18 +189,16 @@ they modify the type of search rather than become part of the pattern: Search for lines which do NOT match the pattern. .IP "^E or *" Search multiple files. -That is, if the search reaches the END of the current file +That is, if the search reaches the END of the current file without finding a match, the search continues in the next file in the command line list. -The * modifier is available when invoked as less only. .IP "^F or @" Begin the search at the first line of the FIRST file in the command line list, regardless of what is currently displayed on the screen or the settings of the \-a or \-j options. -The @ modifier is available when invoked as less only. .IP "^K" -Highlight any text which matches the pattern on the current screen, +Highlight any text which matches the pattern on the current screen, but don't move to the first match (KEEP current position). .IP "^R" Don't interpret regular expression metacharacters; @@ -240,7 +214,7 @@ Certain characters are special as in the / command: Search for lines which do NOT match the pattern. .IP "^E or *" Search multiple files. -That is, if the search reaches the beginning of the current file +That is, if the search reaches the beginning of the current file without finding a match, the search continues in the previous file in the command line list. .IP "^F or @" @@ -276,21 +250,38 @@ Repeat previous search, but in the reverse direction and crossing file boundaries. .IP "ESC-u" Undo search highlighting. -Turn off highlighting of strings matching the current search pattern. +Turn off highlighting of strings matching the current search pattern. If highlighting is already off because of a previous ESC-u command, turn highlighting back on. Any search command will also turn highlighting back on. (Highlighting can also be disabled by toggling the \-G option; in that case search commands do not turn highlighting back on.) +.IP "&pattern" +Display only lines which match the pattern; +lines which do not match the pattern are not displayed. +If pattern is empty (if you type & immediately followed by ENTER), +any filtering is turned off, and all lines are displayed. +While filtering is in effect, an ampersand is displayed at the +beginning of the prompt, +as a reminder that some lines in the file may be hidden. +.sp +Certain characters are special as in the / command: +.RS +.IP "^N or !" +Display only lines which do NOT match the pattern. +.IP "^R" +Don't interpret regular expression metacharacters; +that is, do a simple textual comparison. +.RE .IP ":e [filename]" Examine a new file. If the filename is missing, the "current" file (see the :n and :p commands below) from the list of files in the command line is re-examined. A percent sign (%) in the filename is replaced by the name of the -current file. +current file. A pound sign (#) is replaced by the name of the previously examined file. -However, two consecutive percent signs are simply -replaced with a single percent sign. +However, two consecutive percent signs are simply +replaced with a single percent sign. This allows you to enter a filename that contains a percent sign in the name. Similarly, two consecutive pound signs are replaced with a single pound sign. @@ -342,8 +333,8 @@ the current setting is printed and nothing is changed. .IP \-\- Like the \- command, but takes a long option name (see OPTIONS below) rather than a single option letter. -You must press RETURN after typing the option name. -A ^P immediately after the second dash suppresses printing of a +You must press ENTER or RETURN after typing the option name. +A ^P immediately after the second dash suppresses printing of a message describing the new setting, as in the \- command. .IP \-+ Followed by one of the command line option letters @@ -372,22 +363,22 @@ The setting of the option is not changed. (Double underscore.) Like the _ (underscore) command, but takes a long option name rather than a single option letter. -You must press RETURN after typing the option name. +You must press ENTER or RETURN after typing the option name. .IP +cmd Causes the specified cmd to be executed each time a new file is examined. -For example, +G causes +For example, +G causes .I less -to initially display each file starting at the end +to initially display each file starting at the end rather than the beginning. .IP V -Prints the version number of -.I less +Prints the version number of +.I less being run. .IP "q or Q or :q or :Q or ZZ" Exits .I less. .PP -The following +The following four commands may or may not be valid, depending on your particular installation. .PP @@ -400,20 +391,20 @@ See also the discussion of LESSEDIT under the section on PROMPTS below. .IP "! shell-command" Invokes a shell to run the shell-command given. A percent sign (%) in the command is replaced by the name of the -current file. +current file. A pound sign (#) is replaced by the name of the previously examined file. "!!" repeats the last shell command. "!" with no shell command simply invokes a shell. On Unix systems, the shell is taken from the environment variable SHELL, or defaults to "sh". On MS-DOS and OS/2 systems, the shell is the normal command processor. -.IP "| \*[Lt]m\*[Gt] shell-command" -\*[Lt]m\*[Gt] represents any mark letter. +.IP "| shell-command" + represents any mark letter. Pipes a section of the input file to the given shell command. The section of the file to be piped is between the first line on the current screen and the position marked by the letter. -\*[Lt]m\*[Gt] may also be ^ or $ to indicate beginning or end of file respectively. -If \*[Lt]m\*[Gt] is . or newline, the current screen is piped. + may also be ^ or $ to indicate beginning or end of file respectively. +If is . or newline, the current screen is piped. .IP "s filename" Save the input to a file. This only works if the input is a pipe, not an ordinary file. @@ -421,10 +412,10 @@ This only works if the input is a pipe, not an ordinary file. .SH OPTIONS Command line options are described below. Most options may be changed while -.I less +.I less is running, via the "\-" command. .PP -Most options may be given in one of two forms: +Most options may be given in one of two forms: either a dash followed by a single letter, or two dashes followed by a long option name. A long option name may be abbreviated as long as @@ -440,18 +431,18 @@ For example, \-\-Quit-at-eof is equivalent to \-\-QUIT-AT-EOF. Options are also taken from the environment variable "LESS". For example, to avoid typing "less \-options ..." each time -.I less +.I less is invoked, you might tell .I csh: .sp setenv LESS "-options" .sp -or if you use +or if you use .I sh: .sp LESS="-options"; export LESS .sp -On MS-DOS, you don't need the quotes, but you should replace any +On MS-DOS, you don't need the quotes, but you should replace any percent signs in the options string by double percent signs. .sp The environment variable is parsed before the command line, @@ -474,11 +465,24 @@ This option displays a summary of the commands accepted by (Depending on how your shell interprets the question mark, 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, +By default, forward searches start at the top of the displayed screen +and backwards searches start at the bottom of the displayed screen +(except for repeated searches invoked by the n or N commands, +which start after or before the "target" line respectively; +see the \-j option for more about the target line). +The \-a option causes forward searches to instead start at +the bottom of the screen +and backward searches to start at the top of the screen, thus skipping all lines displayed on the screen. -By default, searches start at the second line on the screen -(or after the last found line; see the \-j option). +.IP "\-A or \-\-SEARCH-SKIP-SCREEN" +Causes all forward searches (not just non-repeated searches) +to start just after the target line, and all backward searches +to start just before the target line. +Thus, forward searches will skip part of the displayed screen +(from the first line up to and including the target line). +Similarly backwards searches will skip the displayed screen +from the last line up to and including the target line. +This was the default behavior in less versions prior to 441. .IP "\-b\fIn\fP or \-\-buffers=\fIn\fP" Specifies the amount of buffer space .I less @@ -488,7 +492,7 @@ By default 64K of buffer space is used for each file 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. +the entire file can be read into memory. .IP "\-B or \-\-auto-buffers" By default, when data is read from a pipe, buffers are allocated automatically as needed. @@ -499,44 +503,40 @@ 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; +most recently viewed part of the piped data is kept in memory; any earlier data is lost. .IP "\-c or \-\-clear-screen" Causes full screen repaints to be painted from the top line down. By default, full screen repaints are done by scrolling from the bottom of the screen. .IP "\-C or \-\-CLEAR-SCREEN" -The \-C option is like \-c, but the screen is cleared before it is repainted. -.IP "\-d -The -d option causes the default prompt to include the basic directions -``[Press space to continue, 'q' to quit.]''. The -d -option also causes the message ``[Press 'h' for instructions.]'' to be -displayed when an invalid command is entered (normally, the bell is -rung). This option is useful in environments where users may not be -experienced with pagers. -.IP \-\-dumb" -The \-\-dumb option suppresses the error message +Same as \-c, for compatibility with older versions of +.I less. +.IP "\-d or \-\-dumb" +The \-d option suppresses the error message normally displayed if the terminal is dumb; that is, lacks some important capability, such as the ability to clear the screen or scroll backward. -The \-\-dumb option does not otherwise change the behavior of +The \-d option does not otherwise change the behavior of .I less 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. -\fBx\fP is a single character which selects the type of text whose color is +\fBx\fP is a single character which selects the type of text whose color is being set: n=normal, s=standout, d=bold, u=underlined, k=blink. -\fIcolor\fP is a pair of numbers separated by a period. -The first number selects the foreground color and the second selects +\fIcolor\fP is a pair of numbers separated by a period. +The first number selects the foreground color and the second selects the background color of the text. -A single number \fIN\fP is the same as \fIN.0\fP. +A single number \fIN\fP is the same as \fIN.M\fP, +where \fIM\fP is the normal background color. + .IP "\-e or \-\-quit-at-eof" Causes .I less to automatically exit the second time it reaches end-of-file. -By default, the only way to exit +By default, the only way to exit .I less is via the "q" command. .IP "\-E or \-\-QUIT-AT-EOF" @@ -550,6 +550,8 @@ Also suppresses the warning message when a binary file is opened. By default, .I less will refuse to open non-regular files. +Note that some operating systems will not allow directories +to be read, even if \-f is set. .IP "\-F or \-\-quit-if-one-screen" Causes .I less @@ -561,8 +563,8 @@ Normally, will highlight ALL strings which match the last search command. The \-g option changes this behavior to highlight only the particular string which was found by the last search command. -This can cause -.I less +This can cause +.I less to run somewhat faster than the default. .IP "\-G or \-\-HILITE-SEARCH" The \-G option suppresses all highlighting of strings found by search commands. @@ -576,7 +578,7 @@ backward, \-h0 is implied.) Causes searches to ignore case; that is, uppercase and lowercase are considered identical. This option is ignored if any uppercase letters -appear in the search pattern; +appear in the search pattern; in other words, if a pattern contains uppercase letters, then that search does not ignore case. .IP "\-I or \-\-IGNORE-CASE" @@ -585,18 +587,26 @@ the pattern contains uppercase letters. .IP "\-j\fIn\fP or \-\-jump-target=\fIn\fP" 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 number: the top line on the screen +The target line is the line specified by any command to +search for a pattern, jump to a line number, +jump to a file percentage or jump to a tag. +The screen line may be 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 screen: the bottom line on the screen is \-1, the second to the bottom is \-2, and so on. -If the \-j option is used, searches begin at the line immediately -after the target line. +Alternately, the screen line may be specified as a fraction of the height +of the screen, starting with a decimal point: .5 is in the middle of the +screen, .3 is three tenths down from the first line, and so on. +If the line is specified as a fraction, the actual line number +is recalculated if the terminal window is resized, so that the +target line remains at the specified fraction of the screen height. +If any form of the \-j option is used, +forward searches begin at the line immediately after the target line, +and backward searches begin at the target line, +unless changed by \-a or \-A. For example, if "\-j4" is used, the target line is the -fourth line on the screen, so searches begin at the fifth line +fourth line on the screen, so forward searches begin at the fifth line on the screen. .IP "\-J or \-\-status-column" Displays a status column at the left edge of the screen. @@ -611,16 +621,19 @@ to open and interpret the named file as a Multiple \-k options may be specified. If the LESSKEY or LESSKEY_SYSTEM environment variable is set, or if a lesskey file is found in a standard place (see KEY BINDINGS), -it is also used as a +it is also used as a .I lesskey file. .IP "\-K or \-\-quit-on-intr" Causes .I less -to exit immediately when an interrupt character (usually ^C) is typed. +to exit immediately (with status 2) +when an interrupt character (usually ^C) is typed. Normally, an interrupt character causes .I less to stop whatever it is doing and return to its command prompt. +Note that use of this option makes it impossible to return to the +command prompt from the "F" command. .IP "\-L or \-\-no-lessopen" Ignore the LESSOPEN environment variable (see the INPUT PREPROCESSOR section below). @@ -638,7 +651,7 @@ prompts with a colon. .IP "\-M or \-\-LONG-PROMPT" Causes .I less -to prompt even more verbosely than +to prompt even more verbosely than .I more. .IP "\-n or \-\-line-numbers" Suppresses line numbers. @@ -659,7 +672,7 @@ Causes 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, +If the file already exists, .I less will ask for confirmation before overwriting it. .IP "\-O\fIfilename\fP or \-\-LOG-FILE=\fIfilename\fP" @@ -683,12 +696,12 @@ to start at the first occurrence of \fIpattern\fP in the file. Provides a way to tailor the three prompt styles to your own preference. This option would normally be put in the LESS environment -variable, rather than being typed in with each +variable, rather than being typed in with each .I less command. Such an option must either be the last option in the LESS variable, or be terminated by a dollar sign. --Ps followed by a string changes the default (short) prompt +-Ps followed by a string changes the default (short) prompt to that string. -Pm changes the medium (\-m) prompt. -PM changes the long (\-M) prompt. @@ -700,7 +713,7 @@ letters and special escape sequences. See the section on PROMPTS for more details. .IP "\-q or \-\-quiet or \-\-silent" Causes moderately "quiet" operation: -the terminal bell is not rung +the terminal bell is not rung if an attempt is made to scroll past the end of the file or before the beginning of the file. If the terminal has a "visual bell", it is used instead. @@ -784,11 +797,11 @@ 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 +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 +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. @@ -823,11 +836,6 @@ 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. -.IP "\-\-no-keypad" -Disables sending the keypad initialization and deinitialization strings -to the terminal. -This is sometimes useful if the keypad strings make the numeric -keypad behave in an undesirable manner. .IP "\-y\fIn\fP or \-\-max-forw-scroll=\fIn\fP" Specifies a maximum number of lines to scroll forward. If it is necessary to scroll forward more than \fIn\fP lines, @@ -839,11 +847,11 @@ By default, any forward movement causes scrolling. Changes the default scrolling window size to \fIn\fP 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 +The "z" may be omitted for compatibility with some versions of .I more. If the number .I n -is negative, it indicates +is negative, it indicates .I n lines less than the current screen size. For example, if the screen is 24 lines, \fI\-z-4\fP sets the @@ -871,6 +879,31 @@ Specifies the default number of positions to scroll horizontally in the RIGHTARROW and LEFTARROW commands. If the number specified is zero, it sets the default number of positions to one half of the screen width. +Alternately, the number may be specified as a fraction of the width +of the screen, starting with a decimal point: .5 is half of the +screen width, .3 is three tenths of the screen width, and so on. +If the number is specified as a fraction, the actual number of +scroll positions is recalculated if the terminal window is resized, +so that the actual scroll remains at the specified fraction +of the screen width. +.IP "\-\-no-keypad" +Disables sending the keypad initialization and deinitialization strings +to the terminal. +This is sometimes useful if the keypad strings make the numeric +keypad behave in an undesirable manner. +.IP "\-\-follow-name" +Normally, if the input file is renamed while an F command is executing, +.I less +will continue to display the contents of the original file despite +its name change. +If \-\-follow-name is specified, during an F command +.I less +will periodically attempt to reopen the file by name. +If the reopen succeeds and the file is a different file from the original +(which means that a new file has been created +with the same name as the original (now renamed) file), +.I less +will display the contents of that new file. .IP \-\- A command line argument of "\-\-" marks the end of option arguments. Any arguments following this are interpreted as filenames. @@ -883,7 +916,7 @@ For example, +G tells .I less 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, +\*[Lt]number\*[Gt] acts like +\*[Lt]number\*[Gt]g; +As a special case, + acts like +g; that is, it starts the display at the specified line number (however, see the caveat under the "g" command above). If the option starts with ++, the initial command applies to @@ -897,8 +930,9 @@ When entering command line at the bottom of the screen or the pattern for a search command), certain keys can be used to manipulate the command line. Most commands have an alternate 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.) +a key does not exist on a particular keyboard. +(Note that the forms beginning with ESC do not work +in some MS-DOS and Windows systems because ESC is the line erase character.) 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. @@ -938,7 +972,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 "\e" is appended.) -The environment variable LESSSEPARATOR can be used to specify a +The environment variable LESSSEPARATOR can be used to specify a different character to append to a directory name. .IP "BACKTAB [ ESC-TAB ]" Like, TAB, but cycles in the reverse direction thru the matching filenames. @@ -951,11 +985,13 @@ Delete the entire command line, or cancel the command if the command line is empty. If you have changed your line-kill character in Unix to something other than ^U, that character is used instead of ^U. +.IP "^G" +Delete the entire command line and return to the main prompt. .SH "KEY BINDINGS" -You may define your own +You may define your own .I less -commands by using the program +commands by using the program .I lesskey (1) to create a lesskey file. @@ -968,7 +1004,7 @@ and to set environment variables. If the environment variable LESSKEY is set, .I less uses that as the name of the lesskey file. -Otherwise, +Otherwise, .I less looks in a standard place for the lesskey file: On Unix systems, @@ -992,25 +1028,24 @@ manual page for more details. .P 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 +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, .I less uses that as the name of the system-wide lesskey file. Otherwise, -.I less +.I less looks in a standard place for the system-wide lesskey file: -On NetBSD, the system-wide lesskey file is in /etc/sysless. -On other Unix systems, the system-wide lesskey file is /usr/local/etc/sysless. -(However, if -.I less +On Unix systems, the system-wide lesskey file is /usr/local/etc/sysless. +(However, if +.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:\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 +You may define an "input preprocessor" for .I less. Before .I less @@ -1019,10 +1054,10 @@ 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 +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, +that is, .I less will display the original filename as the name of the current file. .PP @@ -1030,17 +1065,17 @@ 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 filename, +If the input preprocessor does not output a replacement filename, .I less 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 environment variable to a command line which will invoke your input preprocessor. -This command line should include one occurrence of the string "%s", +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. .PP -When +When .I less closes a file opened in such a way, it will call another program, called the input postprocessor, @@ -1048,11 +1083,11 @@ which may 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 file. -To set up an input postprocessor, set the LESSCLOSE environment variable +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 original name of the file and -the second with the name of the replacement file, +It may include two occurrences of the string "%s"; +the first is replaced with the original name of the file and +the second with the name of the replacement file, which was output by LESSOPEN. .PP For example, on many Unix systems, these two scripts will allow you @@ -1066,7 +1101,7 @@ lessopen.sh: .br case "$1" in .br - *.Z) uncompress \-c $1 \*[Gt]/tmp/less.$$ 2\*[Gt]/dev/null + *.Z) uncompress -\c $1 >/tmp/less.$$ 2>/dev/null .br if [ \-s /tmp/less.$$ ]; then .br @@ -1095,21 +1130,21 @@ More complex LESSOPEN and LESSCLOSE scripts may be written to accept other types of compressed files, and so on. .PP It is also possible to set up an input preprocessor to -pipe the file data directly to +pipe the file data directly to .I less, rather than putting the data into a replacement file. -This avoids the need to decompress the entire file before +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 +then there is no replacement file and .I less uses the original file, as normal. To use an input pipe, -make the first character in the LESSOPEN environment variable a +make the first character in the LESSOPEN environment variable a vertical bar (|) to signify that the input preprocessor is an input pipe. .PP For example, on many Unix systems, this script will work like the @@ -1135,6 +1170,22 @@ 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 "\-". +.PP +For compatibility with previous versions of +.I less, +the input preprocessor or pipe is not used if +.I less +is viewing standard input. +However, if the first character of LESSOPEN is a dash (\-), +the input preprocessor is used on standard input as well as other files. +In this case, the dash is not considered to be part of +the preprocessor command. +If standard input is being viewed, the input preprocessor is passed +a file name consisting of a single dash. +Similarly, if the first two characters of LESSOPEN are vertical bar and dash +(|\-), the input pipe is used on standard input as well as other files. +Again, in this case the dash is not considered to be part of +the input pipe command. .SH "NATIONAL CHARACTER SETS" There are three types of characters in the input file: @@ -1178,10 +1229,12 @@ Selects a Russian character set. Selects a character set appropriate for NeXT computers. .IP utf-8 Selects the UTF-8 encoding of the ISO 10646 character set. +UTF-8 is special in that it supports multi-byte characters in the input file. +It is the only character set that supports multi-byte characters. .IP windows Selects a character set appropriate for Microsoft Windows (cp 1251). .PP -In special cases, it may be desired to tailor +In rare cases, it may be desired to tailor .I less to use a character set other than the ones definable by LESSCHARSET. In this case, the environment variable LESSCHARDEF can be used @@ -1195,7 +1248,7 @@ 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 necessarily +(This is an example, and does not necessarily represent any real character set.) .PP This table shows the value of LESSCHARDEF which is equivalent @@ -1223,7 +1276,7 @@ to each of the possible values for LESSCHARSET: .PP If neither LESSCHARSET nor LESSCHARDEF is set, but any of the strings "UTF-8", "UTF8", "utf-8" or "utf8" -is found in the LC_ALL, LC_TYPE or LANG +is found in the LC_ALL, LC_CTYPE or LANG environment variables, then the default character set is utf-8. .PP If that string is not found, but your system supports the @@ -1240,12 +1293,12 @@ interface is also not available, the default character set is latin1. .PP Control and binary characters are displayed in standout (reverse video). Each such character is displayed in caret notation if possible -(e.g. ^A for control-A). Caret notation is used only if +(e.g. ^A for control-A). Caret notation is used only if inverting the 0100 bit results in a normal printable character. Otherwise, the character is displayed as a hex number in angle brackets. -This format can be changed by +This format can be changed by setting the LESSBINFMT environment variable. -LESSBINFMT may begin with a "*" and one character to select +LESSBINFMT may begin with a "*" and one character to select the display attribute: "*k" is blinking, "*d" is bold, "*u" is underlined, "*s" is standout, and "*n" is normal. @@ -1254,8 +1307,7 @@ The remainder of LESSBINFMT is a string which may include one printf-style escape sequence (a % followed by x, X, o, d, etc.). For example, if LESSBINFMT is "*u[%x]", binary characters are displayed in underlined hexadecimal surrounded by brackets. -The default if no LESSBINFMT is specified is "*s\*[Lt]%X\*[Gt]". -The default if no LESSBINFMT is specified is "*s\*[Lt]%02X\*[Gt]". +The default if no LESSBINFMT is specified is "*s<%02X>". Warning: the result of expanding the character via LESSBINFMT must be less than 31 characters. .PP @@ -1263,7 +1315,7 @@ When the character set is utf-8, the LESSUTFBINFMT environment variable acts similarly to LESSBINFMT but it applies to Unicode code points that were successfully decoded but are unsuitable for display (e.g., unassigned code points). -Its default value is "\*[Lt]U+%04lX\*[Gt]". +Its default value is "". Note that LESSUTFBINFMT and LESSBINFMT share their display attribute setting ("*x") so specifying one will affect both; LESSUTFBINFMT is read after LESSBINFMT so its setting, if any, @@ -1311,6 +1363,8 @@ or the EDITOR environment variable if VISUAL is not defined). See the discussion of the LESSEDIT feature below. .IP "%f" Replaced by the name of the current input file. +.IP "%F" +Replaced by the last component of the name of the current input file. .IP "%i" Replaced by the index of the current file in the list of input files. @@ -1449,7 +1503,7 @@ The default value for LESSEDIT is: Note that this expands to the editor name, followed by a + and the line number, followed by the file name. If your editor does not accept the "+linenumber" syntax, or has other -differences in invocation syntax, the LESSEDIT variable can be +differences in invocation syntax, the LESSEDIT variable can be changed to modify this default. .SH SECURITY @@ -1480,12 +1534,42 @@ filename completion (TAB, ^L) .PP Less can also be compiled to be permanently in "secure" mode. +.SH "COMPATIBILITY WITH MORE" +If the environment variable LESS_IS_MORE is set to 1, +or if the program is invoked via a file link named "more", +.I less +behaves (mostly) in conformance with the POSIX "more" command specification. +In this mode, less behaves differently in these ways: +.PP +The \-e option works differently. +If the \-e option is not set, +.I less +behaves as if the \-E option were set. +If the \-e option is set, +.I less +behaves as if the \-e and \-F options were set. +.PP +The \-m option works differently. +If the \-m option is not set, the medium prompt is used, +and it is prefixed with the string "--More--". +If the \-m option is set, the short prompt is used. +.PP +The \-n option acts like the \-z option. +The normal behavior of the \-n option is unavailable in this mode. +.PP +The parameter to the \-p option is taken to be a +.I less +command rather than a search pattern. +.PP +The LESS environment variable is ignored, +and the MORE environment variable is used in its place. + .SH "ENVIRONMENT VARIABLES" Environment variables may be specified either in the system environment -as usual, or in a +as usual, or in a .I lesskey (1) file. -If environment variables are defined in more than one place, +If environment variables are defined in more than one place, variables defined in a local lesskey file take precedence over variables defined in the system environment, which take precedence over variables defined in the system-wide lesskey file. @@ -1511,7 +1595,7 @@ Language for determining the character set. .IP LC_CTYPE Language for determining the character set. .IP LESS -Options which are passed to +Options which are passed to .I less automatically. .IP LESSANSIENDCHARS @@ -1545,7 +1629,7 @@ Normally should be set to "global" if your system has the Name of the history file used to remember search commands and shell commands between invocations of .I less. -If set to "\-", a history file is not used. +If set to "\-" or "/dev/null", a history file is not used. The default is "$HOME/.lesshst" on Unix systems, "$HOME/_lesshst" on DOS and Windows systems, or "$HOME/lesshst.ini" or "$INIT/lesshst.ini" on OS/2 systems. @@ -1572,14 +1656,22 @@ See discussion under SECURITY. String to be appended to a directory name in filename completion. .IP LESSUTFBINFMT Format for displaying non-printable Unicode code points. +.IP LESS_IS_MORE +Emulate the +.I more +(1) command. .IP LINES Sets the number of lines on the screen. Takes precedence over the number of lines 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.) +.IP MORE +Options which are passed to +.I more +automatically. .IP PATH -User's search path (used to find a lesskey file +User's search path (used to find a lesskey file on MS-DOS and OS/2 systems). .IP SHELL The shell used to execute the ! command, as well as to expand filenames. @@ -1593,47 +1685,8 @@ The name of the editor (used for the v command). .SH "SEE ALSO" lesskey(1) -.SH WARNINGS -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. -.PP -If the :e command is used to name more than one file, -and one of the named files has been viewed previously, -the new files may be entered into the list in an unexpected order. -.PP -On certain older terminals (the so-called "magic cookie" terminals), -search highlighting will cause an erroneous display. -On such terminals, search highlighting is disabled by default -to avoid possible problems. -.PP -In certain cases, when search highlighting is enabled and -a search pattern begins with a ^, -more text than the matching string may be highlighted. -(This problem does not occur when less is compiled to use the POSIX -regular expression package.) -.PP -When viewing text containing ANSI color escape sequences using the \-R option, -searching will not find text containing an embedded escape sequence. -Also, search highlighting may change the color of some of the text -which follows the highlighted text. -.PP -On some systems, -.I setlocale -claims that ASCII characters 0 thru 31 are control characters -rather than binary characters. -This causes -.I less -to treat some binary files as ordinary, non-binary files. -To workaround this problem, set the environment variable -LESSCHARSET to "ascii" (or whatever character set is appropriate). -.PP -This manual is too long. -.PP -See http://www.greenwoodsoftware.com/less for the list of known bugs in all versions of less. - .SH COPYRIGHT -Copyright (C) 1984-2005 Mark Nudelman +Copyright (C) 1984-2011 Mark Nudelman .PP less is part of the GNU project and is free software. You can redistribute it and/or modify it @@ -1642,7 +1695,7 @@ under the terms of either 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 +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. @@ -1656,8 +1709,12 @@ See the GNU General Public License for more details. .SH AUTHOR .PP -Mark Nudelman \*[Lt]markn@greenwoodsoftware.com\*[Gt] +Mark Nudelman .br Send bug reports or comments to the above address or to bug-less@gnu.org. .br -For more information, see the less homepage at http://www.greenwoodsoftware.com/less. +See http://www.greenwoodsoftware.com/less/bugs.html for the latest list of known bugs in less. +.br +For more information, see the less homepage at +.br +http://www.greenwoodsoftware.com/less. diff --git a/commands/less/less/less.h b/external/bsd/less/dist/less.h similarity index 85% rename from commands/less/less/less.h rename to external/bsd/less/dist/less.h index 415412752..6116626da 100644 --- a/commands/less/less/less.h +++ b/external/bsd/less/dist/less.h @@ -1,7 +1,7 @@ -/* $NetBSD: less.h,v 1.9 2008/02/16 07:20:54 matt Exp $ */ +/* $NetBSD: less.h,v 1.3 2011/07/03 20:14:12 tron Exp $ */ /* - * Copyright (C) 1984-2005 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -10,6 +10,7 @@ * contact the author, see the README file. */ +#define NEWBOT 1 /* * Standard include file for "less". @@ -72,6 +73,9 @@ #if HAVE_CTYPE_H #include #endif +#if HAVE_WCTYPE_H +#include +#endif #if HAVE_LIMITS_H #include #endif @@ -126,16 +130,23 @@ void free(); #undef IS_SPACE #undef IS_DIGIT -#if !HAVE_UPPER_LOWER -#define IS_UPPER(c) ASCII_IS_UPPER(c) -#define IS_LOWER(c) ASCII_IS_LOWER(c) -#define TO_UPPER(c) ASCII_TO_UPPER(c) -#define TO_LOWER(c) ASCII_TO_LOWER(c) +#if HAVE_WCTYPE +#define IS_UPPER(c) iswupper(c) +#define IS_LOWER(c) iswlower(c) +#define TO_UPPER(c) towupper(c) +#define TO_LOWER(c) towlower(c) #else +#if HAVE_UPPER_LOWER #define IS_UPPER(c) isupper((unsigned char) (c)) #define IS_LOWER(c) islower((unsigned char) (c)) #define TO_UPPER(c) toupper((unsigned char) (c)) #define TO_LOWER(c) tolower((unsigned char) (c)) +#else +#define IS_UPPER(c) ASCII_IS_UPPER(c) +#define IS_LOWER(c) ASCII_IS_LOWER(c) +#define TO_UPPER(c) ASCII_TO_UPPER(c) +#define TO_LOWER(c) ASCII_TO_LOWER(c) +#endif #endif #ifdef isspace @@ -150,6 +161,8 @@ void free(); #define IS_DIGIT(c) ((c) >= '0' && (c) <= '9') #endif +#define IS_CSI_START(c) (((LWCHAR)(c)) == ESC || (((LWCHAR)(c)) == CSI)) + #ifndef NULL #define NULL 0 #endif @@ -186,6 +199,13 @@ void free(); #define BAD_LSEEK ((off_t)-1) +#ifndef SEEK_SET +#define SEEK_SET 0 +#endif +#ifndef SEEK_END +#define SEEK_END 2 +#endif + #ifndef CHAR_BIT #define CHAR_BIT 8 #endif @@ -297,6 +317,10 @@ struct textlist #define READ_INTR (-2) +/* A fraction is represented by an int n; the fraction is n/NUM_FRAC_DENOM */ +#define NUM_FRAC_DENOM 1000000 +#define NUM_LOG_FRAC_DENOM 6 + /* How quiet should we be? */ #define NOT_QUIET 0 /* Ring bell at eof and for errors */ #define LITTLE_QUIET 1 /* Ring bell only for errors */ @@ -313,14 +337,16 @@ struct textlist #define BS_CONTROL 2 /* \b treated as control char; prints as ^H */ /* How should we search? */ -#define SRCH_FORW (1 << 0) /* Search forward from current position */ -#define SRCH_BACK (1 << 1) /* Search backward from current position */ -#define SRCH_NO_MOVE (1 << 2) /* Highlight, but don't move */ -#define SRCH_FIND_ALL (1 << 4) /* Find and highlight all matches */ -#define SRCH_NO_MATCH (1 << 8) /* Search for non-matching lines */ -#define SRCH_PAST_EOF (1 << 9) /* Search past end-of-file, into next file */ -#define SRCH_FIRST_FILE (1 << 10) /* Search starting at the first file */ -#define SRCH_NO_REGEX (1 << 12) /* Don't use regular expressions */ +#define SRCH_FORW (1 << 0) /* Search forward from current position */ +#define SRCH_BACK (1 << 1) /* Search backward from current position */ +#define SRCH_NO_MOVE (1 << 2) /* Highlight, but don't move */ +#define SRCH_FIND_ALL (1 << 4) /* Find and highlight all matches */ +#define SRCH_NO_MATCH (1 << 8) /* Search for non-matching lines */ +#define SRCH_PAST_EOF (1 << 9) /* Search past end-of-file, into next file */ +#define SRCH_FIRST_FILE (1 << 10) /* Search starting at the first file */ +#define SRCH_NO_REGEX (1 << 12) /* Don't use regular expressions */ +#define SRCH_FILTER (1 << 13) /* Search is for '&' (filter) command */ +#define SRCH_AFTER_TARGET (1 << 14) /* Start search after the target line */ #define SRCH_REVERSE(t) (((t) & SRCH_FORW) ? \ (((t) & ~SRCH_FORW) | SRCH_BACK) : \ @@ -421,6 +447,7 @@ struct textlist #endif /* IS_EBCDIC_HOST */ #define ESC CONTROL('[') +#define CSI ((unsigned char)'\233') #if _OSK_MWC32 #define LSIGNAL(sig,func) os9_signal(sig,func) @@ -449,8 +476,12 @@ struct textlist #define QUIT_OK 0 #define QUIT_ERROR 1 +#define QUIT_INTERRUPT 2 #define QUIT_SAVED_STATUS (-1) +#define FOLLOW_DESC 0 +#define FOLLOW_NAME 1 + /* filestate flags */ #define CH_CANSEEK 001 #define CH_KEEPOPEN 002 @@ -461,6 +492,12 @@ struct textlist #define FAKE_HELPFILE "@/\\less/\\help/\\file/\\@" +/* Flags for cvt_text */ +#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 */ + #include "funcs.h" /* Functions not included in funcs.h */ diff --git a/external/bsd/less/dist/less.hlp b/external/bsd/less/dist/less.hlp new file mode 100644 index 000000000..84d951f0d --- /dev/null +++ b/external/bsd/less/dist/less.hlp @@ -0,0 +1,231 @@ + + SSUUMMMMAARRYY OOFF LLEESSSS CCOOMMMMAANNDDSS + + Commands marked with * may be preceded by a number, _N. + Notes in parentheses indicate the behavior if _N is given. + + h H Display this help. + q :q Q :Q ZZ Exit. + --------------------------------------------------------------------------- + + MMOOVVIINNGG + + e ^E j ^N CR * Forward one line (or _N lines). + y ^Y k ^K ^P * Backward one line (or _N lines). + f ^F ^V SPACE * Forward one window (or _N lines). + b ^B ESC-v * Backward one window (or _N lines). + z * Forward one window (and set window to _N). + w * Backward one window (and set window to _N). + 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). + F Forward forever; like "tail -f". + r ^R ^L Repaint screen. + R Repaint screen, discarding buffered input. + --------------------------------------------------- + Default "window" is the screen height. + Default "half-window" is half of the screen height. + --------------------------------------------------------------------------- + + SSEEAARRCCHHIINNGG + + /_p_a_t_t_e_r_n * Search forward for (_N-th) matching line. + ?_p_a_t_t_e_r_n * Search backward for (_N-th) matching line. + n * Repeat previous search (for _N-th occurrence). + N * Repeat previous search in reverse direction. + ESC-n * Repeat previous search, spanning files. + ESC-N * Repeat previous search, reverse dir. & spanning files. + ESC-u Undo (toggle) search highlighting. + &_p_a_t_t_e_r_n * Display only matching lines + --------------------------------------------------- + Search patterns may be modified by one or more of: + ^N or ! Search for NON-matching lines. + ^E or * Search multiple files (pass thru END OF FILE). + ^F or @ Start search at FIRST file (for /) or last file (for ?). + ^K Highlight matches, but don't move (KEEP position). + ^R Don't use REGULAR EXPRESSIONS. + --------------------------------------------------------------------------- + + JJUUMMPPIINNGG + + g < ESC-< * Go to first line in file (or line _N). + G > ESC-> * Go to last line in file (or line _N). + p % * Go to beginning of file (or _N percent into file). + t * Go to the (_N-th) next tag. + T * Go to the (_N-th) previous tag. + { ( [ * Find close bracket } ) ]. + } ) ] * Find open bracket { ( [. + ESC-^F _<_c_1_> _<_c_2_> * Find close bracket _<_c_2_>. + ESC-^B _<_c_1_> _<_c_2_> * Find open bracket _<_c_1_> + --------------------------------------------------- + Each "find close bracket" command goes forward to the close bracket + matching the (_N-th) open bracket in the top line. + Each "find open bracket" command goes backward to the open bracket + matching the (_N-th) close bracket in the bottom line. + + m_<_l_e_t_t_e_r_> Mark the current position with . + '_<_l_e_t_t_e_r_> Go to a previously marked position. + '' Go to the previous position. + ^X^X Same as '. + --------------------------------------------------- + A mark is any upper-case or lower-case letter. + Certain marks are predefined: + ^ means beginning of the file + $ means end of the file + --------------------------------------------------------------------------- + + CCHHAANNGGIINNGG FFIILLEESS + + :e [_f_i_l_e] Examine a new file. + ^X^V Same as :e. + :n * Examine the (_N-th) next file from the command line. + :p * Examine the (_N-th) previous file from the command line. + :x * Examine the first (or _N-th) file from the command line. + :d Delete the current file from the command line list. + = ^G :f Print current file name. + --------------------------------------------------------------------------- + + MMIISSCCEELLLLAANNEEOOUUSS CCOOMMMMAANNDDSS + + -_<_f_l_a_g_> Toggle a command line option [see OPTIONS below]. + --_<_n_a_m_e_> Toggle a command line option, by name. + __<_f_l_a_g_> Display the setting of a command line option. + ___<_n_a_m_e_> Display the setting of an option, by name. + +_c_m_d Execute the less cmd each time a new file is examined. + + !_c_o_m_m_a_n_d Execute the shell command with $SHELL. + |XX_c_o_m_m_a_n_d Pipe file between current pos & mark XX to shell command. + v Edit the current file with $VISUAL or $EDITOR. + V Print version number of "less". + --------------------------------------------------------------------------- + + OOPPTTIIOONNSS + + Most options may be changed either on the command line, + or from within less by using the - or -- command. + Options may be given in one of two forms: either a single + character preceded by a -, or a name preceeded by --. + + -? ........ --help + Display help (from command line). + -a ........ --search-skip-screen + Forward search skips current screen. + -A ........ --SEARCH-SKIP-SCREEN + Forward search always skips target line. + -b [_N] .... --buffers=[_N] + Number of buffers. + -B ........ --auto-buffers + Don't automatically allocate buffers for pipes. + -c ........ --clear-screen + Repaint by clearing rather than scrolling. + -d ........ --dumb + Dumb terminal. + -D [_x_n_._n] . --color=_x_n_._n + Set screen colors. (MS-DOS only) + -e -E .... --quit-at-eof --QUIT-AT-EOF + Quit at end of file. + -f ........ --force + Force open non-regular files. + -F ........ --quit-if-one-screen + Quit if entire file fits on first screen. + -g ........ --hilite-search + Highlight only last match for searches. + -G ........ --HILITE-SEARCH + Don't highlight any matches for searches. + -h [_N] .... --max-back-scroll=[_N] + Backward scroll limit. + -i ........ --ignore-case + Ignore case in searches that do not contain uppercase. + -I ........ --IGNORE-CASE + Ignore case in all searches. + -j [_N] .... --jump-target=[_N] + Screen position of target lines. + -J ........ --status-column + Display a status column at left edge of screen. + -k [_f_i_l_e] . --lesskey-file=[_f_i_l_e] + Use a lesskey file. + -K --quit-on-intr + Exit less in response to ctrl-C. + -L ........ --no-lessopen + Ignore the LESSOPEN environment variable. + -m -M .... --long-prompt --LONG-PROMPT + Set prompt style. + -n -N .... --line-numbers --LINE-NUMBERS + Don't use line numbers. + -o [_f_i_l_e] . --log-file=[_f_i_l_e] + Copy to log file (standard input only). + -O [_f_i_l_e] . --LOG-FILE=[_f_i_l_e] + Copy to log file (unconditionally overwrite). + -p [_p_a_t_t_e_r_n] --pattern=[_p_a_t_t_e_r_n] + Start at pattern (from command line). + -P [_p_r_o_m_p_t] --prompt=[_p_r_o_m_p_t] + Define new prompt. + -q -Q .... --quiet --QUIET --silent --SILENT + Quiet the terminal bell. + -r -R .... --raw-control-chars --RAW-CONTROL-CHARS + Output "raw" control characters. + -s ........ --squeeze-blank-lines + Squeeze multiple blank lines. + -S ........ --chop-long-lines + Chop long lines. + -t [_t_a_g] .. --tag=[_t_a_g] + Find a tag. + -T [_t_a_g_s_f_i_l_e] --tag-file=[_t_a_g_s_f_i_l_e] + Use an alternate tags file. + -u -U .... --underline-special --UNDERLINE-SPECIAL + Change handling of backspaces. + -V ........ --version + Display the version number of "less". + -w ........ --hilite-unread + Highlight first new line after forward-screen. + -W ........ --HILITE-UNREAD + Highlight first new line after any forward movement. + -x [_N[,...]] --tabs=[_N[,...]] + Set tab stops. + -X ........ --no-init + Don't use termcap init/deinit strings. + --no-keypad + Don't use termcap keypad init/deinit strings. + -y [_N] .... --max-forw-scroll=[_N] + Forward scroll limit. + -z [_N] .... --window=[_N] + Set size of window. + -" [_c[_c]] . --quotes=[_c[_c]] + Set shell quote characters. + -~ ........ --tilde + Don't display tildes after end of file. + -# [_N] .... --shift=[_N] + Horizontal scroll amount (0 = one half screen width) + ........ --no-keypad + Don't send keypad init/deinit sequence. + ........ --follow-name + The F command changes files if the input file is renamed. + + + --------------------------------------------------------------------------- + + LLIINNEE EEDDIITTIINNGG + + These keys can be used to edit text being entered + on the "command line" at the bottom of the screen. + + RightArrow ESC-l Move cursor right one character. + LeftArrow ESC-h Move cursor left one character. + CNTL-RightArrow ESC-RightArrow ESC-w Move cursor right one word. + CNTL-LeftArrow ESC-LeftArrow ESC-b Move cursor left one word. + HOME ESC-0 Move cursor to start of line. + END ESC-$ Move cursor to end of line. + BACKSPACE Delete char to left of cursor. + DELETE ESC-x Delete char under cursor. + CNTL-BACKSPACE ESC-BACKSPACE Delete word to left of cursor. + CNTL-DELETE ESC-DELETE ESC-X Delete word under cursor. + CNTL-U ESC (MS-DOS only) Delete entire line. + UpArrow ESC-k Retrieve previous command line. + DownArrow ESC-j Retrieve next command line. + TAB Complete filename & cycle. + SHIFT-TAB ESC-TAB Complete filename & reverse cycle. + CNTL-L Complete filename, list all. + + diff --git a/external/bsd/less/dist/lessecho.1 b/external/bsd/less/dist/lessecho.1 new file mode 100644 index 000000000..46540e8bc --- /dev/null +++ b/external/bsd/less/dist/lessecho.1 @@ -0,0 +1,47 @@ +.TH LESSECHO 1 "Version 444: 09 Jun 2011" +.SH NAME +lessecho \- expand metacharacters +.SH SYNOPSIS +.B lessecho +.I "[-ox] [-cx] [-pn] [-dn] [-mx] [-nn] [-ex] [-a] file ..." +.SH "DESCRIPTION" +.I lessecho +is a program that simply echos its arguments on standard output. +But any argument containing spaces is enclosed in quotes. +.SH OPTIONS +A summary of options is included below. +.TP +.B \-ox +Specifies "x" to be the open quote character. +.TP +.B \-cx +Specifies "x" to be the close quote character. +.TP +.B \-pn +Specifies "n" to be the open quote character, as an integer. +.TP +.B \-dn +Specifies "n" to be the close quote character, as an integer. +.TP +.B \-mx +Specifies "x" to be a metachar. +.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. +.SH "SEE ALSO" +less(1) +.SH AUTHOR +This manual page was written by Thomas Schoepf , +for the Debian GNU/Linux system (but may be used by others). +.PP +Send bug reports or comments to bug-less@gnu.org. diff --git a/commands/less/lessecho/lessecho.c b/external/bsd/less/dist/lessecho.c similarity index 97% rename from commands/less/lessecho/lessecho.c rename to external/bsd/less/dist/lessecho.c index fac7a1f24..9faddd74f 100644 --- a/commands/less/lessecho/lessecho.c +++ b/external/bsd/less/dist/lessecho.c @@ -1,7 +1,7 @@ -/* $NetBSD: lessecho.c,v 1.6 2006/10/26 01:33:08 mrg Exp $ */ +/* $NetBSD: lessecho.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ /* - * Copyright (C) 1984-2004 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -30,7 +30,7 @@ #include "less.h" -static char *version = "$Revision: 1.6 $"; +static char *version = "$Revision: 1.3 $"; static int quote_all = 0; static char openquote = '"'; diff --git a/commands/less/lesskey/lesskey.1 b/external/bsd/less/dist/lesskey.1 similarity index 80% rename from commands/less/lesskey/lesskey.1 rename to external/bsd/less/dist/lesskey.1 index 248ebb3f9..d305b957c 100644 --- a/commands/less/lesskey/lesskey.1 +++ b/external/bsd/less/dist/lesskey.1 @@ -1,6 +1,4 @@ -.\" $NetBSD: lesskey.1,v 1.9 2006/10/26 01:33:08 mrg Exp $ -.\" -.TH LESSKEY 1 "Version 394: 03 Dec 2005" +.TH LESSKEY 1 "Version 444: 09 Jun 2011" .SH NAME lesskey \- specify key bindings for less .SH SYNOPSIS @@ -13,9 +11,9 @@ lesskey \- specify key bindings for less .B "lesskey --version" .SH DESCRIPTION .I Lesskey -is used to specify a set of key bindings to be used by +is used to specify a set of key bindings to be used by .I less. -The input file is a text file which describes the key bindings, +The input file is a text file which describes the key bindings. If the input file is "-", standard input is read. If no input file is specified, a standard filename is used as the name of the input file, which depends on the system being used: @@ -23,9 +21,9 @@ On Unix systems, $HOME/.lesskey is used; on MS-DOS systems, $HOME/_lesskey is used; and on OS/2 systems $HOME/lesskey.ini is used, or $INIT/lesskey.ini if $HOME is undefined. -The output file is a binary file which is used by +The output file is a binary file which is used by .I less. -If no output file is specified, +If no output file is specified, and the environment variable LESSKEY is set, the value of LESSKEY is used as the name of the output file. Otherwise, a standard filename is used as the name of the output file, @@ -40,7 +38,7 @@ will overwrite it. .PP The -V or --version option causes .I lesskey -to print its version number and immediately exit. +to print its version number and immediately exit. If -V or --version is present, other options and arguments are ignored. .PP The input file consists of one or more @@ -66,7 +64,7 @@ If the command section is the first section in the file, this line may be omitted. The command section consists of lines of the form: .sp - \fIstring\fP \*[Lt]whitespace\*[Gt] \fIaction\fP [extra-string] \*[Lt]newline\*[Gt] + \fIstring\fP \fIaction\fP [extra-string] .sp Whitespace is any sequence of one or more spaces and/or tabs. The \fIstring\fP is the command key(s) which invoke the action. @@ -132,47 +130,47 @@ default command keys used by less: .sp .nf #command - \er forw-line - \en forw-line - e forw-line - j forw-line + \er forw-line + \en forw-line + e forw-line + j forw-line \ekd forw-line - ^E forw-line - ^N forw-line - k back-line - y back-line - ^Y back-line - ^K back-line - ^P back-line - J forw-line-force - K back-line-force - Y back-line-force - d forw-scroll - ^D forw-scroll - u back-scroll - ^U back-scroll - \e40 forw-screen - f forw-screen - ^F forw-screen - ^V forw-screen + ^E forw-line + ^N forw-line + k back-line + y back-line + ^Y back-line + ^K back-line + ^P back-line + J forw-line-force + K back-line-force + Y back-line-force + d forw-scroll + ^D forw-scroll + u back-scroll + ^U back-scroll + \e40 forw-screen + f forw-screen + ^F forw-screen + ^V forw-screen \ekD forw-screen - b back-screen - ^B back-screen - \eev back-screen + b back-screen + ^B back-screen + \eev back-screen \ekU back-screen - z forw-window - w back-window + z forw-window + w back-window \ee\e40 forw-screen-force - F forw-forever - R repaint-flush - r repaint - ^R repaint - ^L repaint + F forw-forever + R repaint-flush + r repaint + ^R repaint + ^L repaint \eeu undo-hilite g goto-line \ekh goto-line - \*[Lt] goto-line - \ee\*[Lt] goto-line + < goto-line + \ee< goto-line p percent % percent \ee[ left-scroll @@ -188,8 +186,8 @@ default command keys used by less: \ee^F forw-bracket \ee^B back-bracket G goto-end - \ee\*[Gt] goto-end - \*[Gt] goto-end + \ee> goto-end + > goto-end \eke goto-end = status ^G status @@ -202,6 +200,7 @@ default command keys used by less: \een repeat-search-all N reverse-search \eeN reverse-search-all + & filter m set-mark ' goto-mark ^X^X goto-mark @@ -217,14 +216,14 @@ default command keys used by less: - toggle-option :t toggle-option t s toggle-option o - _ display-option - | pipe - v visual - ! shell - + firstcmd - H help - h help - V version + _ display-option + | pipe + v visual + ! shell + + firstcmd + H help + h help + V version 0 digit 1 digit 2 digit @@ -235,11 +234,11 @@ default command keys used by less: 7 digit 8 digit 9 digit - q quit - Q quit - :q quit - :Q quit - ZZ quit + q quit + Q quit + :q quit + :Q quit + ZZ quit .fi .sp .SH PRECEDENCE @@ -248,13 +247,13 @@ Commands specified by take precedence over the default commands. A default command key may be disabled by including it in the input file with the action "invalid". -Alternatively, a key may be defined +Alternatively, a key may be defined to do nothing by using the action "noaction". -"noaction" is similar to "invalid", but +"noaction" is similar to "invalid", but .I less -will give an error beep for an "invalid" command, +will give an error beep for an "invalid" command, but not for a "noaction" command. -In addition, ALL default commands may be disabled by +In addition, ALL default commands may be disabled by adding this control line to the input file: .sp #stop @@ -262,8 +261,8 @@ adding this control line to the input file: This will cause all default commands to be ignored. The #stop line should be the last line in that section of the file. .PP -Be aware that #stop can be dangerous. -Since all default commands are disabled, +Be aware that #stop can be dangerous. +Since all default commands are disabled, you must provide sufficient commands before the #stop line to enable all necessary actions. For example, failure to provide a "quit" command can lead to frustration. @@ -274,7 +273,7 @@ The line-editing section begins with the line: #line-edit .sp This section specifies new key bindings for the line editing commands, -in a manner similar to the way key bindings for +in a manner similar to the way key bindings for ordinary commands are specified in the #command section. The line-editing section consists of a list of keys and actions, one per line as in the example below. @@ -312,6 +311,7 @@ default line-editing keys used by less: \eek up \eku up \eej down + ^G abort .fi .sp @@ -330,12 +330,12 @@ If a variable is specified in the system environment and also in a lesskey file, the value in the lesskey file takes precedence. Although the lesskey file can be used to override variables set in the environment, the main purpose of assigning variables in the lesskey file -is simply to have all +is simply to have all .I less configuration information stored in one file. .SH EXAMPLE -The following input file sets the -i option whenever +The following input file sets the -i option whenever .I less is run, and specifies the character set to be "latin1": .sp @@ -350,17 +350,12 @@ is run, and specifies the character set to be "latin1": less(1) .SH WARNINGS -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 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). This NUL character should be represented as \e340 in a lesskey file. .SH COPYRIGHT -Copyright (C) 2004 Mark Nudelman +Copyright (C) 2000-2011 Mark Nudelman .PP lesskey is part of the GNU project and is free software; you can redistribute it and/or modify it @@ -373,14 +368,14 @@ WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. .PP -You should have received a copy of the GNU General Public License +You should have received a copy of the GNU General Public License along with lesskey; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. .SH AUTHOR .PP -Mark Nudelman \*[Lt]markn@greenwoodsoftware.com\*[Gt] +Mark Nudelman .br Send bug reports or comments to the above address or to bug-less@gnu.org. diff --git a/commands/less/lesskey/lesskey.c b/external/bsd/less/dist/lesskey.c similarity index 86% rename from commands/less/lesskey/lesskey.c rename to external/bsd/less/dist/lesskey.c index fded6cfb0..8a0c23c5a 100644 --- a/commands/less/lesskey/lesskey.c +++ b/external/bsd/less/dist/lesskey.c @@ -1,7 +1,7 @@ -/* $NetBSD: lesskey.c,v 1.9 2006/10/26 01:33:08 mrg Exp $ */ +/* $NetBSD: lesskey.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ /* - * Copyright (C) 1984-2004 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -95,63 +95,64 @@ struct cmdname 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 }, + { "filter", A_FILTER }, + { "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[] = @@ -167,6 +168,7 @@ struct cmdname editnames[] = { "insert", EC_INSERT }, { "invalid", EC_UINVALID }, { "kill-line", EC_LINEKILL }, + { "abort", EC_ABORT }, { "left", EC_LEFT }, { "literal", EC_LITERAL }, { "right", EC_RIGHT }, @@ -543,7 +545,7 @@ add_cmd_str(s) control_line(s) char *s; { -#define PREFIX(str,pat) (strncmp(str,pat,strlen(pat)-1) == 0) +#define PREFIX(str,pat) (strncmp(str,pat,strlen(pat)) == 0) if (PREFIX(s, "#line-edit")) { diff --git a/commands/less/less/lesskey.h b/external/bsd/less/dist/lesskey.h similarity index 88% rename from commands/less/less/lesskey.h rename to external/bsd/less/dist/lesskey.h index 1734d2663..5e27338a3 100644 --- a/commands/less/less/lesskey.h +++ b/external/bsd/less/dist/lesskey.h @@ -1,5 +1,7 @@ +/* $NetBSD: lesskey.h,v 1.2 2011/07/03 19:51:26 tron Exp $ */ + /* - * Copyright (C) 1984-2004 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/commands/less/less/lglob.h b/external/bsd/less/dist/lglob.h similarity index 96% rename from commands/less/less/lglob.h rename to external/bsd/less/dist/lglob.h index 1c232fb08..8507e266e 100644 --- a/commands/less/less/lglob.h +++ b/external/bsd/less/dist/lglob.h @@ -1,5 +1,7 @@ +/* $NetBSD: lglob.h,v 1.3 2011/07/03 20:14:13 tron Exp $ */ + /* - * Copyright (C) 1984-2004 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/commands/less/less/line.c b/external/bsd/less/dist/line.c similarity index 91% rename from commands/less/less/line.c rename to external/bsd/less/dist/line.c index cf7b98964..be766a648 100644 --- a/commands/less/less/line.c +++ b/external/bsd/less/dist/line.c @@ -1,7 +1,7 @@ -/* $NetBSD: line.c,v 1.11 2006/10/26 01:33:08 mrg Exp $ */ +/* $NetBSD: line.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ /* - * Copyright (C) 1984-2005 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -37,7 +37,6 @@ 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 line_matches; /* Number of search matches in this line */ static char pendc; static POSITION pendpos; static char *end_ansi_chars; @@ -162,9 +161,6 @@ prewind() lmargin = 0; if (status_col) lmargin += 1; -#if HILITE_SEARCH - line_matches = 0; -#endif } /* @@ -268,7 +264,7 @@ pshift(shift) while (shifted <= shift && from < curr) { c = linebuf[from]; - if (c == ESC && ctldisp == OPT_ONPLUS) + if (ctldisp == OPT_ONPLUS && IS_CSI_START(c)) { /* Keep cumulative effect. */ linebuf[to] = c; @@ -523,7 +519,7 @@ in_ansi_esc_seq() for (p = &linebuf[curr]; p > linebuf; ) { LWCHAR ch = step_char(&p, -1, linebuf); - if (ch == ESC) + if (IS_CSI_START(ch)) return (1); if (!is_ansi_middle(ch)) return (0); @@ -592,7 +588,6 @@ store_char(ch, a, rep, pos) if (a != AT_ANSI) a |= AT_HILITE; } - line_matches += matches; } #endif @@ -600,15 +595,18 @@ store_char(ch, a, rep, pos) { if (!is_ansi_end(ch) && !is_ansi_middle(ch)) { /* Remove whole unrecognized sequence. */ + char *p = &linebuf[curr]; + LWCHAR bch; do { - --curr; - } while (linebuf[curr] != ESC); + bch = step_char(&p, -1, linebuf); + } while (p > linebuf && !IS_CSI_START(bch)); + curr = p - linebuf; return 0; } a = AT_ANSI; /* Will force re-AT_'ing around it. */ w = 0; } - else if (ctldisp == OPT_ONPLUS && ch == ESC) + else if (ctldisp == OPT_ONPLUS && IS_CSI_START(ch)) { a = AT_ANSI; /* Will force re-AT_'ing around it. */ w = 0; @@ -942,7 +940,7 @@ do_append(ch, rep, pos) } else if ((!utf_mode || is_ascii_char(ch)) && control_char((char)ch)) { do_control_char: - if (ctldisp == OPT_ON || (ctldisp == OPT_ONPLUS && ch == ESC)) + if (ctldisp == OPT_ON || (ctldisp == OPT_ONPLUS && IS_CSI_START(ch))) { /* * Output as a normal character. @@ -992,8 +990,9 @@ pflushmbc() * Terminate the line in the line buffer. */ public void -pdone(endline) +pdone(endline, forw) int endline; + int forw; { (void) pflushmbc(); @@ -1025,23 +1024,56 @@ pdone(endline) /* * Add a newline if necessary, * and append a '\0' to the end of the line. + * We output a newline if we're not at the right edge of the screen, + * or if the terminal doesn't auto wrap, + * or if this is really the end of the line AND the terminal ignores + * a newline at the right edge. + * (In the last case we don't want to output a newline if the terminal + * doesn't ignore it since that would produce an extra blank line. + * But we do want to output a newline if the terminal ignores it in case + * the next line is blank. In that case the single newline output for + * that blank line would be ignored!) */ - if (column < sc_width || !auto_wrap || ignaw || ctldisp == OPT_ON) + if (column < sc_width || !auto_wrap || (endline && ignaw) || ctldisp == OPT_ON) { linebuf[curr] = '\n'; attr[curr] = AT_NORMAL; curr++; + } + else if (ignaw && column >= sc_width && forw) + { + /* + * Terminals with "ignaw" don't wrap until they *really* need + * to, i.e. when the character *after* the last one to fit on a + * line is output. But they are too hard to deal with when they + * get in the state where a full screen width of characters + * have been output but the cursor is sitting on the right edge + * instead of at the start of the next line. + * So we nudge them into wrapping by outputting a space + * character plus a backspace. But do this only if moving + * forward; if we're moving backward and drawing this line at + * the top of the screen, the space would overwrite the first + * char on the next line. We don't need to do this "nudge" + * at the top of the screen anyway. + */ + linebuf[curr] = ' '; + attr[curr++] = AT_NORMAL; + linebuf[curr] = '\b'; + attr[curr++] = AT_NORMAL; } linebuf[curr] = '\0'; attr[curr] = AT_NORMAL; +} -#if HILITE_SEARCH - if (status_col && line_matches > 0) - { - linebuf[0] = '*'; - attr[0] = AT_NORMAL|AT_HILITE; - } -#endif +/* + * + */ + public void +set_status_col(c) + char c; +{ + linebuf[0] = c; + attr[0] = AT_NORMAL|AT_HILITE; } /* @@ -1094,9 +1126,10 @@ null_line() * {{ This is supposed to be more efficient than forw_line(). }} */ public POSITION -forw_raw_line(curr_pos, linep) +forw_raw_line(curr_pos, linep, line_lenp) POSITION curr_pos; char **linep; + int *line_lenp; { register int n; register int c; @@ -1132,6 +1165,8 @@ forw_raw_line(curr_pos, linep) linebuf[n] = '\0'; if (linep != NULL) *linep = linebuf; + if (line_lenp != NULL) + *line_lenp = n; return (new_pos); } @@ -1140,9 +1175,10 @@ forw_raw_line(curr_pos, linep) * {{ This is supposed to be more efficient than back_line(). }} */ public POSITION -back_raw_line(curr_pos, linep) +back_raw_line(curr_pos, linep, line_lenp) POSITION curr_pos; char **linep; + int *line_lenp; { register int n; register int c; @@ -1203,5 +1239,7 @@ back_raw_line(curr_pos, linep) } if (linep != NULL) *linep = &linebuf[n]; + if (line_lenp != NULL) + *line_lenp = size_linebuf - 1 - n; return (new_pos); } diff --git a/commands/less/less/linenum.c b/external/bsd/less/dist/linenum.c similarity index 90% rename from commands/less/less/linenum.c rename to external/bsd/less/dist/linenum.c index ea0b4acb2..ce0823b67 100644 --- a/commands/less/less/linenum.c +++ b/external/bsd/less/dist/linenum.c @@ -1,7 +1,7 @@ -/* $NetBSD: linenum.c,v 1.8 2006/10/26 01:33:08 mrg Exp $ */ +/* $NetBSD: linenum.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ /* - * Copyright (C) 1984-2004 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -58,12 +58,10 @@ struct linenum_info * when we have a new one to insert and the table is full. */ -#define NPOOL 50 /* Size of line number pool */ +#define NPOOL 200 /* Size of line number pool */ #define LONGTIME (2) /* In seconds */ -public int lnloop = 0; /* Are we in the line num loop? */ - 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 */ @@ -72,6 +70,7 @@ static struct linenum_info *spare; /* We always keep one spare entry */ extern int linenums; extern int sigs; extern int sc_height; +extern int screen_trashed; static void calcgap __P((struct linenum_info *)); static void longloopmessage __P((void)); @@ -220,12 +219,6 @@ add_lnum(linenum, pos) longloopmessage() { ierror("Calculating line numbers", NULL_PARG); - /* - * Set the lnloop flag here, so if the user interrupts while - * we are calculating line numbers, the signal handler will - * turn off line numbers (linenums=0). - */ - lnloop = 1; } static int loopcount; @@ -255,6 +248,22 @@ longish() #endif } +/* + * Turn off line numbers because the user has interrupted + * a lengthy line number calculation. + */ + static void +abort_long() +{ + if (linenums == OPT_ONPLUS) + /* + * We were displaying line numbers, so need to repaint. + */ + screen_trashed = 1; + linenums = 0; + error("Line numbers turned off", NULL_PARG); +} + /* * Find the line number associated with a given position. * Return 0 if we can't figure it out. @@ -320,12 +329,15 @@ find_linenum(pos) /* * Allow a signal to abort this loop. */ - cpos = forw_raw_line(cpos, (char **)NULL); - if (ABORT_SIGS() || cpos == NULL_POSITION) + cpos = forw_raw_line(cpos, (char **)NULL, (int *)NULL); + if (ABORT_SIGS()) { + abort_long(); + return (0); + } + if (cpos == NULL_POSITION) return (0); longish(); } - lnloop = 0; /* * We might as well cache it. */ @@ -349,12 +361,15 @@ find_linenum(pos) /* * Allow a signal to abort this loop. */ - cpos = back_raw_line(cpos, (char **)NULL); - if (ABORT_SIGS() || cpos == NULL_POSITION) + cpos = back_raw_line(cpos, (char **)NULL, (int *)NULL); + if (ABORT_SIGS()) { + abort_long(); + return (0); + } + if (cpos == NULL_POSITION) return (0); longish(); } - lnloop = 0; /* * We might as well cache it. */ @@ -404,8 +419,10 @@ find_pos(linenum) /* * Allow a signal to abort this loop. */ - cpos = forw_raw_line(cpos, (char **)NULL); - if (ABORT_SIGS() || cpos == NULL_POSITION) + cpos = forw_raw_line(cpos, (char **)NULL, (int *)NULL); + if (ABORT_SIGS()) + return (NULL_POSITION); + if (cpos == NULL_POSITION) return (NULL_POSITION); } } else @@ -420,8 +437,10 @@ find_pos(linenum) /* * Allow a signal to abort this loop. */ - cpos = back_raw_line(cpos, (char **)NULL); - if (ABORT_SIGS() || cpos == NULL_POSITION) + cpos = back_raw_line(cpos, (char **)NULL, (int *)NULL); + if (ABORT_SIGS()) + return (NULL_POSITION); + if (cpos == NULL_POSITION) return (NULL_POSITION); } } diff --git a/commands/less/less/lsystem.c b/external/bsd/less/dist/lsystem.c similarity index 96% rename from commands/less/less/lsystem.c rename to external/bsd/less/dist/lsystem.c index a8f9fc86e..de476a348 100644 --- a/commands/less/less/lsystem.c +++ b/external/bsd/less/dist/lsystem.c @@ -1,7 +1,7 @@ -/* $NetBSD: lsystem.c,v 1.8 2006/10/26 01:33:08 mrg Exp $ */ +/* $NetBSD: lsystem.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ /* - * Copyright (C) 1984-2005 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -51,7 +51,7 @@ lsystem(cmd, donemsg) register char *p; #endif IFILE save_ifile; -#if MSDOS_COMPILER +#if MSDOS_COMPILER && MSDOS_COMPILER!=WIN32C char cwd[FILENAME_MAX+1]; #endif @@ -70,6 +70,10 @@ lsystem(cmd, donemsg) } #if MSDOS_COMPILER +#if MSDOS_COMPILER==WIN32C + if (*cmd == '\0') + cmd = getenv("COMSPEC"); +#else /* * Working directory is global on MSDOS. * The child might change the working directory, so we @@ -78,6 +82,7 @@ lsystem(cmd, donemsg) * try to "reedit_ifile" it. */ getcwd(cwd, FILENAME_MAX); +#endif #endif /* @@ -194,7 +199,7 @@ lsystem(cmd, donemsg) init(); screen_trashed = 1; -#if MSDOS_COMPILER +#if MSDOS_COMPILER && MSDOS_COMPILER!=WIN32C /* * Restore the previous directory (possibly * changed by the child program we just ran). diff --git a/commands/less/less/main.c b/external/bsd/less/dist/main.c similarity index 93% rename from commands/less/less/main.c rename to external/bsd/less/dist/main.c index 21158787b..be5b1976d 100644 --- a/commands/less/less/main.c +++ b/external/bsd/less/dist/main.c @@ -1,7 +1,7 @@ -/* $NetBSD: main.c,v 1.14 2008/08/28 07:20:20 mrg Exp $ */ +/* $NetBSD: main.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ /* - * Copyright (C) 1984-2004 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -57,8 +57,11 @@ extern int jump_sline; static char consoleTitle[256]; #endif +extern int less_is_more; extern int missing_cap; extern int know_dumb; +extern int quit_if_one_screen; +extern int pr_type; /* @@ -117,20 +120,27 @@ main(argc, argv) is_tty = isatty(1); get_term(); init_cmds(); - init_prompt(); init_charset(); init_line(); init_cmdhist(); init_option(); + init_search(); - if (more_mode) { - scan_option("-E"); - scan_option("-m"); - scan_option("-G"); - scan_option("-f"); - s = lgetenv("MORE"); - } else - s = lgetenv("LESS"); + /* + * If the name of the executable program is "more", + * act like LESS_IS_MORE is set. + */ + for (s = progname + strlen(progname); s > progname; s--) + { + if (s[-1] == PATHNAME_SEP[0]) + break; + } + if (strcmp(s, "more") == 0) + less_is_more = 1; + + init_prompt(); + + s = lgetenv(less_is_more ? "MORE" : "LESS"); if (s != NULL) scan_option(save(s)); @@ -155,6 +165,9 @@ main(argc, argv) quit(QUIT_OK); } + if (less_is_more && get_quit_at_eof()) + quit_if_one_screen = TRUE; + #if EDITOR editor = lgetenv("VISUAL"); if (editor == NULL || *editor == '\0') @@ -399,7 +412,7 @@ quit(status) */ close(2); #endif -#if WIN32 +#ifdef WIN32 SetConsoleTitle(consoleTitle); #endif close_getchr(); diff --git a/commands/less/less/mark.c b/external/bsd/less/dist/mark.c similarity index 97% rename from commands/less/less/mark.c rename to external/bsd/less/dist/mark.c index 4f84e972e..f0301a2b2 100644 --- a/commands/less/less/mark.c +++ b/external/bsd/less/dist/mark.c @@ -1,7 +1,7 @@ -/* $NetBSD: mark.c,v 1.6 2006/10/26 01:33:08 mrg Exp $ */ +/* $NetBSD: mark.c,v 1.2 2011/07/03 19:51:26 tron Exp $ */ /* - * Copyright (C) 1984-2004 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/external/bsd/less/dist/mkfuncs.awk b/external/bsd/less/dist/mkfuncs.awk new file mode 100644 index 000000000..dea28aceb --- /dev/null +++ b/external/bsd/less/dist/mkfuncs.awk @@ -0,0 +1,9 @@ +BEGIN { FS="("; state = 0 } + +/^ public/ { ftype = $0; state = 1 } + +{ if (state == 1) + state = 2 + else if (state == 2) + { print ftype,$1,"();"; state = 0 } +} diff --git a/external/bsd/less/dist/mkhelp.c b/external/bsd/less/dist/mkhelp.c new file mode 100644 index 000000000..fdb084221 --- /dev/null +++ b/external/bsd/less/dist/mkhelp.c @@ -0,0 +1,71 @@ +/* $NetBSD: mkhelp.c,v 1.2 2011/07/03 19:51:26 tron Exp $ */ + +/* + * Copyright (C) 1984-2011 Mark Nudelman + * + * You may distribute under the terms of either the GNU General Public + * License or the Less License, as specified in the README file. + * + * For more information about less, or for information on how to + * contact the author, see the README file. + */ + + +/* + * Silly little program to generate the help.c source file + * from the less.hlp text file. + * help.c just contains a char array whose contents are + * the contents of less.hlp. + */ + +#include + + int +main(argc, argv) + int argc; + char *argv[]; +{ + int ch; + int prevch; + + printf("/* This file was generated by mkhelp from less.hlp */\n"); + printf("#include \"less.h\"\n"); + printf("constant char helpdata[] = {\n"); + ch = 0; + while (prevch = ch, (ch = getchar()) != EOF) + { + switch (ch) + { + case '\'': + printf("'\\'',"); + break; + case '\\': + printf("'\\\\',"); + break; + case '\b': + printf("'\\b',"); + break; + case '\t': + printf("'\\t',"); + break; + case '\n': + if (prevch != '\r') + printf("'\\n',\n"); + break; + case '\r': + if (prevch != '\n') + printf("'\\n',\n"); + break; + default: + if (ch >= ' ' && ch < 0x7f) + printf("'%c',", ch); + else + printf("0x%02x,", ch); + break; + } + } + /* Add an extra null char to avoid having a trailing comma. */ + printf(" 0 };\n"); + printf("constant int size_helpdata = sizeof(helpdata) - 1;\n"); + return (0); +} diff --git a/external/bsd/less/dist/mkinstalldirs b/external/bsd/less/dist/mkinstalldirs new file mode 100644 index 000000000..91f6d04e1 --- /dev/null +++ b/external/bsd/less/dist/mkinstalldirs @@ -0,0 +1,32 @@ +#!/bin/sh +# mkinstalldirs --- make directory hierarchy +# Author: Noah Friedman +# Created: 1993-05-16 +# Last modified: 1994-03-25 +# Public domain + +errstatus=0 + +for file in ${1+"$@"} ; do + set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` + shift + + pathcomp= + for d in ${1+"$@"} ; do + pathcomp="$pathcomp$d" + case "$pathcomp" in + -* ) pathcomp=./$pathcomp ;; + esac + + if test ! -d "$pathcomp"; then + echo "mkdir $pathcomp" 1>&2 + mkdir "$pathcomp" || errstatus=$? + fi + + pathcomp="$pathcomp/" + done +done + +exit $errstatus + +# mkinstalldirs ends here diff --git a/commands/less/less/optfunc.c b/external/bsd/less/dist/optfunc.c similarity index 78% rename from commands/less/less/optfunc.c rename to external/bsd/less/dist/optfunc.c index 63e3749ed..358c6a36f 100644 --- a/commands/less/less/optfunc.c +++ b/external/bsd/less/dist/optfunc.c @@ -1,5 +1,7 @@ +/* $NetBSD: optfunc.c,v 1.2 2011/07/03 19:51:26 tron Exp $ */ + /* - * Copyright (C) 1984-2005 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -33,19 +35,24 @@ extern int bufspace; extern int pr_type; extern int plusoption; extern int swindow; +extern int sc_width; extern int sc_height; extern int secure; extern int dohelp; extern int any_display; -extern int less_is_more; extern char openquote; extern char closequote; -extern char constant *prproto[]; -extern char constant *eqproto; -extern char constant *hproto; -extern char constant *wproto; +extern char *prproto[]; +extern char *eqproto; +extern char *hproto; +extern char *wproto; extern IFILE curr_ifile; extern char version[]; +extern int jump_sline; +extern int jump_sline_fraction; +extern int shift_count; +extern int shift_count_fraction; +extern int less_is_more; #if LOGFILE extern char *namelogfile; extern int force_logfile; @@ -54,7 +61,6 @@ extern int logfile; #if TAGS public char *tagoption = NULL; extern char *tags; -extern int jump_sline; #endif #if MSDOS_COMPILER extern int nm_fg_color, nm_bg_color; @@ -128,32 +134,133 @@ opt__O(type, s) #endif /* - * Handlers for -l option. + * Handlers for -j option. */ public void -opt_l(type, s) +opt_j(type, s) int type; char *s; { + PARG parg; + char buf[16]; + int len; int err; - int n; - char *t; - + switch (type) { case INIT: - t = s; - n = getnum(&t, "l", &err); - if (err || n <= 0) + case TOGGLE: + if (*s == '.') { - error("Line number is required after -l", NULL_PARG); - return; + s++; + jump_sline_fraction = getfraction(&s, "j", &err); + if (err) + error("Invalid line fraction", NULL_PARG); + else + calc_jump_sline(); + } else + { + int sline = getnum(&s, "j", &err); + if (err) + error("Invalid line number", NULL_PARG); + else + { + jump_sline = sline; + jump_sline_fraction = -1; + } + } + break; + case QUERY: + if (jump_sline_fraction < 0) + { + parg.p_int = jump_sline; + error("Position target at screen line %d", &parg); + } else + { + + sprintf(buf, ".%06d", jump_sline_fraction); + len = strlen(buf); + while (len > 2 && buf[len-1] == '0') + len--; + buf[len] = '\0'; + parg.p_string = buf; + error("Position target at screen position %s", &parg); + } + break; + } +} + + public void +calc_jump_sline() +{ + if (jump_sline_fraction < 0) + return; + jump_sline = sc_height * jump_sline_fraction / NUM_FRAC_DENOM; +} + +/* + * Handlers for -# option. + */ + public void +opt_shift(type, s) + int type; + char *s; +{ + PARG parg; + char buf[16]; + int len; + int err; + + switch (type) + { + case INIT: + case TOGGLE: + if (*s == '.') + { + s++; + shift_count_fraction = getfraction(&s, "#", &err); + if (err) + error("Invalid column fraction", NULL_PARG); + else + calc_shift_count(); + } else + { + int hs = getnum(&s, "#", &err); + if (err) + error("Invalid column number", NULL_PARG); + else + { + shift_count = hs; + shift_count_fraction = -1; + } + } + break; + case QUERY: + if (shift_count_fraction < 0) + { + parg.p_int = shift_count; + error("Horizontal shift %d columns", &parg); + } else + { + + sprintf(buf, ".%06d", shift_count_fraction); + len = strlen(buf); + while (len > 2 && buf[len-1] == '0') + len--; + buf[len] = '\0'; + parg.p_string = buf; + error("Horizontal shift %s of screen width", &parg); } - plusoption = TRUE; - ungetsc(s); break; } } + public void +calc_shift_count() +{ + if (shift_count_fraction < 0) + return; + shift_count = sc_width * shift_count_fraction / NUM_FRAC_DENOM; +} #if USERFILE public void @@ -267,7 +374,7 @@ opt_p(type, s) * In "more" mode, the -p argument is a command, * not a search string, so we don't need a slash. */ - if (!less_is_more); + if (!less_is_more) ungetsc("/"); break; } @@ -281,7 +388,7 @@ opt__P(type, s) int type; register char *s; { - register constant char **proto; + register char **proto; PARG parg; switch (type) @@ -301,7 +408,7 @@ opt__P(type, s) case 'w': proto = &wproto; s++; break; default: proto = &prproto[PR_SHORT]; break; } - free((void *)*proto); + free(*proto); *proto = save(s); break; case QUERY: @@ -376,7 +483,7 @@ opt__V(type, s) any_display = 1; putstr("less "); putstr(version); - putstr("\nCopyright (C) 1984-2005 Mark Nudelman\n\n"); + putstr("\nCopyright (C) 1984-2009 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"); @@ -406,14 +513,14 @@ colordesc(s, fg_color, bg_color) return; } if (*s != '.') - bg = 0; + bg = nm_bg_color; else { s++; bg = getnum(&s, "D", &err); if (err) { - error("Missing fg color in -D", NULL_PARG); + error("Missing bg color in -D", NULL_PARG); return; } } diff --git a/commands/less/less/option.c b/external/bsd/less/dist/option.c similarity index 82% rename from commands/less/less/option.c rename to external/bsd/less/dist/option.c index 8fabb48b6..7e94da9a7 100644 --- a/commands/less/less/option.c +++ b/external/bsd/less/dist/option.c @@ -1,7 +1,7 @@ -/* $NetBSD: option.c,v 1.8 2006/10/26 01:33:08 mrg Exp $ */ +/* $NetBSD: option.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ /* - * Copyright (C) 1984-2004 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -26,14 +26,44 @@ static struct loption *pendopt; public int plusoption = FALSE; +static char *optstring __P((char *, char **, char *, char *)); static int flip_triple __P((int, int)); -static char *propt __P((int)); static void nostring __P((char *)); -static char *optstring __P((char *, char **, char *, char *)); extern int screen_trashed; +extern int less_is_more; +extern int quit_at_eof; extern char *every_first_cmd; +/* + * Return a printable description of an option. + */ + static char * +opt_desc(o) + struct loption *o; +{ + static char buf[OPTNAME_MAX + 10]; + if (o->oletter == OLETTER_NONE) + SNPRINTF1(buf, sizeof(buf), "--%s", o->onames->oname); + else + SNPRINTF2(buf, sizeof(buf), "-%c (--%s)", o->oletter, o->onames->oname); + return (buf); +} + +/* + * Return a string suitable for printing as the "name" of an option. + * For example, if the option letter is 'x', just return "-x". + */ + public char * +propt(c) + int c; +{ + static char buf[8]; + + sprintf(buf, "-%s", prchar(c)); + return (buf); +} + /* * Scan an argument (either from the command line or from the * LESS environment variable) and process it. @@ -70,7 +100,7 @@ scan_option(s) (*pendopt->ofunc)(INIT, s); break; case NUMBER: - printopt = propt(pendopt->oletter); + printopt = opt_desc(pendopt); *(pendopt->ovar) = getnum(&s, printopt, (int*)NULL); break; } @@ -135,6 +165,10 @@ scan_option(s) s--; optc = 'z'; break; + case 'n': + if (less_is_more) + optc = 'z'; + break; } /* @@ -258,12 +292,12 @@ scan_option(s) * OPT_SET set to the inverse of the default value */ public void -toggle_option(c, s, how_toggle) - int c; +toggle_option(o, lower, s, how_toggle) + struct loption *o; + int lower; char *s; int how_toggle; { - register struct loption *o; register int num; int no_prompt; int err; @@ -272,27 +306,22 @@ toggle_option(c, s, how_toggle) no_prompt = (how_toggle & OPT_NO_PROMPT); how_toggle &= ~OPT_NO_PROMPT; - /* - * Look up the option letter in the option table. - */ - o = findopt(c); if (o == NULL) { - parg.p_string = propt(c); - error("There is no %s option", &parg); + error("No such option", NULL_PARG); return; } if (how_toggle == OPT_TOGGLE && (o->otype & NO_TOGGLE)) { - parg.p_string = propt(c); + parg.p_string = opt_desc(o); error("Cannot change the %s option", &parg); return; - } + } if (how_toggle == OPT_NO_TOGGLE && (o->otype & NO_QUERY)) { - parg.p_string = propt(c); + parg.p_string = opt_desc(o); error("Cannot query the %s option", &parg); return; } @@ -352,15 +381,13 @@ toggle_option(c, s, how_toggle) switch (how_toggle) { case OPT_TOGGLE: - *(o->ovar) = flip_triple(*(o->ovar), - ASCII_IS_LOWER(c)); + *(o->ovar) = flip_triple(*(o->ovar), lower); break; case OPT_UNSET: *(o->ovar) = o->odefault; break; case OPT_SET: - *(o->ovar) = flip_triple(o->odefault, - ASCII_IS_LOWER(c)); + *(o->ovar) = flip_triple(o->odefault, lower); break; } break; @@ -464,33 +491,17 @@ flip_triple(val, lc) } /* - * Return a string suitable for printing as the "name" of an option. - * For example, if the option letter is 'x', just return "-x". - */ - static char * -propt(c) - int c; -{ - static char buf[8]; - - sprintf(buf, "-%s", prchar(c)); - return (buf); -} - -/* - * Determine if an option is a single character option (BOOL or TRIPLE), - * or if it a multi-character option (NUMBER). + * Determine if an option takes a parameter. */ public int -single_char_option(c) - int c; +opt_has_param(o) + struct loption *o; { - register struct loption *o; - - o = findopt(c); if (o == NULL) - return (TRUE); - return ((o->otype & (BOOL|TRIPLE|NOVAR|NO_TOGGLE)) != 0); + return (0); + if (o->otype & (BOOL|TRIPLE|NOVAR|NO_TOGGLE)) + return (0); + return (1); } /* @@ -498,14 +509,11 @@ single_char_option(c) * Only string and number valued options have prompts. */ public char * -opt_prompt(c) - int c; +opt_prompt(o) + struct loption *o; { - register struct loption *o; - - o = findopt(c); if (o == NULL || (o->otype & (STRING|NUMBER)) == 0) - return (NULL); + return ("?"); return (o->odesc[0]); } @@ -540,7 +548,7 @@ nostring(printopt) public void nopendopt() { - nostring(propt(pendopt->oletter)); + nostring(opt_desc(pendopt)); } /* @@ -588,6 +596,30 @@ optstring(s, p_str, printopt, validchars) return (p); } +/* + */ + static int +num_error(printopt, errp) + char *printopt; + int *errp; +{ + PARG parg; + + if (errp != NULL) + { + *errp = TRUE; + return (-1); + } + if (printopt != NULL) + { + parg.p_string = printopt; + error("Number is required after %s", &parg); + } + quit(QUIT_ERROR); + /* NOTREACHED */ + return (-1); +} + /* * Translate a string into a number. * Like atoi(), but takes a pointer to a char *, and updates @@ -602,7 +634,6 @@ getnum(sp, printopt, errp) register char *s; register int n; register int neg; - PARG parg; s = skipsp(*sp); neg = FALSE; @@ -612,19 +643,7 @@ getnum(sp, printopt, errp) s++; } if (*s < '0' || *s > '9') - { - if (errp != NULL) - { - *errp = TRUE; - return (-1); - } - if (printopt != NULL) - { - parg.p_string = printopt; - error("Number is required after %s", &parg); - } - quit(QUIT_ERROR); - } + return (num_error(printopt, errp)); n = 0; while (*s >= '0' && *s <= '9') @@ -636,3 +655,53 @@ getnum(sp, printopt, errp) n = -n; return (n); } + +/* + * Translate a string into a fraction, represented by the part of a + * number which would follow a decimal point. + * The value of the fraction is returned as parts per NUM_FRAC_DENOM. + * That is, if "n" is returned, the fraction intended is n/NUM_FRAC_DENOM. + */ + public long +getfraction(sp, printopt, errp) + char **sp; + char *printopt; + int *errp; +{ + register char *s; + long frac = 0; + int fraclen = 0; + + s = skipsp(*sp); + if (*s < '0' || *s > '9') + return (num_error(printopt, errp)); + + for ( ; *s >= '0' && *s <= '9'; s++) + { + frac = (frac * 10) + (*s - '0'); + fraclen++; + } + if (fraclen > NUM_LOG_FRAC_DENOM) + while (fraclen-- > NUM_LOG_FRAC_DENOM) + frac /= 10; + else + while (fraclen++ < NUM_LOG_FRAC_DENOM) + frac *= 10; + *sp = s; + if (errp != NULL) + *errp = FALSE; + return (frac); +} + + +/* + * Get the value of the -e flag. + */ + public int +get_quit_at_eof() +{ + if (!less_is_more) + return quit_at_eof; + /* When less_is_more is set, the -e flag semantics are different. */ + return quit_at_eof ? OPT_ON : OPT_ONPLUS; +} diff --git a/commands/less/less/option.h b/external/bsd/less/dist/option.h similarity index 89% rename from commands/less/less/option.h rename to external/bsd/less/dist/option.h index 49a99b72e..2ce552a34 100644 --- a/commands/less/less/option.h +++ b/external/bsd/less/dist/option.h @@ -1,7 +1,7 @@ -/* $NetBSD: option.h,v 1.7 2006/10/26 01:33:08 mrg Exp $ */ +/* $NetBSD: option.h,v 1.3 2011/07/03 20:14:13 tron Exp $ */ /* - * Copyright (C) 1984-2004 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -29,6 +29,8 @@ #define OTYPE (BOOL|TRIPLE|NUMBER|STRING|NOVAR) +#define OLETTER_NONE '\1' /* Invalid option letter */ + /* * Argument to a handling function tells what type of activity: */ @@ -52,6 +54,8 @@ struct optname struct optname *onext; /* List of synonymous option names */ }; +#define OPTNAME_MAX 32 /* Max length of long option name */ + struct loption { char oletter; /* The controlling letter (a-z) */ diff --git a/commands/less/less/opttbl.c b/external/bsd/less/dist/opttbl.c similarity index 93% rename from commands/less/less/opttbl.c rename to external/bsd/less/dist/opttbl.c index 675d76b16..c3444822c 100644 --- a/commands/less/less/opttbl.c +++ b/external/bsd/less/dist/opttbl.c @@ -1,7 +1,7 @@ -/* $NetBSD: opttbl.c,v 1.12 2006/10/26 01:33:08 mrg Exp $ */ +/* $NetBSD: opttbl.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ /* - * Copyright (C) 1984-2004 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -43,6 +43,8 @@ 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 */ public int jump_sline; /* Screen line of "jump target" */ +public long jump_sline_fraction = -1; +public long shift_count_fraction = -1; public int chopline; /* Truncate displayed lines at screen width */ public int no_init; /* Disable sending ti/te termcap strings */ public int no_keypad; /* Disable sending ks/ke termcap strings */ @@ -52,6 +54,8 @@ 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 */ public int quit_on_intr; /* Quit on interrupt */ +public int follow_mode; /* F cmd Follows file desc or file name? */ +public int oldbot; /* Old bottom of screen behavior {{REMOVE}} */ #if HILITE_SEARCH public int hilite_search; /* Highlight matched search patterns? */ #endif @@ -113,6 +117,8 @@ static struct optname tilde_optname = { "tilde", NULL }; static struct optname query_optname = { "help", NULL }; static struct optname pound_optname = { "shift", NULL }; static struct optname keypad_optname = { "no-keypad", NULL }; +static struct optname oldbot_optname = { "old-bot", NULL }; +static struct optname follow_optname = { "follow-name", NULL }; /* @@ -130,11 +136,11 @@ static struct optname keypad_optname = { "no-keypad", NULL }; static struct loption option[] = { { 'a', &a_optname, - BOOL, OPT_OFF, &how_search, NULL, + TRIPLE, OPT_ONPLUS, &how_search, NULL, { "Search includes displayed screen", "Search skips displayed screen", - NULL + "Search includes all of displayed screen" } }, @@ -158,7 +164,7 @@ static struct loption option[] = 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 painting from top of screen" } }, @@ -239,10 +245,10 @@ static struct loption option[] = } }, { 'j', &j_optname, - NUMBER, 1, &jump_sline, NULL, + STRING, 0, NULL, opt_j, { "Target line: ", - "Position target at screen line %d", + "0123456789.-", NULL } }, @@ -268,10 +274,6 @@ static struct loption option[] = NULL } }, - { 'l', NULL, - STRING|NO_TOGGLE|NO_QUERY, 0, NULL, opt_l, - { NULL, NULL, NULL } - }, { 'L', &L__optname, BOOL, OPT_ON, &use_lessopen, NULL, { @@ -425,14 +427,14 @@ static struct loption option[] = { NULL, NULL, NULL } }, { '#', £_optname, - NUMBER, 0, &shift_count, NULL, + STRING, 0, NULL, opt_shift, { "Horizontal shift: ", - "Horizontal shift %d positions", + "0123456789.", NULL } }, - { '.', &keypad_optname, + { OLETTER_NONE, &keypad_optname, BOOL|NO_TOGGLE, OPT_OFF, &no_keypad, NULL, { "Use keypad mode", @@ -440,6 +442,22 @@ static struct loption option[] = NULL } }, + { OLETTER_NONE, &oldbot_optname, + BOOL, OPT_OFF, &oldbot, NULL, + { + "Use new bottom of screen behavior", + "Use old bottom of screen behavior", + NULL + } + }, + { OLETTER_NONE, &follow_optname, + BOOL, FOLLOW_DESC, &follow_mode, NULL, + { + "F command follows file descriptor", + "F command follows file name", + NULL + } + }, { '\0', NULL, NOVAR, 0, NULL, NULL, { NULL, NULL, NULL } } }; diff --git a/commands/less/less/os.c b/external/bsd/less/dist/os.c similarity index 82% rename from commands/less/less/os.c rename to external/bsd/less/dist/os.c index bb44d793f..59fcc23e0 100644 --- a/commands/less/less/os.c +++ b/external/bsd/less/dist/os.c @@ -1,7 +1,7 @@ -/* $NetBSD: os.c,v 1.9 2006/10/26 01:33:08 mrg Exp $ */ +/* $NetBSD: os.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ /* - * Copyright (C) 1984-2005 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -80,6 +80,7 @@ iread(fd, buf, len) { register int n; +start: #if MSDOS_COMPILER==WIN32C if (ABORT_SIGS()) return (READ_INTR); @@ -162,7 +163,25 @@ iread(fd, buf, len) #endif reading = 0; if (n < 0) + { +#if HAVE_ERRNO + /* + * Certain values of errno indicate we should just retry the read. + */ +#if MUST_DEFINE_ERRNO + extern int errno; +#endif +#ifdef EINTR + if (errno == EINTR) + goto start; +#endif +#ifdef EAGAIN + if (errno == EAGAIN) + goto start; +#endif +#endif return (-1); + } return (n); } @@ -237,6 +256,28 @@ errno_message(filename) return (m); } +/* #define HAVE_FLOAT 0 */ + + static POSITION +muldiv(val, num, den) + POSITION val, num, den; +{ +#if HAVE_FLOAT + double v = (((double) val) * num) / den; + return ((POSITION) (v + 0.5)); +#else + POSITION v = ((POSITION) val) * num; + + if (v / num == val) + /* No overflow */ + return (POSITION) (v / den); + else + /* Above calculation overflows; + * use a method that is less precise but won't overflow. */ + return (POSITION) (val / (den / num)); +#endif +} + /* * Return the ratio of two POSITIONS, as a percentage. * {{ Assumes a POSITION is a long int. }} @@ -245,30 +286,24 @@ errno_message(filename) percentage(num, den) POSITION num, den; { - POSITION num100 = num * 100; - - if (num100 / 100 == num) - return (num100 / den); - else - return (num / (den / 100)); + return (int) muldiv(num, (POSITION) 100, den); } /* * Return the specified percentage of a POSITION. */ public POSITION -percent_pos(pos, percent) +percent_pos(pos, percent, fraction) POSITION pos; int percent; + long fraction; { - POSITION result100; + /* Change percent (parts per 100) to perden (parts per NUM_FRAC_DENOM). */ + POSITION perden = (percent * (NUM_FRAC_DENOM / 100)) + (fraction / 100); - if (percent == 0) + if (perden == 0) return (0); - else if ((result100 = pos * percent) / percent == pos) - return (result100 / 100); - else - return (percent * (pos / 100)); + return (POSITION) muldiv(pos, perden, (POSITION) NUM_FRAC_DENOM); } #if !HAVE_STRCHR diff --git a/commands/less/less/output.c b/external/bsd/less/dist/output.c similarity index 78% rename from commands/less/less/output.c rename to external/bsd/less/dist/output.c index fec2a3b69..27587af65 100644 --- a/commands/less/less/output.c +++ b/external/bsd/less/dist/output.c @@ -1,7 +1,7 @@ -/* $NetBSD: output.c,v 1.10 2008/02/16 07:20:54 matt Exp $ */ +/* $NetBSD: output.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ /* - * Copyright (C) 1984-2005 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -23,6 +23,7 @@ public int errmsgs; /* Count of messages displayed by error() */ public int need_clr; public int final_attr; +public int at_prompt; extern int sigs; extern int sc_width; @@ -30,8 +31,9 @@ extern int so_s_width, so_e_width; extern int screen_trashed; extern int any_display; extern int is_tty; +extern int oldbot; -#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC +#if MSDOS_COMPILER==WIN32C || 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; @@ -102,53 +104,7 @@ flush() n = ob - obuf; if (n == 0) return; -#if MSDOS_COMPILER==WIN32C - if (is_tty && any_display) - { - char *op; - DWORD nwritten = 0; - CONSOLE_SCREEN_BUFFER_INFO scr; - int row; - int col; - int olen; - extern HANDLE con_out; - - olen = ob - obuf; - /* - * There is a bug in Win32 WriteConsole() if we're - * writing in the last cell with a different color. - * To avoid color problems in the bottom line, - * we scroll the screen manually, before writing. - */ - GetConsoleScreenBufferInfo(con_out, &scr); - col = scr.dwCursorPosition.X; - row = scr.dwCursorPosition.Y; - for (op = obuf; op < obuf + olen; op++) - { - if (*op == '\n') - { - col = 0; - row++; - } else if (*op == '\r') - { - col = 0; - } else - { - col++; - if (col >= sc_width) - { - col = 0; - row++; - } - } - } - if (row > scr.srWindow.Bottom) - win32_scroll_up(row - scr.srWindow.Bottom); - WriteConsole(con_out, obuf, olen, &nwritten, NULL); - ob = obuf; - return; - } -#else + #if MSDOS_COMPILER==MSOFTC if (is_tty && any_display) { @@ -158,12 +114,12 @@ flush() return; } #else -#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC +#if MSDOS_COMPILER==WIN32C || MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC if (is_tty && any_display) { *ob = '\0'; if (ctldisp != OPT_ONPLUS) - cputs(obuf); + WIN32textout(obuf, ob - obuf); else { /* @@ -173,64 +129,70 @@ flush() * 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. - */ + unsigned char fg, bg; + static unsigned char at; +#if MSDOS_COMPILER==WIN32C + /* Screen colors used by 3x and 4x SGR commands. */ + static unsigned char screen_color[] = { + 0, /* BLACK */ + FOREGROUND_RED, + FOREGROUND_GREEN, + FOREGROUND_RED|FOREGROUND_GREEN, + FOREGROUND_BLUE, + FOREGROUND_BLUE|FOREGROUND_RED, + FOREGROUND_BLUE|FOREGROUND_GREEN, + FOREGROUND_BLUE|FOREGROUND_GREEN|FOREGROUND_RED + }; +#else static enum COLORS screen_color[] = { BLACK, RED, GREEN, BROWN, BLUE, MAGENTA, CYAN, LIGHTGRAY }; +#endif - /* 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_next = memchr(p_next, ESC, ob - p_next)) != 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 (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; + /* + * If some chars seen since + * the last escape sequence, + * write them out to the screen. + */ + WIN32textout(anchor, p-anchor); anchor = p; } - p += 2; + p += 2; /* Skip the "ESC-[" */ + if (is_ansi_end(*p)) + { + /* + * Handle null escape sequence + * "ESC[m", which restores + * the normal color. + */ + p++; + anchor = p_next = p; + WIN32setcolors(nm_fg_color, nm_bg_color); + continue; + } p_next = p; + + /* + * Select foreground/background colors + * based on the escape sequence. + */ + fg = nm_fg_color; + bg = nm_bg_color; while (!is_ansi_end(*p)) { char *q; long code = strtol(p, &q, 10); - if (!*q) + if (*q == '\0') { /* * Incomplete sequence. @@ -238,15 +200,15 @@ flush() * in the buffer. */ int slop = q - anchor; + /* {{ strcpy args overlap! }} */ strcpy(obuf, anchor); ob = &obuf[slop]; return; } - if (q == p - || code > 49 || code < 0 - || (!is_ansi_end(*q) - && *q != ';')) + if (q == p || + code > 49 || code < 0 || + (!is_ansi_end(*q) && *q != ';')) { p_next = q; break; @@ -256,27 +218,38 @@ flush() switch (code) { + default: + /* case 0: all attrs off */ + fg = nm_fg_color; + bg = nm_bg_color; + at = 0; + break; case 1: /* bold on */ - fg = bo_fg_color; - bg = bo_bg_color; + at |= 1; break; case 3: /* italic on */ - fg = so_fg_color; - bg = so_bg_color; + case 7: /* inverse on */ + at |= 2; break; case 4: /* underline on */ - fg = ul_fg_color; - bg = ul_bg_color; + at |= 4; + break; + case 5: /* slow blink on */ + case 6: /* fast blink on */ + at |= 8; 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; + case 22: /* bold off */ + at &= ~1; + break; + case 23: /* italic off */ + case 27: /* inverse off */ + at &= ~2; + break; + case 24: /* underline off */ + at &= ~4; break; case 30: case 31: case 32: case 33: case 34: case 35: @@ -297,26 +270,40 @@ flush() } p = q; } - if (is_ansi_end(*p) && p > p_next) - { - bg &= 15; - fg &= 15; - textattr ((bg << 4)| fg); - p_next = anchor = p + 1; - } else + if (!is_ansi_end(*p) || p == p_next) break; + if (at & 1) + { + fg = bo_fg_color; + bg = bo_bg_color; + } else if (at & 2) + { + fg = so_fg_color; + bg = so_bg_color; + } else if (at & 4) + { + fg = ul_fg_color; + bg = ul_bg_color; + } else if (at & 8) + { + fg = bl_fg_color; + bg = bl_bg_color; + } + fg &= 0xf; + bg &= 0xf; + WIN32setcolors(fg, bg); + p_next = anchor = p + 1; } else p_next++; } /* Output what's left in the buffer. */ - cputs (anchor); + WIN32textout(anchor, ob - anchor); } ob = obuf; return; } #endif -#endif #endif fd = (any_display) ? 1 : 2; if (write(fd, obuf, n) != n) @@ -374,6 +361,7 @@ putchr(c) if (ob >= &obuf[sizeof(obuf)-1]) flush(); *ob++ = c; + at_prompt = 0; return (c); } @@ -524,6 +512,8 @@ error(fmt, parg) if (any_display && is_tty) { + if (!oldbot) + squish_check(); at_exit(); clear_bot(); at_enter(AT_STANDOUT); @@ -544,6 +534,7 @@ error(fmt, parg) get_return(); lower_left(); + clear_eol(); if (col >= sc_width) /* diff --git a/external/bsd/less/dist/pattern.c b/external/bsd/less/dist/pattern.c new file mode 100644 index 000000000..dae0d8e98 --- /dev/null +++ b/external/bsd/less/dist/pattern.c @@ -0,0 +1,324 @@ +/* $NetBSD: pattern.c,v 1.2 2011/07/03 19:51:26 tron Exp $ */ + +/* + * Copyright (C) 1984-2011 Mark Nudelman + * + * You may distribute under the terms of either the GNU General Public + * License or the Less License, as specified in the README file. + * + * For more information about less, or for information on how to + * contact the author, see the README file. + */ + +/* + * Routines to do pattern matching. + */ + +#include "less.h" +#include "pattern.h" + +extern int caseless; + +/* + * Compile a search pattern, for future use by match_pattern. + */ + static int +compile_pattern2(pattern, search_type, comp_pattern) + char *pattern; + int search_type; + void **comp_pattern; +{ + if ((search_type & SRCH_NO_REGEX) == 0) + { +#if HAVE_POSIX_REGCOMP + regex_t *comp = (regex_t *) ecalloc(1, sizeof(regex_t)); + regex_t **pcomp = (regex_t **) comp_pattern; + if (regcomp(comp, pattern, REGCOMP_FLAG)) + { + free(comp); + error("Invalid pattern", NULL_PARG); + return (-1); + } + if (*pcomp != NULL) + regfree(*pcomp); + *pcomp = comp; +#endif +#if HAVE_PCRE + pcre *comp; + pcre **pcomp = (pcre **) comp_pattern; + const char *errstring; + int erroffset; + PARG parg; + comp = pcre_compile(pattern, 0, + &errstring, &erroffset, NULL); + if (comp == NULL) + { + parg.p_string = (char *) errstring; + error("%s", &parg); + return (-1); + } + *pcomp = comp; +#endif +#if HAVE_RE_COMP + PARG parg; + int *pcomp = (int *) comp_pattern; + if ((parg.p_string = re_comp(pattern)) != NULL) + { + error("%s", &parg); + return (-1); + } + *pcomp = 1; +#endif +#if HAVE_REGCMP + char *comp; + char **pcomp = (char **) comp_pattern; + if ((comp = regcmp(pattern, 0)) == NULL) + { + error("Invalid pattern", NULL_PARG); + return (-1); + } + if (pcomp != NULL) + free(*pcomp); + *pcomp = comp; +#endif +#if HAVE_V8_REGCOMP + struct regexp *comp; + struct regexp **pcomp = (struct regexp **) comp_pattern; + if ((comp = regcomp(pattern)) == NULL) + { + /* + * regcomp has already printed an error message + * via regerror(). + */ + return (-1); + } + if (*pcomp != NULL) + free(*pcomp); + *pcomp = comp; +#endif + } + return (0); +} + +/* + * Like compile_pattern2, but convert the pattern to lowercase if necessary. + */ + public int +compile_pattern(pattern, search_type, comp_pattern) + char *pattern; + int search_type; + void **comp_pattern; +{ + char *cvt_pattern; + int result; + + if (caseless != OPT_ONPLUS) + cvt_pattern = pattern; + else + { + cvt_pattern = (char*) ecalloc(1, cvt_length(strlen(pattern), CVT_TO_LC)); + cvt_text(cvt_pattern, pattern, (int *)NULL, (int *)NULL, CVT_TO_LC); + } + result = compile_pattern2(cvt_pattern, search_type, comp_pattern); + if (cvt_pattern != pattern) + free(cvt_pattern); + return (result); +} + +/* + * Forget that we have a compiled pattern. + */ + public void +uncompile_pattern(pattern) + void **pattern; +{ +#if HAVE_POSIX_REGCOMP + regex_t **pcomp = (regex_t **) pattern; + if (*pcomp != NULL) + regfree(*pcomp); + *pcomp = NULL; +#endif +#if HAVE_PCRE + pcre **pcomp = (pcre **) pattern; + if (*pcomp != NULL) + pcre_free(*pcomp); + *pcomp = NULL; +#endif +#if HAVE_RE_COMP + int *pcomp = (int *) pattern; + *pcomp = 0; +#endif +#if HAVE_REGCMP + char **pcomp = (char **) pattern; + if (*pcomp != NULL) + free(*pcomp); + *pcomp = NULL; +#endif +#if HAVE_V8_REGCOMP + struct regexp **pcomp = (struct regexp **) pattern; + if (*pcomp != NULL) + free(*pcomp); + *pcomp = NULL; +#endif +} + +/* + * Is a compiled pattern null? + */ + public int +is_null_pattern(pattern) + void *pattern; +{ +#if HAVE_POSIX_REGCOMP + return (pattern == NULL); +#endif +#if HAVE_PCRE + return (pattern == NULL); +#endif +#if HAVE_RE_COMP + return (pattern == 0); +#endif +#if HAVE_REGCMP + return (pattern == NULL); +#endif +#if HAVE_V8_REGCOMP + return (pattern == NULL); +#endif +#if NO_REGEX + return (search_pattern != NULL); +#endif +} + +/* + * Simple pattern matching function. + * It supports no metacharacters like *, etc. + */ + static int +match(pattern, pattern_len, buf, buf_len, pfound, pend) + char *pattern; + int pattern_len; + char *buf; + int buf_len; + char **pfound, **pend; +{ + register char *pp, *lp; + register char *pattern_end = pattern + pattern_len; + register char *buf_end = buf + buf_len; + + for ( ; buf < buf_end; buf++) + { + for (pp = pattern, lp = buf; *pp == *lp; pp++, lp++) + if (pp == pattern_end || lp == buf_end) + break; + if (pp == pattern_end) + { + if (pfound != NULL) + *pfound = buf; + if (pend != NULL) + *pend = lp; + return (1); + } + } + return (0); +} + +/* + * Perform a pattern match with the previously compiled pattern. + * Set sp and ep to the start and end of the matched string. + */ + public int +match_pattern(pattern, tpattern, line, line_len, sp, ep, notbol, search_type) + void *pattern; + char *tpattern; + char *line; + int line_len; + char **sp; + char **ep; + int notbol; + int search_type; +{ + int matched; +#if HAVE_POSIX_REGCOMP + regex_t *spattern = (regex_t *) pattern; +#endif +#if HAVE_PCRE + pcre *spattern = (pcre *) pattern; +#endif +#if HAVE_RE_COMP + int spattern = (int) pattern; +#endif +#if HAVE_REGCMP + char *spattern = (char *) pattern; +#endif +#if HAVE_V8_REGCOMP + struct regexp *spattern = (struct regexp *) pattern; +#endif + + if (search_type & SRCH_NO_REGEX) + matched = match(tpattern, strlen(tpattern), line, line_len, sp, ep); + else + { +#if HAVE_POSIX_REGCOMP + { + regmatch_t rm; + int flags = (notbol) ? REG_NOTBOL : 0; + matched = !regexec(spattern, line, 1, &rm, flags); + if (matched) + { +#ifndef __WATCOMC__ + *sp = line + rm.rm_so; + *ep = line + rm.rm_eo; +#else + *sp = rm.rm_sp; + *ep = rm.rm_ep; +#endif + } + } +#endif +#if HAVE_PCRE + { + int flags = (notbol) ? PCRE_NOTBOL : 0; + int ovector[3]; + matched = pcre_exec(spattern, NULL, line, line_len, + 0, flags, ovector, 3) >= 0; + if (matched) + { + *sp = line + ovector[0]; + *ep = line + ovector[1]; + } + } +#endif +#if HAVE_RE_COMP + matched = (re_exec(line) == 1); + /* + * re_exec doesn't seem to provide a way to get the matched string. + */ + *sp = *ep = NULL; +#endif +#if HAVE_REGCMP + *ep = regex(spattern, line); + matched = (*ep != NULL); + if (matched) + *sp = __loc1; +#endif +#if HAVE_V8_REGCOMP +#if HAVE_REGEXEC2 + matched = regexec2(spattern, line, notbol); +#else + matched = regexec(spattern, line); +#endif + if (matched) + { + *sp = spattern->startp[0]; + *ep = spattern->endp[0]; + } +#endif +#if NO_REGEX + matched = match(tpattern, strlen(tpattern), line, line_len, sp, ep); +#endif + } + matched = (!(search_type & SRCH_NO_MATCH) && matched) || + ((search_type & SRCH_NO_MATCH) && !matched); + return (matched); +} + diff --git a/external/bsd/less/dist/pattern.h b/external/bsd/less/dist/pattern.h new file mode 100644 index 000000000..4930e641e --- /dev/null +++ b/external/bsd/less/dist/pattern.h @@ -0,0 +1,51 @@ +/* $NetBSD: pattern.h,v 1.3 2011/07/03 20:14:13 tron Exp $ */ + +/* + * Copyright (C) 1984-2011 Mark Nudelman + * + * You may distribute under the terms of either the GNU General Public + * License or the Less License, as specified in the README file. + * + * For more information about less, or for information on how to + * contact the author, see the README file. + */ + +#if HAVE_POSIX_REGCOMP +#include +#ifdef REG_EXTENDED +extern int more_mode; +#define REGCOMP_FLAG (more_mode ? 0 : REG_EXTENDED) +#else +#define REGCOMP_FLAG 0 +#endif +#define DEFINE_PATTERN(name) regex_t *name +#define CLEAR_PATTERN(name) name = NULL +#endif + +#if HAVE_PCRE +#include +#define DEFINE_PATTERN(name) pcre *name +#define CLEAR_PATTERN(name) name = NULL +#endif + +#if HAVE_RE_COMP +char *re_comp(); +int re_exec(); +#define DEFINE_PATTERN(name) int name +#define CLEAR_PATTERN(name) name = 0 +#endif + +#if HAVE_REGCMP +char *regcmp(); +char *regex(); +extern char *__loc1; +#define DEFINE_PATTERN(name) char *name +#define CLEAR_PATTERN(name) name = NULL +#endif + +#if HAVE_V8_REGCOMP +#include "regexp.h" +#define DEFINE_PATTERN(name) struct regexp *name +#define CLEAR_PATTERN(name) name = NULL +#endif + diff --git a/commands/less/less/pckeys.h b/external/bsd/less/dist/pckeys.h similarity index 89% rename from commands/less/less/pckeys.h rename to external/bsd/less/dist/pckeys.h index 2425226e3..acbed0c56 100644 --- a/commands/less/less/pckeys.h +++ b/external/bsd/less/dist/pckeys.h @@ -1,5 +1,7 @@ +/* $NetBSD: pckeys.h,v 1.2 2011/07/03 19:51:26 tron Exp $ */ + /* - * Copyright (C) 1984-2004 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/commands/less/less/position.c b/external/bsd/less/dist/position.c similarity index 97% rename from commands/less/less/position.c rename to external/bsd/less/dist/position.c index 319f9d895..94a554523 100644 --- a/commands/less/less/position.c +++ b/external/bsd/less/dist/position.c @@ -1,5 +1,7 @@ +/* $NetBSD: position.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ + /* - * Copyright (C) 1984-2004 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/commands/less/less/position.h b/external/bsd/less/dist/position.h similarity index 80% rename from commands/less/less/position.h rename to external/bsd/less/dist/position.h index 125dae536..20d19b3c0 100644 --- a/commands/less/less/position.h +++ b/external/bsd/less/dist/position.h @@ -1,5 +1,7 @@ +/* $NetBSD: position.h,v 1.2 2011/07/03 19:51:26 tron Exp $ */ + /* - * Copyright (C) 1984-2004 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. diff --git a/commands/less/less/prompt.c b/external/bsd/less/dist/prompt.c similarity index 93% rename from commands/less/less/prompt.c rename to external/bsd/less/dist/prompt.c index 9c59e332b..de265a17e 100644 --- a/commands/less/less/prompt.c +++ b/external/bsd/less/dist/prompt.c @@ -1,7 +1,7 @@ -/* $NetBSD: prompt.c,v 1.13 2008/02/16 07:20:54 matt Exp $ */ +/* $NetBSD: prompt.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ /* - * Copyright (C) 1984-2004 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -24,7 +24,6 @@ #include "position.h" extern int pr_type; -extern int hit_eof; extern int new_file; extern int sc_width; extern int so_s_width, so_e_width; @@ -32,6 +31,7 @@ extern int linenums; extern int hshift; extern int sc_height; extern int jump_sline; +extern int less_is_more; extern IFILE curr_ifile; #if EDITOR extern char *editor; @@ -54,6 +54,8 @@ static constant char h_proto[] = "HELP -- ?eEND -- Press g to see it again:Press RETURN for more., or q when done"; static constant char w_proto[] = "Waiting for data"; +static constant char more_proto[] = + "--More--(?eEND ?x- Next\\: %x.:?pB%pB\\%:byte %bB?s/%s...%t)"; public char constant *prproto[3]; public char constant *eqproto = e_proto; @@ -71,8 +73,8 @@ static void ap_quest __P((void)); static POSITION curr_byte __P((int)); static int cond __P((int, int)); static void protochar __P((int, int, int)); -static char *skipcond __P((char *)); -static char *wherechar __P((char *, int *)); +static const char *skipcond __P((const char *)); +static const char *wherechar __P((const char *, int *)); /* * Initialize the prompt prototype strings. @@ -81,7 +83,7 @@ static char *wherechar __P((char *, int *)); init_prompt() { prproto[0] = save(s_proto); - prproto[1] = save(m_proto); + prproto[1] = save(less_is_more ? more_proto : m_proto); prproto[2] = save(M_proto); eqproto = save(e_proto); hproto = save(h_proto); @@ -207,7 +209,7 @@ cond(c, where) case 'c': return (hshift != 0); case 'e': /* At end of file? */ - return (hit_eof); + return (eof_displayed()); case 'f': /* Filename known? */ return (strcmp(get_filename(curr_ifile), "-") != 0); case 'l': /* Line number known? */ @@ -315,6 +317,9 @@ protochar(c, where, iseditproto) case 'f': /* File name */ ap_str(get_filename(curr_ifile)); break; + case 'F': /* Last component of file name */ + ap_str(last_component(get_filename(curr_ifile))); + break; case 'i': /* Index into list of files */ #if TAGS if (ntags()) @@ -375,6 +380,7 @@ protochar(c, where, iseditproto) case 't': /* Truncate trailing spaces in the message */ while (mp > message && mp[-1] == ' ') mp--; + *mp = '\0'; break; case 'T': /* Type of list */ #if TAGS @@ -401,9 +407,9 @@ protochar(c, where, iseditproto) * where to resume parsing the string. * We must keep track of nested IFs and skip them properly. */ - static char * + static const char * skipcond(p) - register char *p; + register const char *p; { register int iflevel; @@ -459,9 +465,9 @@ skipcond(p) /* * Decode a char that represents a position on the screen. */ - static char * + static const char * wherechar(p, wp) - char *p; + const char *p; int *wp; { switch (*p) @@ -485,10 +491,10 @@ wherechar(p, wp) */ public char * pr_expand(proto, maxwidth) - char *proto; + const char *proto; int maxwidth; { - register char *p; + register const char *p; register int c; int where; @@ -575,9 +581,11 @@ eq_message() pr_string() { char *prompt; + int type; + type = (!less_is_more) ? pr_type : pr_type ? 0 : 1; prompt = pr_expand((ch_getflags() & CH_HELPFILE) ? - hproto : prproto[pr_type], + hproto : prproto[type], sc_width-so_s_width-so_e_width-2); new_file = 0; return (prompt); diff --git a/external/bsd/less/dist/regexp.c b/external/bsd/less/dist/regexp.c new file mode 100644 index 000000000..927910051 --- /dev/null +++ b/external/bsd/less/dist/regexp.c @@ -0,0 +1,1252 @@ +/* $NetBSD: regexp.c,v 1.2 2011/07/03 19:51:26 tron Exp $ */ + +/* + * regcomp and regexec -- regsub and regerror are elsewhere + * + * Copyright (c) 1986 by University of Toronto. + * Written by Henry Spencer. Not derived from licensed software. + * + * Permission is granted to anyone to use this software for any + * purpose on any computer system, and to redistribute it freely, + * subject to the following restrictions: + * + * 1. The author is not responsible for the consequences of use of + * this software, no matter how awful, even if they arise + * from defects in it. + * + * 2. The origin of this software must not be misrepresented, either + * by explicit claim or by omission. + * + * 3. Altered versions must be plainly marked as such, and must not + * be misrepresented as being the original software. + * + * Beware that some of this code is subtly aware of the way operator + * precedence is structured in regular expressions. Serious changes in + * regular-expression syntax might require a total rethink. + * + * *** NOTE: this code has been altered slightly for use in Tcl. *** + * Slightly modified by David MacKenzie to undo most of the changes for TCL. + * Added regexec2 with notbol parameter. -- 4/19/99 Mark Nudelman + */ + +#include "less.h" +#if HAVE_STDIO_H +#include +#endif +#if HAVE_STDLIB_H +#include +#endif +#if HAVE_STRING_H +#include +#endif +#include "regexp.h" + +/* + * The "internal use only" fields in regexp.h are present to pass info from + * compile to execute that permits the execute phase to run lots faster on + * simple cases. They are: + * + * regstart char that must begin a match; '\0' if none obvious + * reganch is the match anchored (at beginning-of-line only)? + * regmust string (pointer into program) that match must include, or NULL + * regmlen length of regmust string + * + * Regstart and reganch permit very fast decisions on suitable starting points + * for a match, cutting down the work a lot. Regmust permits fast rejection + * of lines that cannot possibly match. The regmust tests are costly enough + * that regcomp() supplies a regmust only if the r.e. contains something + * potentially expensive (at present, the only such thing detected is * or + + * at the start of the r.e., which can involve a lot of backup). Regmlen is + * supplied because the test in regexec() needs it and regcomp() is + * computing it anyway. + */ + +/* + * Structure for regexp "program". This is essentially a linear encoding + * of a nondeterministic finite-state machine (aka syntax charts or + * "railroad normal form" in parsing technology). Each node is an opcode + * plus a "next" pointer, possibly plus an operand. "Next" pointers of + * all nodes except BRANCH implement concatenation; a "next" pointer with + * a BRANCH on both ends of it is connecting two alternatives. (Here we + * have one of the subtle syntax dependencies: an individual BRANCH (as + * opposed to a collection of them) is never concatenated with anything + * because of operator precedence.) The operand of some types of node is + * a literal string; for others, it is a node leading into a sub-FSM. In + * particular, the operand of a BRANCH node is the first node of the branch. + * (NB this is *not* a tree structure: the tail of the branch connects + * to the thing following the set of BRANCHes.) The opcodes are: + */ + +/* definition number opnd? meaning */ +#undef EOL +#define END 0 /* no End of program. */ +#define BOL 1 /* no Match "" at beginning of line. */ +#define EOL 2 /* no Match "" at end of line. */ +#define ANY 3 /* no Match any one character. */ +#define ANYOF 4 /* str Match any character in this string. */ +#define ANYBUT 5 /* str Match any character not in this string. */ +#define BRANCH 6 /* node Match this alternative, or the next... */ +#define BACK 7 /* no Match "", "next" ptr points backward. */ +#define EXACTLY 8 /* str Match this string. */ +#define NOTHING 9 /* no Match empty string. */ +#define STAR 10 /* node Match this (simple) thing 0 or more times. */ +#define PLUS 11 /* node Match this (simple) thing 1 or more times. */ +#define OPEN 20 /* no Mark this point in input as start of #n. */ + /* OPEN+1 is number 1, etc. */ +#define CLOSE 30 /* no Analogous to OPEN. */ + +/* + * Opcode notes: + * + * BRANCH The set of branches constituting a single choice are hooked + * together with their "next" pointers, since precedence prevents + * anything being concatenated to any individual branch. The + * "next" pointer of the last BRANCH in a choice points to the + * thing following the whole choice. This is also where the + * final "next" pointer of each individual branch points; each + * branch starts with the operand node of a BRANCH node. + * + * BACK Normal "next" pointers all implicitly point forward; BACK + * exists to make loop structures possible. + * + * STAR,PLUS '?', and complex '*' and '+', are implemented as circular + * BRANCH structures using BACK. Simple cases (one character + * per match) are implemented with STAR and PLUS for speed + * and to minimize recursive plunges. + * + * OPEN,CLOSE ...are numbered at compile time. + */ + +/* + * A node is one char of opcode followed by two chars of "next" pointer. + * "Next" pointers are stored as two 8-bit pieces, high order first. The + * value is a positive offset from the opcode of the node containing it. + * An operand, if any, simply follows the node. (Note that much of the + * code generation knows about this implicit relationship.) + * + * Using two bytes for the "next" pointer is vast overkill for most things, + * but allows patterns to get big without disasters. + */ +#define OP(p) (*(p)) +#define NEXT(p) (((*((p)+1)&0377)<<8) + (*((p)+2)&0377)) +#define OPERAND(p) ((p) + 3) + +/* + * See regmagic.h for one further detail of program structure. + */ + + +/* + * Utility definitions. + */ +#ifndef CHARBITS +#define UCHARAT(p) ((int)*(unsigned char *)(p)) +#else +#define UCHARAT(p) ((int)*(p)&CHARBITS) +#endif + +#define FAIL(m) { regerror(m); return(NULL); } +#define ISMULT(c) ((c) == '*' || (c) == '+' || (c) == '?') +#define META "^$.[()|?+*\\" + +/* + * Flags to be passed up and down. + */ +#define HASWIDTH 01 /* Known never to match null string. */ +#define SIMPLE 02 /* Simple enough to be STAR/PLUS operand. */ +#define SPSTART 04 /* Starts with * or +. */ +#define WORST 0 /* Worst case. */ + +/* + * Global work variables for regcomp(). + */ +static char *regparse; /* Input-scan pointer. */ +static int regnpar; /* () count. */ +static char regdummy; +static char *regcode; /* Code-emit pointer; ®dummy = don't. */ +static long regsize; /* Code size. */ + +/* + * The first byte of the regexp internal "program" is actually this magic + * number; the start node begins in the second byte. + */ +#define MAGIC 0234 + + +/* + * Forward declarations for regcomp()'s friends. + */ +#ifndef STATIC +#define STATIC static +#endif +STATIC char *reg(); +STATIC char *regbranch(); +STATIC char *regpiece(); +STATIC char *regatom(); +STATIC char *regnode(); +STATIC char *regnext(); +STATIC void regc(); +STATIC void reginsert(); +STATIC void regtail(); +STATIC void regoptail(); +#ifdef STRCSPN +STATIC int strcspn(); +#endif + +/* + - regcomp - compile a regular expression into internal code + * + * We can't allocate space until we know how big the compiled form will be, + * but we can't compile it (and thus know how big it is) until we've got a + * place to put the code. So we cheat: we compile it twice, once with code + * generation turned off and size counting turned on, and once "for real". + * This also means that we don't allocate space until we are sure that the + * thing really will compile successfully, and we never have to move the + * code and thus invalidate pointers into it. (Note that it has to be in + * one piece because free() must be able to free it all.) + * + * Beware that the optimization-preparation code in here knows about some + * of the structure of the compiled regexp. + */ +regexp * +regcomp(exp) +char *exp; +{ + register regexp *r; + register char *scan; + register char *longest; + register int len; + int flags; + + if (exp == NULL) + FAIL("NULL argument"); + + /* First pass: determine size, legality. */ + regparse = exp; + regnpar = 1; + regsize = 0L; + regcode = ®dummy; + regc(MAGIC); + if (reg(0, &flags) == NULL) + return(NULL); + + /* Small enough for pointer-storage convention? */ + if (regsize >= 32767L) /* Probably could be 65535L. */ + FAIL("regexp too big"); + + /* Allocate space. */ + r = (regexp *)malloc(sizeof(regexp) + (unsigned)regsize); + if (r == NULL) + FAIL("out of space"); + + /* Second pass: emit code. */ + regparse = exp; + regnpar = 1; + regcode = r->program; + regc(MAGIC); + if (reg(0, &flags) == NULL) + return(NULL); + + /* Dig out information for optimizations. */ + r->regstart = '\0'; /* Worst-case defaults. */ + r->reganch = 0; + r->regmust = NULL; + r->regmlen = 0; + scan = r->program+1; /* First BRANCH. */ + if (OP(regnext(scan)) == END) { /* Only one top-level choice. */ + scan = OPERAND(scan); + + /* Starting-point info. */ + if (OP(scan) == EXACTLY) + r->regstart = *OPERAND(scan); + else if (OP(scan) == BOL) + r->reganch++; + + /* + * If there's something expensive in the r.e., find the + * longest literal string that must appear and make it the + * regmust. Resolve ties in favor of later strings, since + * the regstart check works with the beginning of the r.e. + * and avoiding duplication strengthens checking. Not a + * strong reason, but sufficient in the absence of others. + */ + if (flags&SPSTART) { + longest = NULL; + len = 0; + for (; scan != NULL; scan = regnext(scan)) + if (OP(scan) == EXACTLY && ((int) strlen(OPERAND(scan))) >= len) { + longest = OPERAND(scan); + len = strlen(OPERAND(scan)); + } + r->regmust = longest; + r->regmlen = len; + } + } + + return(r); +} + +/* + - reg - regular expression, i.e. main body or parenthesized thing + * + * Caller must absorb opening parenthesis. + * + * Combining parenthesis handling with the base level of regular expression + * is a trifle forced, but the need to tie the tails of the branches to what + * follows makes it hard to avoid. + */ +static char * +reg(paren, flagp) +int paren; /* Parenthesized? */ +int *flagp; +{ + register char *ret; + register char *br; + register char *ender; + register int parno = 0; + int flags; + + *flagp = HASWIDTH; /* Tentatively. */ + + /* Make an OPEN node, if parenthesized. */ + if (paren) { + if (regnpar >= NSUBEXP) + FAIL("too many ()"); + parno = regnpar; + regnpar++; + ret = regnode(OPEN+parno); + } else + ret = NULL; + + /* Pick up the branches, linking them together. */ + br = regbranch(&flags); + if (br == NULL) + return(NULL); + if (ret != NULL) + regtail(ret, br); /* OPEN -> first. */ + else + ret = br; + if (!(flags&HASWIDTH)) + *flagp &= ~HASWIDTH; + *flagp |= flags&SPSTART; + while (*regparse == '|') { + regparse++; + br = regbranch(&flags); + if (br == NULL) + return(NULL); + regtail(ret, br); /* BRANCH -> BRANCH. */ + if (!(flags&HASWIDTH)) + *flagp &= ~HASWIDTH; + *flagp |= flags&SPSTART; + } + + /* Make a closing node, and hook it on the end. */ + ender = regnode((paren) ? CLOSE+parno : END); + regtail(ret, ender); + + /* Hook the tails of the branches to the closing node. */ + for (br = ret; br != NULL; br = regnext(br)) + regoptail(br, ender); + + /* Check for proper termination. */ + if (paren && *regparse++ != ')') { + FAIL("unmatched ()"); + } else if (!paren && *regparse != '\0') { + if (*regparse == ')') { + FAIL("unmatched ()"); + } else + FAIL("junk on end"); /* "Can't happen". */ + /* NOTREACHED */ + } + + return(ret); +} + +/* + - regbranch - one alternative of an | operator + * + * Implements the concatenation operator. + */ +static char * +regbranch(flagp) +int *flagp; +{ + register char *ret; + register char *chain; + register char *latest; + int flags; + + *flagp = WORST; /* Tentatively. */ + + ret = regnode(BRANCH); + chain = NULL; + while (*regparse != '\0' && *regparse != '|' && *regparse != ')') { + latest = regpiece(&flags); + if (latest == NULL) + return(NULL); + *flagp |= flags&HASWIDTH; + if (chain == NULL) /* First piece. */ + *flagp |= flags&SPSTART; + else + regtail(chain, latest); + chain = latest; + } + if (chain == NULL) /* Loop ran zero times. */ + (void) regnode(NOTHING); + + return(ret); +} + +/* + - regpiece - something followed by possible [*+?] + * + * Note that the branching code sequences used for ? and the general cases + * of * and + are somewhat optimized: they use the same NOTHING node as + * both the endmarker for their branch list and the body of the last branch. + * It might seem that this node could be dispensed with entirely, but the + * endmarker role is not redundant. + */ +static char * +regpiece(flagp) +int *flagp; +{ + register char *ret; + register char op; + register char *next; + int flags; + + ret = regatom(&flags); + if (ret == NULL) + return(NULL); + + op = *regparse; + if (!ISMULT(op)) { + *flagp = flags; + return(ret); + } + + if (!(flags&HASWIDTH) && op != '?') + FAIL("*+ operand could be empty"); + *flagp = (op != '+') ? (WORST|SPSTART) : (WORST|HASWIDTH); + + if (op == '*' && (flags&SIMPLE)) + reginsert(STAR, ret); + else if (op == '*') { + /* Emit x* as (x&|), where & means "self". */ + reginsert(BRANCH, ret); /* Either x */ + regoptail(ret, regnode(BACK)); /* and loop */ + regoptail(ret, ret); /* back */ + regtail(ret, regnode(BRANCH)); /* or */ + regtail(ret, regnode(NOTHING)); /* null. */ + } else if (op == '+' && (flags&SIMPLE)) + reginsert(PLUS, ret); + else if (op == '+') { + /* Emit x+ as x(&|), where & means "self". */ + next = regnode(BRANCH); /* Either */ + regtail(ret, next); + regtail(regnode(BACK), ret); /* loop back */ + regtail(next, regnode(BRANCH)); /* or */ + regtail(ret, regnode(NOTHING)); /* null. */ + } else if (op == '?') { + /* Emit x? as (x|) */ + reginsert(BRANCH, ret); /* Either x */ + regtail(ret, regnode(BRANCH)); /* or */ + next = regnode(NOTHING); /* null. */ + regtail(ret, next); + regoptail(ret, next); + } + regparse++; + if (ISMULT(*regparse)) + FAIL("nested *?+"); + + return(ret); +} + +/* + - regatom - the lowest level + * + * Optimization: gobbles an entire sequence of ordinary characters so that + * it can turn them into a single node, which is smaller to store and + * faster to run. Backslashed characters are exceptions, each becoming a + * separate node; the code is simpler that way and it's not worth fixing. + */ +static char * +regatom(flagp) +int *flagp; +{ + register char *ret; + int flags; + + *flagp = WORST; /* Tentatively. */ + + switch (*regparse++) { + case '^': + ret = regnode(BOL); + break; + case '$': + ret = regnode(EOL); + break; + case '.': + ret = regnode(ANY); + *flagp |= HASWIDTH|SIMPLE; + break; + case '[': { + register int clss; + register int classend; + + if (*regparse == '^') { /* Complement of range. */ + ret = regnode(ANYBUT); + regparse++; + } else + ret = regnode(ANYOF); + if (*regparse == ']' || *regparse == '-') + regc(*regparse++); + while (*regparse != '\0' && *regparse != ']') { + if (*regparse == '-') { + regparse++; + if (*regparse == ']' || *regparse == '\0') + regc('-'); + else { + clss = UCHARAT(regparse-2)+1; + classend = UCHARAT(regparse); + if (clss > classend+1) + FAIL("invalid [] range"); + for (; clss <= classend; clss++) + regc(clss); + regparse++; + } + } else + regc(*regparse++); + } + regc('\0'); + if (*regparse != ']') + FAIL("unmatched []"); + regparse++; + *flagp |= HASWIDTH|SIMPLE; + } + break; + case '(': + ret = reg(1, &flags); + if (ret == NULL) + return(NULL); + *flagp |= flags&(HASWIDTH|SPSTART); + break; + case '\0': + case '|': + case ')': + FAIL("internal urp"); /* Supposed to be caught earlier. */ + /* NOTREACHED */ + break; + case '?': + case '+': + case '*': + FAIL("?+* follows nothing"); + /* NOTREACHED */ + break; + case '\\': + if (*regparse == '\0') + FAIL("trailing \\"); + ret = regnode(EXACTLY); + regc(*regparse++); + regc('\0'); + *flagp |= HASWIDTH|SIMPLE; + break; + default: { + register int len; + register char ender; + + regparse--; + len = strcspn(regparse, META); + if (len <= 0) + FAIL("internal disaster"); + ender = *(regparse+len); + if (len > 1 && ISMULT(ender)) + len--; /* Back off clear of ?+* operand. */ + *flagp |= HASWIDTH; + if (len == 1) + *flagp |= SIMPLE; + ret = regnode(EXACTLY); + while (len > 0) { + regc(*regparse++); + len--; + } + regc('\0'); + } + break; + } + + return(ret); +} + +/* + - regnode - emit a node + */ +static char * /* Location. */ +regnode(op) +char op; +{ + register char *ret; + register char *ptr; + + ret = regcode; + if (ret == ®dummy) { + regsize += 3; + return(ret); + } + + ptr = ret; + *ptr++ = op; + *ptr++ = '\0'; /* Null "next" pointer. */ + *ptr++ = '\0'; + regcode = ptr; + + return(ret); +} + +/* + - regc - emit (if appropriate) a byte of code + */ +static void +regc(b) +char b; +{ + if (regcode != ®dummy) + *regcode++ = b; + else + regsize++; +} + +/* + - reginsert - insert an operator in front of already-emitted operand + * + * Means relocating the operand. + */ +static void +reginsert(op, opnd) +char op; +char *opnd; +{ + register char *src; + register char *dst; + register char *place; + + if (regcode == ®dummy) { + regsize += 3; + return; + } + + src = regcode; + regcode += 3; + dst = regcode; + while (src > opnd) + *--dst = *--src; + + place = opnd; /* Op node, where operand used to be. */ + *place++ = op; + *place++ = '\0'; + *place++ = '\0'; +} + +/* + - regtail - set the next-pointer at the end of a node chain + */ +static void +regtail(p, val) +char *p; +char *val; +{ + register char *scan; + register char *temp; + register int offset; + + if (p == ®dummy) + return; + + /* Find last node. */ + scan = p; + for (;;) { + temp = regnext(scan); + if (temp == NULL) + break; + scan = temp; + } + + if (OP(scan) == BACK) + offset = scan - val; + else + offset = val - scan; + *(scan+1) = (offset>>8)&0377; + *(scan+2) = offset&0377; +} + +/* + - regoptail - regtail on operand of first argument; nop if operandless + */ +static void +regoptail(p, val) +char *p; +char *val; +{ + /* "Operandless" and "op != BRANCH" are synonymous in practice. */ + if (p == NULL || p == ®dummy || OP(p) != BRANCH) + return; + regtail(OPERAND(p), val); +} + +/* + * regexec and friends + */ + +/* + * Global work variables for regexec(). + */ +static char *reginput; /* String-input pointer. */ +static char *regbol; /* Beginning of input, for ^ check. */ +static char **regstartp; /* Pointer to startp array. */ +static char **regendp; /* Ditto for endp. */ + +/* + * Forwards. + */ +STATIC int regtry(); +STATIC int regmatch(); +STATIC int regrepeat(); + +#ifdef DEBUG +int regnarrate = 0; +void regdump(); +STATIC char *regprop(); +#endif + +/* + - regexec - match a regexp against a string + */ +int +regexec2(prog, string, notbol) +register regexp *prog; +register char *string; +int notbol; +{ + register char *s; + + /* Be paranoid... */ + if (prog == NULL || string == NULL) { + regerror("NULL parameter"); + return(0); + } + + /* Check validity of program. */ + if (UCHARAT(prog->program) != MAGIC) { + regerror("corrupted program"); + return(0); + } + + /* If there is a "must appear" string, look for it. */ + if (prog->regmust != NULL) { + s = string; + while ((s = strchr(s, prog->regmust[0])) != NULL) { + if (strncmp(s, prog->regmust, prog->regmlen) == 0) + break; /* Found it. */ + s++; + } + if (s == NULL) /* Not present. */ + return(0); + } + + /* Mark beginning of line for ^ . */ + if (notbol) + regbol = NULL; + else + regbol = string; + + /* Simplest case: anchored match need be tried only once. */ + if (prog->reganch) + return(regtry(prog, string)); + + /* Messy cases: unanchored match. */ + s = string; + if (prog->regstart != '\0') + /* We know what char it must start with. */ + while ((s = strchr(s, prog->regstart)) != NULL) { + if (regtry(prog, s)) + return(1); + s++; + } + else + /* We don't -- general case. */ + do { + if (regtry(prog, s)) + return(1); + } while (*s++ != '\0'); + + /* Failure. */ + return(0); +} + +int +regexec(prog, string) +register regexp *prog; +register char *string; +{ + return regexec2(prog, string, 0); +} + +/* + - regtry - try match at specific point + */ +static int /* 0 failure, 1 success */ +regtry(prog, string) +regexp *prog; +char *string; +{ + register int i; + register char **sp; + register char **ep; + + reginput = string; + regstartp = prog->startp; + regendp = prog->endp; + + sp = prog->startp; + ep = prog->endp; + for (i = NSUBEXP; i > 0; i--) { + *sp++ = NULL; + *ep++ = NULL; + } + if (regmatch(prog->program + 1)) { + prog->startp[0] = string; + prog->endp[0] = reginput; + return(1); + } else + return(0); +} + +/* + - regmatch - main matching routine + * + * Conceptually the strategy is simple: check to see whether the current + * node matches, call self recursively to see whether the rest matches, + * and then act accordingly. In practice we make some effort to avoid + * recursion, in particular by going through "ordinary" nodes (that don't + * need to know whether the rest of the match failed) by a loop instead of + * by recursion. + */ +static int /* 0 failure, 1 success */ +regmatch(prog) +char *prog; +{ + register char *scan; /* Current node. */ + char *next; /* Next node. */ + + scan = prog; +#ifdef DEBUG + if (scan != NULL && regnarrate) + fprintf(stderr, "%s(\n", regprop(scan)); +#endif + while (scan != NULL) { +#ifdef DEBUG + if (regnarrate) + fprintf(stderr, "%s...\n", regprop(scan)); +#endif + next = regnext(scan); + + switch (OP(scan)) { + case BOL: + if (reginput != regbol) + return(0); + break; + case EOL: + if (*reginput != '\0') + return(0); + break; + case ANY: + if (*reginput == '\0') + return(0); + reginput++; + break; + case EXACTLY: { + register int len; + register char *opnd; + + opnd = OPERAND(scan); + /* Inline the first character, for speed. */ + if (*opnd != *reginput) + return(0); + len = strlen(opnd); + if (len > 1 && strncmp(opnd, reginput, len) != 0) + return(0); + reginput += len; + } + break; + case ANYOF: + if (*reginput == '\0' || strchr(OPERAND(scan), *reginput) == NULL) + return(0); + reginput++; + break; + case ANYBUT: + if (*reginput == '\0' || strchr(OPERAND(scan), *reginput) != NULL) + return(0); + reginput++; + break; + case NOTHING: + break; + case BACK: + break; + case OPEN+1: + case OPEN+2: + case OPEN+3: + case OPEN+4: + case OPEN+5: + case OPEN+6: + case OPEN+7: + case OPEN+8: + case OPEN+9: { + register int no; + register char *save; + + no = OP(scan) - OPEN; + save = reginput; + + if (regmatch(next)) { + /* + * Don't set startp if some later + * invocation of the same parentheses + * already has. + */ + if (regstartp[no] == NULL) + regstartp[no] = save; + return(1); + } else + return(0); + } + /* NOTREACHED */ + break; + case CLOSE+1: + case CLOSE+2: + case CLOSE+3: + case CLOSE+4: + case CLOSE+5: + case CLOSE+6: + case CLOSE+7: + case CLOSE+8: + case CLOSE+9: { + register int no; + register char *save; + + no = OP(scan) - CLOSE; + save = reginput; + + if (regmatch(next)) { + /* + * Don't set endp if some later + * invocation of the same parentheses + * already has. + */ + if (regendp[no] == NULL) + regendp[no] = save; + return(1); + } else + return(0); + } + /* NOTREACHED */ + break; + case BRANCH: { + register char *save; + + if (OP(next) != BRANCH) /* No choice. */ + next = OPERAND(scan); /* Avoid recursion. */ + else { + do { + save = reginput; + if (regmatch(OPERAND(scan))) + return(1); + reginput = save; + scan = regnext(scan); + } while (scan != NULL && OP(scan) == BRANCH); + return(0); + /* NOTREACHED */ + } + } + /* NOTREACHED */ + break; + case STAR: + case PLUS: { + register char nextch; + register int no; + register char *save; + register int min; + + /* + * Lookahead to avoid useless match attempts + * when we know what character comes next. + */ + nextch = '\0'; + if (OP(next) == EXACTLY) + nextch = *OPERAND(next); + min = (OP(scan) == STAR) ? 0 : 1; + save = reginput; + no = regrepeat(OPERAND(scan)); + while (no >= min) { + /* If it could work, try it. */ + if (nextch == '\0' || *reginput == nextch) + if (regmatch(next)) + return(1); + /* Couldn't or didn't -- back up. */ + no--; + reginput = save + no; + } + return(0); + } + /* NOTREACHED */ + break; + case END: + return(1); /* Success! */ + /* NOTREACHED */ + break; + default: + regerror("memory corruption"); + return(0); + /* NOTREACHED */ + break; + } + + scan = next; + } + + /* + * We get here only if there's trouble -- normally "case END" is + * the terminating point. + */ + regerror("corrupted pointers"); + return(0); +} + +/* + - regrepeat - repeatedly match something simple, report how many + */ +static int +regrepeat(p) +char *p; +{ + register int count = 0; + register char *scan; + register char *opnd; + + scan = reginput; + opnd = OPERAND(p); + switch (OP(p)) { + case ANY: + count = strlen(scan); + scan += count; + break; + case EXACTLY: + while (*opnd == *scan) { + count++; + scan++; + } + break; + case ANYOF: + while (*scan != '\0' && strchr(opnd, *scan) != NULL) { + count++; + scan++; + } + break; + case ANYBUT: + while (*scan != '\0' && strchr(opnd, *scan) == NULL) { + count++; + scan++; + } + break; + default: /* Oh dear. Called inappropriately. */ + regerror("internal foulup"); + count = 0; /* Best compromise. */ + break; + } + reginput = scan; + + return(count); +} + +/* + - regnext - dig the "next" pointer out of a node + */ +static char * +regnext(p) +register char *p; +{ + register int offset; + + if (p == ®dummy) + return(NULL); + + offset = NEXT(p); + if (offset == 0) + return(NULL); + + if (OP(p) == BACK) + return(p-offset); + else + return(p+offset); +} + +#ifdef DEBUG + +STATIC char *regprop(); + +/* + - regdump - dump a regexp onto stdout in vaguely comprehensible form + */ +void +regdump(r) +regexp *r; +{ + register char *s; + register char op = EXACTLY; /* Arbitrary non-END op. */ + register char *next; + + + s = r->program + 1; + while (op != END) { /* While that wasn't END last time... */ + op = OP(s); + printf("%2d%s", s-r->program, regprop(s)); /* Where, what. */ + next = regnext(s); + if (next == NULL) /* Next ptr. */ + printf("(0)"); + else + printf("(%d)", (s-r->program)+(next-s)); + s += 3; + if (op == ANYOF || op == ANYBUT || op == EXACTLY) { + /* Literal string, where present. */ + while (*s != '\0') { + putchar(*s); + s++; + } + s++; + } + putchar('\n'); + } + + /* Header fields of interest. */ + if (r->regstart != '\0') + printf("start `%c' ", r->regstart); + if (r->reganch) + printf("anchored "); + if (r->regmust != NULL) + printf("must have \"%s\"", r->regmust); + printf("\n"); +} + +/* + - regprop - printable representation of opcode + */ +static char * +regprop(op) +char *op; +{ + register char *p; + static char buf[50]; + + (void) strcpy(buf, ":"); + + switch (OP(op)) { + case BOL: + p = "BOL"; + break; + case EOL: + p = "EOL"; + break; + case ANY: + p = "ANY"; + break; + case ANYOF: + p = "ANYOF"; + break; + case ANYBUT: + p = "ANYBUT"; + break; + case BRANCH: + p = "BRANCH"; + break; + case EXACTLY: + p = "EXACTLY"; + break; + case NOTHING: + p = "NOTHING"; + break; + case BACK: + p = "BACK"; + break; + case END: + p = "END"; + break; + case OPEN+1: + case OPEN+2: + case OPEN+3: + case OPEN+4: + case OPEN+5: + case OPEN+6: + case OPEN+7: + case OPEN+8: + case OPEN+9: + sprintf(buf+strlen(buf), "OPEN%d", OP(op)-OPEN); + p = NULL; + break; + case CLOSE+1: + case CLOSE+2: + case CLOSE+3: + case CLOSE+4: + case CLOSE+5: + case CLOSE+6: + case CLOSE+7: + case CLOSE+8: + case CLOSE+9: + sprintf(buf+strlen(buf), "CLOSE%d", OP(op)-CLOSE); + p = NULL; + break; + case STAR: + p = "STAR"; + break; + case PLUS: + p = "PLUS"; + break; + default: + regerror("corrupted opcode"); + break; + } + if (p != NULL) + (void) strcat(buf, p); + return(buf); +} +#endif + +/* + * The following is provided for those people who do not have strcspn() in + * their C libraries. They should get off their butts and do something + * about it; at least one public-domain implementation of those (highly + * useful) string routines has been published on Usenet. + */ +#ifdef STRCSPN +/* + * strcspn - find length of initial segment of s1 consisting entirely + * of characters not from s2 + */ + +static int +strcspn(s1, s2) +char *s1; +char *s2; +{ + register char *scan1; + register char *scan2; + register int count; + + count = 0; + for (scan1 = s1; *scan1 != '\0'; scan1++) { + for (scan2 = s2; *scan2 != '\0';) /* ++ moved down. */ + if (*scan1 == *scan2++) + return(count); + count++; + } + return(count); +} +#endif diff --git a/external/bsd/less/dist/regexp.h b/external/bsd/less/dist/regexp.h new file mode 100644 index 000000000..783d2804a --- /dev/null +++ b/external/bsd/less/dist/regexp.h @@ -0,0 +1,36 @@ +/* $NetBSD: regexp.h,v 1.2 2011/07/03 19:51:26 tron Exp $ */ + +/* + * Definitions etc. for regexp(3) routines. + * + * Caveat: this is V8 regexp(3) [actually, a reimplementation thereof], + * not the System V one. + */ + +#ifndef _REGEXP +#define _REGEXP 1 + +#define NSUBEXP 10 +typedef struct regexp { + char *startp[NSUBEXP]; + char *endp[NSUBEXP]; + char regstart; /* Internal use only. */ + char reganch; /* Internal use only. */ + char *regmust; /* Internal use only. */ + int regmlen; /* Internal use only. */ + char program[1]; /* Unwarranted chumminess with compiler. */ +} regexp; + +#if defined(__STDC__) || defined(__cplusplus) +# define _ANSI_ARGS_(x) x +#else +# define _ANSI_ARGS_(x) () +#endif + +extern regexp *regcomp _ANSI_ARGS_((char *exp)); +extern int regexec _ANSI_ARGS_((regexp *prog, char *string)); +extern int regexec2 _ANSI_ARGS_((regexp *prog, char *string, int notbol)); +extern void regsub _ANSI_ARGS_((regexp *prog, char *source, char *dest)); +extern void regerror _ANSI_ARGS_((char *msg)); + +#endif /* REGEXP */ diff --git a/commands/less/less/screen.c b/external/bsd/less/dist/screen.c similarity index 94% rename from commands/less/less/screen.c rename to external/bsd/less/dist/screen.c index 65ce5d79a..e323a3b98 100644 --- a/commands/less/less/screen.c +++ b/external/bsd/less/dist/screen.c @@ -1,7 +1,7 @@ -/* $NetBSD: screen.c,v 1.15 2006/10/26 01:33:08 mrg Exp $ */ +/* $NetBSD: screen.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ /* - * Copyright (C) 1984-2005 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -165,6 +165,7 @@ static char *sc_home, /* Cursor home */ *sc_addline, /* Add line, scroll down following lines */ *sc_lower_left, /* Cursor to last line, first column */ + *sc_return, /* Cursor to beginning of current line */ *sc_move, /* General cursor positioning */ *sc_clear, /* Clear screen */ *sc_eol_clear, /* Clear to end of line */ @@ -236,6 +237,7 @@ extern int wscroll; extern int screen_trashed; extern int tty; extern int top_scroll; +extern int oldbot; #if HILITE_SEARCH extern int hilite_search; #endif @@ -627,7 +629,25 @@ ltget_env(capname) char *capname; { char name[16]; + char *s; + s = lgetenv("LESS_TERMCAP_DEBUG"); + if (s != NULL && *s != '\0') + { + struct env { struct env *next; char *name; char *value; }; + static struct env *envs = NULL; + struct env *p; + for (p = envs; p != NULL; p = p->next) + if (strcmp(p->name, capname) == 0) + return p->value; + p = (struct env *) ecalloc(1, sizeof(struct env)); + p->name = save(capname); + p->value = (char *) ecalloc(strlen(capname)+3, sizeof(char)); + sprintf(p->value, "<%s>", capname); + p->next = envs; + envs = p; + return p->value; + } strcpy(name, "LESS_TERMCAP_"); strcat(name, capname); return (lgetenv(name)); @@ -1133,7 +1153,7 @@ get_term() if ((term = lgetenv("TERM")) == NULL) term = DEFAULT_TERM; hardcopy = 0; - if (tgetent(termbuf, term) <= 0) + if (tgetent(termbuf, term) != TGETENT_OK) hardcopy = 1; if (ltgetflag("hc")) hardcopy = 1; @@ -1298,6 +1318,13 @@ get_term() } sc_lower_left = cheaper(t1, t2, "\r"); + /* + * Get carriage return string. + */ + sc_return = ltgetstr("cr", &sp); + if (sc_return == NULL) + sc_return = "\r"; + /* * Choose between using "al" or "sr" ("add line" or "scroll reverse") * to add a line at the top of the screen. @@ -1337,8 +1364,6 @@ get_term() */ static int costcount; -typedef int (*tputfunc)(int); - /*ARGSUSED*/ static int inc_costcount(c) @@ -1353,7 +1378,7 @@ cost(t) char *t; { costcount = 0; - tputs(t, sc_height, (tputfunc) inc_costcount); + tputs(t, sc_height, inc_costcount); return (costcount); } @@ -1526,9 +1551,9 @@ init() { #if !MSDOS_COMPILER if (!no_init) - tputs(sc_init, sc_height, (tputfunc) putchr); + tputs(sc_init, sc_height, putchr); if (!no_keypad) - tputs(sc_s_keypad, sc_height, (tputfunc) putchr); + tputs(sc_s_keypad, sc_height, putchr); if (top_scroll) { int i; @@ -1541,7 +1566,8 @@ init() */ for (i = 1; i < sc_height; i++) putchr('\n'); - } + } else + line_left(); #else #if MSDOS_COMPILER==WIN32C if (!no_init) @@ -1563,9 +1589,9 @@ deinit() return; #if !MSDOS_COMPILER if (!no_keypad) - tputs(sc_e_keypad, sc_height, (tputfunc) putchr); + tputs(sc_e_keypad, sc_height, putchr); if (!no_init) - tputs(sc_deinit, sc_height, (tputfunc) putchr); + tputs(sc_deinit, sc_height, putchr); #else /* Restore system colors. */ SETCOLORS(sy_fg_color, sy_bg_color); @@ -1587,7 +1613,7 @@ deinit() home() { #if !MSDOS_COMPILER - tputs(sc_home, 1, (tputfunc) putchr); + tputs(sc_home, 1, putchr); #else flush(); _settextposition(1,1); @@ -1602,7 +1628,7 @@ home() add_line() { #if !MSDOS_COMPILER - tputs(sc_addline, sc_height, (tputfunc) putchr); + tputs(sc_addline, sc_height, putchr); #else flush(); #if MSDOS_COMPILER==MSOFTC @@ -1778,7 +1804,7 @@ win32_scroll_up(n) /* Move the source text to the top of the screen. */ new_org.X = rcSrc.Left; - new_org.Y = 0; + new_org.Y = rcClip.Top; /* Fill the right character and attributes. */ fillchar.Char.AsciiChar = ' '; @@ -1811,13 +1837,44 @@ win32_scroll_up(n) lower_left() { #if !MSDOS_COMPILER - tputs(sc_lower_left, 1, (tputfunc) putchr); + tputs(sc_lower_left, 1, putchr); #else flush(); _settextposition(sc_height, 1); #endif } +/* + * Move cursor to left position of current line. + */ + public void +line_left() +{ +#if !MSDOS_COMPILER + tputs(sc_return, 1, putchr); +#else + int row; + flush(); +#if MSDOS_COMPILER==WIN32C + { + CONSOLE_SCREEN_BUFFER_INFO scr; + GetConsoleScreenBufferInfo(con_out, &scr); + row = scr.dwCursorPosition.Y - scr.srWindow.Top + 1; + } +#else +#if MSDOS_COMPILER==BORLANDC || MSDOS_COMPILER==DJGPPC + row = wherey(); +#else + { + struct rccoord tpos = _gettextposition(); + row = tpos.row; + } +#endif +#endif + _settextposition(row, 1); +#endif +} + /* * Check if the console size has changed and reset internals * (in lieu of SIGWINCH for WIN32). @@ -1857,7 +1914,7 @@ goto_line(slinenum) int slinenum; { #if !MSDOS_COMPILER - tputs(tgoto(sc_move, 0, slinenum), 1, (tputfunc) putchr); + tputs(tgoto(sc_move, 0, slinenum), 1, putchr); #else flush(); _settextposition(slinenum+1, 1); @@ -1936,7 +1993,7 @@ vbell() #if !MSDOS_COMPILER if (*sc_visual_bell == '\0') return; - tputs(sc_visual_bell, sc_height, (tputfunc) putchr); + tputs(sc_visual_bell, sc_height, putchr); #else #if MSDOS_COMPILER==DJGPPC ScreenVisualBell(); @@ -2027,7 +2084,7 @@ bell() clear() { #if !MSDOS_COMPILER - tputs(sc_clear, sc_height, (tputfunc) putchr); + tputs(sc_clear, sc_height, putchr); #else flush(); #if MSDOS_COMPILER==WIN32C @@ -2046,7 +2103,7 @@ clear() clear_eol() { #if !MSDOS_COMPILER - tputs(sc_eol_clear, 1, (tputfunc) putchr); + tputs(sc_eol_clear, 1, putchr); #else #if MSDOS_COMPILER==MSOFTC short top, left; @@ -2108,9 +2165,9 @@ clear_eol_bot() clear_eol(); #else if (below_mem) - tputs(sc_eos_clear, 1, (tputfunc) putchr); + tputs(sc_eos_clear, 1, putchr); else - tputs(sc_eol_clear, 1, (tputfunc) putchr); + tputs(sc_eol_clear, 1, putchr); #endif } @@ -2126,7 +2183,11 @@ clear_bot() * the mode while we do the clear. Some terminals fill the * cleared area with the current attribute. */ - lower_left(); + if (oldbot) + lower_left(); + else + line_left(); + if (attrmode == AT_NORMAL) clear_eol_bot(); else @@ -2148,13 +2209,13 @@ at_enter(attr) #if !MSDOS_COMPILER /* The one with the most priority is last. */ if (attr & AT_UNDERLINE) - tputs(sc_u_in, 1, (tputfunc) putchr); + tputs(sc_u_in, 1, putchr); if (attr & AT_BOLD) - tputs(sc_b_in, 1, (tputfunc) putchr); + tputs(sc_b_in, 1, putchr); if (attr & AT_BLINK) - tputs(sc_bl_in, 1, (tputfunc) putchr); + tputs(sc_bl_in, 1, putchr); if (attr & AT_STANDOUT) - tputs(sc_s_in, 1, (tputfunc) putchr); + tputs(sc_s_in, 1, putchr); #else flush(); /* The one with the most priority is first. */ @@ -2184,13 +2245,13 @@ at_exit() #if !MSDOS_COMPILER /* Undo things in the reverse order we did them. */ if (attrmode & AT_STANDOUT) - tputs(sc_s_out, 1, (tputfunc) putchr); + tputs(sc_s_out, 1, putchr); if (attrmode & AT_BLINK) - tputs(sc_bl_out, 1, (tputfunc) putchr); + tputs(sc_bl_out, 1, putchr); if (attrmode & AT_BOLD) - tputs(sc_b_out, 1, (tputfunc) putchr); + tputs(sc_b_out, 1, putchr); if (attrmode & AT_UNDERLINE) - tputs(sc_u_out, 1, (tputfunc) putchr); + tputs(sc_u_out, 1, putchr); #else flush(); SETCOLORS(nm_fg_color, nm_bg_color); @@ -2203,7 +2264,10 @@ at_exit() at_switch(attr) int attr; { - if (apply_at_specials(attr) != attrmode) + int new_attrmode = apply_at_specials(attr); + int ignore_modes = AT_ANSI; + + if ((new_attrmode & ~ignore_modes) != (attrmode & ~ignore_modes)) { at_exit(); at_enter(attr); @@ -2246,9 +2310,9 @@ backspace() /* * Erase the previous character by overstriking with a space. */ - tputs(sc_backspace, 1, (tputfunc) putchr); + tputs(sc_backspace, 1, putchr); putchr(' '); - tputs(sc_backspace, 1, (tputfunc) putchr); + tputs(sc_backspace, 1, putchr); #else #if MSDOS_COMPILER==MSOFTC struct rccoord tpos; @@ -2292,7 +2356,7 @@ backspace() putbs() { #if !MSDOS_COMPILER - tputs(sc_backspace, 1, (tputfunc) putchr); + tputs(sc_backspace, 1, putchr); #else int row, col; @@ -2422,3 +2486,33 @@ WIN32getch(tty) return ((char)ascii); } #endif + +#if MSDOS_COMPILER +/* + */ + public void +WIN32setcolors(fg, bg) + int fg; + int bg; +{ + SETCOLORS(fg, bg); +} + +/* + */ + public void +WIN32textout(text, len) + char *text; + int len; +{ +#if MSDOS_COMPILER==WIN32C + DWORD written; + WriteConsole(con_out, text, len, &written, NULL); +#else + char c = text[len]; + text[len] = '\0'; + cputs(text); + text[len] = c; +#endif +} +#endif diff --git a/external/bsd/less/dist/scrsize.c b/external/bsd/less/dist/scrsize.c new file mode 100644 index 000000000..5ec7bd7ff --- /dev/null +++ b/external/bsd/less/dist/scrsize.c @@ -0,0 +1,106 @@ +/* $NetBSD: scrsize.c,v 1.2 2011/07/03 19:51:26 tron Exp $ */ + +/* + * Copyright (C) 1984-2011 Mark Nudelman + * + * You may distribute under the terms of either the GNU General Public + * License or the Less License, as specified in the README file. + * + * For more information about less, or for information on how to + * contact the author, see the README file. + */ + +/* + * This program is used to determine the screen dimensions on OS/2 systems. + * Adapted from code written by Kyosuke Tokoro (NBG01720@nifty.ne.jp). + */ + +/* + * When I wrote this routine, I consulted some part of the source code + * of the xwininfo utility by X Consortium. + * + * Copyright (c) 1987, X Consortium + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the X Consortium shall not + * be used in advertising or otherwise to promote the sale, use or other + * dealings in this Software without prior written authorization from the X + * Consortium. + */ +#include +#include +#include +#include + +static int get_winsize(dpy, window, p_width, p_height) + Display *dpy; + Window window; + int *p_width; + int *p_height; +{ + XWindowAttributes win_attributes; + XSizeHints hints; + long longjunk; + + if (!XGetWindowAttributes(dpy, window, &win_attributes)) + return 1; + if (!XGetWMNormalHints(dpy, window, &hints, &longjunk)) + return 1; + if (!(hints.flags & PResizeInc)) + return 1; + if (hints.width_inc == 0 || hints.height_inc == 0) + return 1; + if (!(hints.flags & (PBaseSize|PMinSize))) + return 1; + if (hints.flags & PBaseSize) + { + win_attributes.width -= hints.base_width; + win_attributes.height -= hints.base_height; + } else + { + win_attributes.width -= hints.min_width; + win_attributes.height -= hints.min_height; + } + *p_width = win_attributes.width / hints.width_inc; + *p_height = win_attributes.height / hints.height_inc; + return 0; +} + +int main(argc, argv) + int argc; + char *argv[]; +{ + char *cp; + Display *dpy; + int size[2]; + + _scrsize(size); + cp = getenv("WINDOWID"); + if (cp != NULL) + { + dpy = XOpenDisplay(NULL); + if (dpy != NULL) + { + get_winsize(dpy, (Window) atol(cp), &size[0], &size[1]); + XCloseDisplay(dpy); + } + } + printf("%i %i\n", size[0], size[1]); + return (0); +} diff --git a/commands/less/less/search.c b/external/bsd/less/dist/search.c similarity index 57% rename from commands/less/less/search.c rename to external/bsd/less/dist/search.c index 97f06c8eb..6e65240f3 100644 --- a/commands/less/less/search.c +++ b/external/bsd/less/dist/search.c @@ -1,7 +1,7 @@ -/* $NetBSD: search.c,v 1.10 2006/10/26 01:33:08 mrg Exp $ */ +/* $NetBSD: search.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ /* - * Copyright (C) 1984-2005 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -16,51 +16,13 @@ */ #include "less.h" +#include "pattern.h" #include "position.h" +#include "charset.h" #define MINPOS(a,b) (((a) < (b)) ? (a) : (b)) #define MAXPOS(a,b) (((a) > (b)) ? (a) : (b)) -#if HAVE_POSIX_REGCOMP -#include -#ifdef REG_EXTENDED -#define REGCOMP_FLAG (more_mode ? 0 : REG_EXTENDED) -#else -#define REGCOMP_FLAG 0 -#endif -#endif -#if HAVE_PCRE -#include -#endif -#if HAVE_RE_COMP -char *re_comp(); -int re_exec(); -#endif -#if HAVE_REGCMP -char *regcmp(); -char *regex(); -extern char *__loc1; -#endif -#if HAVE_V8_REGCOMP -#include "regexp.h" -#endif - - -static void cvt_text __P((char *, char *, int)); -static int is_ucase __P((char *)); -static int prev_pattern __P((void)); -static int compile_pattern __P((char *, int)); -static void uncompile_pattern __P((void)); -static int match_pattern __P((char *, char **, char **, int)); -struct hilite; -static void add_hilite __P((struct hilite *, struct hilite *)); -static void adj_hilite __P((struct hilite *, POSITION, int)); -static void hilite_line __P((POSITION, char *, char *, char *, int)); -static void hilite_screen __P((void)); -static POSITION search_pos __P((int)); -static int search_range __P((POSITION, POSITION, int, int, int, POSITION *, POSITION *)); -static int match __P((char *, char *, char **, char **)); - extern int sigs; extern int how_search; extern int caseless; @@ -70,18 +32,21 @@ extern int jump_sline; extern int bs_mode; extern int ctldisp; extern int status_col; -extern int more_mode; +extern void * constant ml_search; extern POSITION start_attnpos; extern POSITION end_attnpos; +extern int utf_mode; +extern int screen_trashed; #if HILITE_SEARCH extern int hilite_search; -extern int screen_trashed; extern int size_linebuf; extern int squished; extern int can_goto_line; static int hide_hilite; static POSITION prep_startpos; static POSITION prep_endpos; +static int is_caseless; +static int is_ucase_pattern; struct hilite { @@ -90,76 +55,115 @@ struct hilite POSITION hl_endpos; }; static struct hilite hilite_anchor = { NULL, NULL_POSITION, NULL_POSITION }; +static struct hilite filter_anchor = { NULL, NULL_POSITION, NULL_POSITION }; #define hl_first hl_next #endif /* * These are the static variables that represent the "remembered" - * search pattern. + * search pattern and filter pattern. */ -#if HAVE_POSIX_REGCOMP -static regex_t *regpattern = NULL; -#endif -#if HAVE_PCRE -pcre *regpattern = NULL; -#endif -#if HAVE_RE_COMP -int re_pattern = 0; -#endif -#if HAVE_REGCMP -static char *cpattern = NULL; -#endif -#if HAVE_V8_REGCOMP -static struct regexp *regpattern = NULL; -#endif +struct pattern_info { + DEFINE_PATTERN(compiled); + char* text; + int search_type; +}; + +static struct pattern_info search_info; +static struct pattern_info filter_info; -static int is_caseless; -static int is_ucase_pattern; -static int last_search_type; -static char *last_pattern = NULL; +/* + * Are there any uppercase letters in this string? + */ + static int +is_ucase(str) + char *str; +{ + char *str_end = str + strlen(str); + LWCHAR ch; + + while (str < str_end) + { + ch = step_char(&str, +1, str_end); + if (IS_UPPER(ch)) + return (1); + } + return (0); +} /* - * Convert text. Perform one or more of these transformations: + * Compile and save a search pattern. */ -#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 int +set_pattern(info, pattern, search_type) + struct pattern_info *info; + char *pattern; + int search_type; +{ + if (pattern == NULL) + CLEAR_PATTERN(search_info.compiled); + else if (compile_pattern(pattern, search_type, &info->compiled) < 0) + return -1; + /* Pattern compiled successfully; save the text too. */ + if (info->text != NULL) + free(info->text); + info->text = NULL; + if (pattern != NULL) + { + info->text = (char *) ecalloc(1, strlen(pattern)+1); + strcpy(info->text, pattern); + } + info->search_type = search_type; + /* + * Ignore case if -I is set OR + * -i is set AND the pattern is all lowercase. + */ + is_ucase_pattern = is_ucase(pattern); + if (is_ucase_pattern && caseless != OPT_ONPLUS) + is_caseless = 0; + else + is_caseless = caseless; + return 0; +} + +/* + * Discard a saved pattern. + */ static void -cvt_text(odst, osrc, ops) - char *odst; - char *osrc; - int ops; +clear_pattern(info) + struct pattern_info *info; { - register char *dst; - register char *src; + if (info->text != NULL) + free(info->text); + info->text = NULL; + uncompile_pattern(&info->compiled); +} - for (src = osrc, dst = odst; *src != '\0'; src++) - { - if ((ops & CVT_TO_LC) && IS_UPPER(*src)) - /* Convert uppercase to lowercase. */ - *dst++ = TO_LOWER(*src); - else if ((ops & CVT_BS) && *src == '\b' && dst > odst) - /* Delete BS and preceding char. */ - dst--; - else if ((ops & CVT_ANSI) && *src == ESC) - { - /* Skip to end of ANSI escape sequence. */ - while (src[1] != '\0') - if (!is_ansi_middle(*++src)) - break; - } else - /* Just copy. */ - *dst++ = *src; - } - if ((ops & CVT_CRLF) && dst > odst && dst[-1] == '\r') - dst--; - *dst = '\0'; +/* + * Initialize saved pattern to nothing. + */ + static void +init_pattern(info) + struct pattern_info *info; +{ + CLEAR_PATTERN(info->compiled); + info->text = NULL; + info->search_type = 0; } /* - * Determine which conversions to perform. + * Initialize search variables. + */ + public void +init_search() +{ + init_pattern(&search_info); + init_pattern(&filter_info); +} + +/* + * Determine which text conversions to perform before pattern matching. */ static int get_cvt_ops() @@ -182,47 +186,16 @@ get_cvt_ops() return (ops); } -/* - * Are there any uppercase letters in this string? - */ - static int -is_ucase(s) - char *s; -{ - register char *p; - - for (p = s; *p != '\0'; p++) - if (IS_UPPER(*p)) - return (1); - return (0); -} - /* * Is there a previous (remembered) search pattern? */ static int -prev_pattern() +prev_pattern(info) + struct pattern_info *info; { - if (last_search_type & SRCH_NO_REGEX) - return (last_pattern != NULL); -#if HAVE_POSIX_REGCOMP - return (regpattern != NULL); -#endif -#if HAVE_PCRE - return (regpattern != NULL); -#endif -#if HAVE_RE_COMP - return (re_pattern != 0); -#endif -#if HAVE_REGCMP - return (cpattern != NULL); -#endif -#if HAVE_V8_REGCOMP - return (regpattern != NULL); -#endif -#if NO_REGEX - return (last_pattern != NULL); -#endif + if (info->search_type & SRCH_NO_REGEX) + return (info->text != NULL); + return (!is_null_pattern(info->compiled)); } #if HILITE_SEARCH @@ -264,24 +237,11 @@ repaint_hilite(on) if (pos == NULL_POSITION) continue; epos = position(slinenum+1); -#if 0 - /* - * If any character in the line is highlighted, - * repaint the line. - * - * {{ This doesn't work -- if line is drawn with highlights - * which should be erased (e.g. toggle -i with status column), - * we must redraw the line even if it has no highlights. - * For now, just repaint every line. }} - */ - if (is_hilited(pos, epos, 1, NULL)) -#endif - { - (void) forw_line(pos); - goto_line(slinenum); - put_line(); - } + (void) forw_line(pos); + goto_line(slinenum); + put_line(); } + lower_left(); hide_hilite = save_hide_hilite; } @@ -296,6 +256,7 @@ clear_attn() POSITION old_end_attnpos; POSITION pos; POSITION epos; + int moved = 0; if (start_attnpos == NULL_POSITION) return; @@ -323,8 +284,11 @@ clear_attn() (void) forw_line(pos); goto_line(slinenum); put_line(); + moved = 1; } } + if (moved) + lower_left(); } #endif @@ -334,7 +298,7 @@ clear_attn() public void undo_search() { - if (!prev_pattern()) + if (!prev_pattern(&search_info)) { error("No previous regular expression", NULL_PARG); return; @@ -345,215 +309,38 @@ undo_search() #endif } -/* - * Compile a search pattern, for future use by match_pattern. - */ - static int -compile_pattern(pattern, search_type) - char *pattern; - int search_type; -{ - if ((search_type & SRCH_NO_REGEX) == 0) - { -#if HAVE_POSIX_REGCOMP - regex_t *s = (regex_t *) ecalloc(1, sizeof(regex_t)); - if (regcomp(s, pattern, REGCOMP_FLAG)) - { - free(s); - error("Invalid pattern", NULL_PARG); - return (-1); - } - if (regpattern != NULL) - regfree(regpattern); - regpattern = s; -#endif -#if HAVE_PCRE - pcre *comp; - const char *errstring; - int erroffset; - PARG parg; - comp = pcre_compile(pattern, 0, - &errstring, &erroffset, NULL); - if (comp == NULL) - { - parg.p_string = (char *) errstring; - error("%s", &parg); - return (-1); - } - regpattern = comp; -#endif -#if HAVE_RE_COMP - PARG parg; - if ((parg.p_string = re_comp(pattern)) != NULL) - { - error("%s", &parg); - return (-1); - } - re_pattern = 1; -#endif -#if HAVE_REGCMP - char *s; - if ((s = regcmp(pattern, 0)) == NULL) - { - error("Invalid pattern", NULL_PARG); - return (-1); - } - if (cpattern != NULL) - free(cpattern); - cpattern = s; -#endif -#if HAVE_V8_REGCOMP - struct regexp *s; - if ((s = regcomp(pattern)) == NULL) - { - /* - * regcomp has already printed an error message - * via regerror(). - */ - return (-1); - } - if (regpattern != NULL) - free(regpattern); - regpattern = s; -#endif - } - - if (last_pattern != NULL) - free(last_pattern); - last_pattern = (char *) calloc(1, strlen(pattern)+1); - if (last_pattern != NULL) - strcpy(last_pattern, pattern); - - last_search_type = search_type; - return (0); -} - -/* - * Forget that we have a compiled pattern. - */ - static void -uncompile_pattern() -{ -#if HAVE_POSIX_REGCOMP - if (regpattern != NULL) - regfree(regpattern); - regpattern = NULL; -#endif -#if HAVE_PCRE - if (regpattern != NULL) - pcre_free(regpattern); - regpattern = NULL; -#endif -#if HAVE_RE_COMP - re_pattern = 0; -#endif -#if HAVE_REGCMP - if (cpattern != NULL) - free(cpattern); - cpattern = NULL; -#endif -#if HAVE_V8_REGCOMP - if (regpattern != NULL) - free(regpattern); - regpattern = NULL; -#endif - last_pattern = NULL; -} - -/* - * Perform a pattern match with the previously compiled pattern. - * Set sp and ep to the start and end of the matched string. - */ - static int -match_pattern(line, sp, ep, notbol) - char *line; - char **sp; - char **ep; - int notbol; -{ - int matched; - - if (last_search_type & SRCH_NO_REGEX) - return (match(last_pattern, line, sp, ep)); - -#if HAVE_POSIX_REGCOMP - { - regmatch_t rm; - int flags = (notbol) ? REG_NOTBOL : 0; - matched = !regexec(regpattern, line, 1, &rm, flags); - if (!matched) - return (0); -#ifndef __WATCOMC__ - *sp = line + rm.rm_so; - *ep = line + rm.rm_eo; -#else - *sp = rm.rm_sp; - *ep = rm.rm_ep; -#endif - } -#endif -#if HAVE_PCRE - { - int flags = (notbol) ? PCRE_NOTBOL : 0; - int ovector[3]; - matched = pcre_exec(regpattern, NULL, line, strlen(line), - 0, flags, ovector, 3) >= 0; - if (!matched) - return (0); - *sp = line + ovector[0]; - *ep = line + ovector[1]; - } -#endif -#if HAVE_RE_COMP - matched = (re_exec(line) == 1); - /* - * re_exec doesn't seem to provide a way to get the matched string. - */ - *sp = *ep = NULL; -#endif -#if HAVE_REGCMP - *ep = regex(cpattern, line); - matched = (*ep != NULL); - if (!matched) - return (0); - *sp = __loc1; -#endif -#if HAVE_V8_REGCOMP -#if HAVE_REGEXEC2 - matched = regexec2(regpattern, line, notbol); -#else - matched = regexec(regpattern, line); -#endif - if (!matched) - return (0); - *sp = regpattern->startp[0]; - *ep = regpattern->endp[0]; -#endif -#if NO_REGEX - matched = match(last_pattern, line, sp, ep); -#endif - return (matched); -} - #if HILITE_SEARCH /* * Clear the hilite list. */ public void -clr_hilite() +clr_hlist(anchor) + struct hilite *anchor; { struct hilite *hl; struct hilite *nexthl; - for (hl = hilite_anchor.hl_first; hl != NULL; hl = nexthl) + for (hl = anchor->hl_first; hl != NULL; hl = nexthl) { nexthl = hl->hl_next; free((void*)hl); } - hilite_anchor.hl_first = NULL; + anchor->hl_first = NULL; prep_startpos = prep_endpos = NULL_POSITION; } + public void +clr_hilite() +{ + clr_hlist(&hilite_anchor); +} + + public void +clr_filter() +{ + clr_hlist(&filter_anchor); +} + /* * Should any characters in a specified range be highlighted? */ @@ -576,6 +363,30 @@ is_hilited_range(pos, epos) return (0); } +/* + * Is a line "filtered" -- that is, should it be hidden? + */ + public int +is_filtered(pos) + POSITION pos; +{ + struct hilite *hl; + + if (ch_getflags() & CH_HELPFILE) + return (0); + + /* + * Look at each filter and see if the start position + * equals the start position of the line. + */ + for (hl = filter_anchor.hl_first; hl != NULL; hl = hl->hl_next) + { + if (hl->hl_startpos == pos) + return (1); + } + return (0); +} + /* * Should any characters in a specified range be highlighted? * If nohide is nonzero, don't consider hide_hilite. @@ -666,124 +477,24 @@ add_hilite(anchor, hl) ihl->hl_next = hl; } - static void -adj_hilite_ansi(cvt_ops, line, npos) - int cvt_ops; - char **line; - POSITION *npos; -{ - if (cvt_ops & CVT_ANSI) - while (**line == ESC) - { - /* - * Found an ESC. The file position moves - * forward past the entire ANSI escape sequence. - */ - (*line)++; - (*npos)++; - while (**line != '\0') - { - (*npos)++; - if (!is_ansi_middle(*(*line)++)) - break; - } - } -} - -/* - * Adjust hl_startpos & hl_endpos to account for backspace processing. - */ - static void -adj_hilite(anchor, linepos, cvt_ops) - struct hilite *anchor; - POSITION linepos; - int cvt_ops; -{ - char *line; - struct hilite *hl; - int checkstart; - POSITION opos; - POSITION npos; - - /* - * The line was already scanned and hilites were added (in hilite_line). - * But it was assumed that each char position in the line - * correponds to one char position in the file. - * This may not be true if there are backspaces in the line. - * Get the raw line again. Look at each character. - */ - (void) forw_raw_line(linepos, &line); - opos = npos = linepos; - hl = anchor->hl_first; - checkstart = TRUE; - while (hl != NULL) - { - /* - * See if we need to adjust the current hl_startpos or - * hl_endpos. After adjusting startpos[i], move to endpos[i]. - * After adjusting endpos[i], move to startpos[i+1]. - * The hilite list must be sorted thus: - * startpos[0] < endpos[0] <= startpos[1] < endpos[1] <= etc. - */ - if (checkstart && hl->hl_startpos == opos) - { - hl->hl_startpos = npos; - checkstart = FALSE; - continue; /* {{ not really necessary }} */ - } else if (!checkstart && hl->hl_endpos == opos) - { - hl->hl_endpos = npos; - checkstart = TRUE; - hl = hl->hl_next; - continue; /* {{ necessary }} */ - } - if (*line == '\0') - break; - adj_hilite_ansi(cvt_ops, &line, &npos); - opos++; - npos++; - line++; - if (cvt_ops & CVT_BS) - { - while (*line == '\b') - { - npos++; - line++; - adj_hilite_ansi(cvt_ops, &line, &npos); - if (*line == '\0') - { - --npos; - --line; - break; - } - /* - * Found a backspace. The file position moves - * forward by 2 relative to the processed line - * which was searched in hilite_line. - */ - npos++; - line++; - } - } - } -} - /* * Make a hilite for each string in a physical line which matches * the current pattern. * sp,ep delimit the first match already found. */ static void -hilite_line(linepos, line, sp, ep, cvt_ops) +hilite_line(linepos, line, line_len, chpos, sp, ep, cvt_ops) POSITION linepos; char *line; + int line_len; + int *chpos; char *sp; char *ep; int cvt_ops; { char *searchp; + char *line_end = line + line_len; struct hilite *hl; - struct hilite hilites; if (sp == NULL || ep == NULL) return; @@ -795,25 +506,16 @@ hilite_line(linepos, line, sp, ep, cvt_ops) * substrings of the line, may mark more than is correct * if the pattern starts with "^". This bug is fixed * for those regex functions that accept a notbol parameter - * (currently POSIX and V8-with-regexec2). }} + * (currently POSIX, PCRE and V8-with-regexec2). }} */ searchp = line; - /* - * Put the hilites into a temporary list until they're adjusted. - */ - hilites.hl_first = NULL; do { if (ep > sp) { - /* - * Assume that each char position in the "line" - * buffer corresponds to one char position in the file. - * This is not quite true; we need to adjust later. - */ hl = (struct hilite *) ecalloc(1, sizeof(struct hilite)); - hl->hl_startpos = linepos + (sp-line); - hl->hl_endpos = linepos + (ep-line); - add_hilite(&hilites, hl); + hl->hl_startpos = linepos + chpos[sp-line]; + hl->hl_endpos = linepos + chpos[ep-line]; + add_hilite(&hilite_anchor, hl); } /* * If we matched more than zero characters, @@ -822,27 +524,12 @@ hilite_line(linepos, line, sp, ep, cvt_ops) */ if (ep > searchp) searchp = ep; - else if (*searchp != '\0') + else if (searchp != line_end) searchp++; else /* end of line */ break; - } while (match_pattern(searchp, &sp, &ep, 1)); - - /* - * 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. - */ - while ((hl = hilites.hl_next) != NULL) - { - hilites.hl_next = hl->hl_next; - add_hilite(&hilite_anchor, hl); - } + } while (match_pattern(search_info.compiled, search_info.text, + searchp, line_end - searchp, &sp, &ep, 1, search_info.search_type)); } #endif @@ -864,7 +551,7 @@ chg_caseless() * Pattern did have uppercase. * Discard the pattern; we can't change search caselessness now. */ - uncompile_pattern(); + clear_pattern(&search_info); } #if HILITE_SEARCH @@ -924,7 +611,7 @@ search_pos(search_type) */ if (search_type & SRCH_FORW) { - return (ch_zero()); + pos = ch_zero(); } else { pos = ch_length(); @@ -933,46 +620,66 @@ search_pos(search_type) (void) ch_end_seek(); pos = ch_length(); } - return (pos); } - } - if (how_search) + linenum = 0; + } else { - /* - * Search does not include current screen. - */ - if (search_type & SRCH_FORW) - linenum = BOTTOM_PLUS_ONE; - else - linenum = TOP; - pos = position(linenum); - } else - { - /* - * Search includes current screen. - * It starts at the jump target (if searching backwards), - * or at the jump target plus one (if forwards). - */ - linenum = adjsline(jump_sline); - pos = position(linenum); - if (search_type & SRCH_FORW) + int add_one = 0; + + if (how_search == OPT_ON) { - pos = forw_raw_line(pos, (char **)NULL); - while (pos == NULL_POSITION) - { - if (++linenum >= sc_height) - break; - pos = position(linenum); - } + /* + * Search does not include current screen. + */ + if (search_type & SRCH_FORW) + linenum = BOTTOM_PLUS_ONE; + else + linenum = TOP; + } else if (how_search == OPT_ONPLUS && !(search_type & SRCH_AFTER_TARGET)) + { + /* + * Search includes all of displayed screen. + */ + if (search_type & SRCH_FORW) + linenum = TOP; + else + linenum = BOTTOM_PLUS_ONE; } else { - while (pos == NULL_POSITION) - { - if (--linenum < 0) - break; - pos = position(linenum); - } + /* + * Search includes the part of current screen beyond the jump target. + * It starts at the jump target (if searching backwards), + * or at the jump target plus one (if forwards). + */ + linenum = jump_sline; + if (search_type & SRCH_FORW) + add_one = 1; } + linenum = adjsline(linenum); + pos = position(linenum); + if (add_one) + pos = forw_raw_line(pos, (char **)NULL, (int *)NULL); + } + + /* + * If the line is empty, look around for a plausible starting place. + */ + if (search_type & SRCH_FORW) + { + while (pos == NULL_POSITION) + { + if (++linenum >= sc_height) + break; + pos = position(linenum); + } + } else + { + while (pos == NULL_POSITION) + { + if (--linenum < 0) + break; + pos = position(linenum); + } } return (pos); } @@ -991,10 +698,14 @@ search_range(pos, endpos, search_type, matches, maxlines, plinepos, pendpos) POSITION *pendpos; { char *line; + char *cline; + int line_len; LINENUM linenum; char *sp = NULL, *ep = NULL; /* XXX: GCC */ int line_match; int cvt_ops; + int cvt_len; + int *chpos; POSITION linepos, oldpos; linenum = find_linenum(pos); @@ -1033,7 +744,7 @@ search_range(pos, endpos, search_type, matches, maxlines, plinepos, pendpos) * starting position of that line in linepos. */ linepos = pos; - pos = forw_raw_line(pos, &line); + pos = forw_raw_line(pos, &line, &line_len); if (linenum != 0) linenum++; } else @@ -1042,7 +753,7 @@ search_range(pos, endpos, search_type, matches, maxlines, plinepos, pendpos) * Read the previous line and save the * starting position of that line in linepos. */ - pos = back_raw_line(pos, &line); + pos = back_raw_line(pos, &line, &line_len); linepos = pos; if (linenum != 0) linenum--; @@ -1066,66 +777,125 @@ search_range(pos, endpos, search_type, matches, maxlines, plinepos, pendpos) * the search. Remember the line number only if * we're "far" from the last place we remembered it. */ - if (linenums && abs((int)(pos - oldpos)) > 1024) + if (linenums && abs((int)(pos - oldpos)) > 2048) add_lnum(linenum, pos); oldpos = pos; + if (is_filtered(linepos)) + continue; + /* * If it's a caseless search, convert the line to lowercase. * If we're doing backspace processing, delete backspaces. */ cvt_ops = get_cvt_ops(); - cvt_text(line, line, cvt_ops); + cvt_len = cvt_length(line_len, cvt_ops); + cline = (char *) ecalloc(1, cvt_len); + chpos = cvt_alloc_chpos(cvt_len); + cvt_text(cline, line, chpos, &line_len, cvt_ops); + +#if HILITE_SEARCH + /* + * Check to see if the line matches the filter pattern. + * If so, add an entry to the filter list. + */ + if ((search_type & SRCH_FIND_ALL) && prev_pattern(&filter_info)) { + int line_filter = match_pattern(filter_info.compiled, filter_info.text, + cline, line_len, &sp, &ep, 0, filter_info.search_type); + if (line_filter) + { + struct hilite *hl = (struct hilite *) + ecalloc(1, sizeof(struct hilite)); + hl->hl_startpos = linepos; + hl->hl_endpos = pos; + add_hilite(&filter_anchor, hl); + } + } +#endif /* * Test the next line to see if we have a match. * We are successful if we either want a match and got one, * or if we want a non-match and got one. */ - line_match = match_pattern(line, &sp, &ep, 0); - line_match = (!(search_type & SRCH_NO_MATCH) && line_match) || - ((search_type & SRCH_NO_MATCH) && !line_match); - if (!line_match) - continue; - /* - * Got a match. - */ - if (search_type & SRCH_FIND_ALL) + if (prev_pattern(&search_info)) { -#if HILITE_SEARCH - /* - * We are supposed to find all matches in the range. - * Just add the matches in this line to the - * hilite list and keep searching. - */ + line_match = match_pattern(search_info.compiled, search_info.text, + cline, line_len, &sp, &ep, 0, search_type); if (line_match) - hilite_line(linepos, line, sp, ep, cvt_ops); -#endif - } else if (--matches <= 0) - { - /* - * Found the one match we're looking for. - * Return it. - */ -#if HILITE_SEARCH - if (hilite_search == OPT_ON) { /* - * Clear the hilite list and add only - * the matches in this one line. + * Got a match. */ - clr_hilite(); - if (line_match) - hilite_line(linepos, line, sp, ep, cvt_ops); - } + if (search_type & SRCH_FIND_ALL) + { +#if HILITE_SEARCH + /* + * We are supposed to find all matches in the range. + * Just add the matches in this line to the + * hilite list and keep searching. + */ + hilite_line(linepos, cline, line_len, chpos, sp, ep, cvt_ops); +#endif + } else if (--matches <= 0) + { + /* + * Found the one match we're looking for. + * Return it. + */ +#if HILITE_SEARCH + if (hilite_search == OPT_ON) + { + /* + * Clear the hilite list and add only + * the matches in this one line. + */ + clr_hilite(); + hilite_line(linepos, cline, line_len, chpos, sp, ep, cvt_ops); + } #endif - if (plinepos != NULL) - *plinepos = linepos; - return (0); + free(cline); + free(chpos); + if (plinepos != NULL) + *plinepos = linepos; + return (0); + } + } } + free(cline); + free(chpos); } } +/* + * search for a pattern in history. If found, compile that pattern. + */ + static int +hist_pattern(search_type) + int search_type; +{ +#if CMD_HISTORY + char *pattern; + + set_mlist(ml_search, 0); + pattern = cmd_lastpattern(); + if (pattern == NULL) + return (0); + + if (set_pattern(&search_info, pattern, search_type) < 0) + return (0); + +#if HILITE_SEARCH + if (hilite_search == OPT_ONPLUS && !hide_hilite) + hilite_screen(); +#endif + + return (1); +#else /* CMD_HISTORY */ + return (0); +#endif /* CMD_HISTORY */ +} + /* * Search for the n-th occurrence of a specified pattern, * either forward or backward. @@ -1142,20 +912,20 @@ search(search_type, pattern, n) int n; { POSITION pos; - int ucase; if (pattern == NULL || *pattern == '\0') { /* * A null pattern means use the previously compiled pattern. */ - if (!prev_pattern()) + search_type |= SRCH_AFTER_TARGET; + if (!prev_pattern(&search_info) && !hist_pattern(search_type)) { error("No previous regular expression", NULL_PARG); return (-1); } if ((search_type & SRCH_NO_REGEX) != - (last_search_type & SRCH_NO_REGEX)) + (search_info.search_type & SRCH_NO_REGEX)) { error("Please re-enter search pattern", NULL_PARG); return -1; @@ -1185,20 +955,8 @@ search(search_type, pattern, n) /* * Compile the pattern. */ - ucase = is_ucase(pattern); - if (caseless == OPT_ONPLUS) - cvt_text(pattern, pattern, CVT_TO_LC); - if (compile_pattern(pattern, search_type) < 0) + if (set_pattern(&search_info, pattern, search_type) < 0) return (-1); - /* - * Ignore case if -I is set OR - * -i is set AND the pattern is all lowercase. - */ - is_ucase_pattern = ucase; - if (is_ucase_pattern && caseless != OPT_ONPLUS) - is_caseless = 0; - else - is_caseless = caseless; #if HILITE_SEARCH if (hilite_search) { @@ -1296,13 +1054,14 @@ prep_hilite(spos, epos, maxlines) POSITION max_epos; int result; int i; + /* * Search beyond where we're asked to search, so the prep region covers * more than we need. Do one big search instead of a bunch of small ones. */ #define SEARCH_MORE (3*size_linebuf) - if (!prev_pattern()) + if (!prev_pattern(&search_info) && !is_filtering()) return; /* @@ -1315,7 +1074,7 @@ prep_hilite(spos, epos, maxlines) { max_epos = spos; for (i = 0; i < maxlines; i++) - max_epos = forw_raw_line(max_epos, (char **)NULL); + max_epos = forw_raw_line(max_epos, (char **)NULL, (int *)NULL); } /* @@ -1333,6 +1092,7 @@ prep_hilite(spos, epos, maxlines) * Discard the old prep region and start a new one. */ clr_hilite(); + clr_filter(); if (epos != NULL_POSITION) epos += SEARCH_MORE; nprep_startpos = spos; @@ -1394,7 +1154,9 @@ prep_hilite(spos, epos, maxlines) if (epos == NULL_POSITION || epos > spos) { - result = search_range(spos, epos, SRCH_FORW|SRCH_FIND_ALL, 0, + int search_type = SRCH_FORW | SRCH_FIND_ALL; + search_type |= (search_info.search_type & SRCH_NO_REGEX); + result = search_range(spos, epos, search_type, 0, maxlines, (POSITION*)NULL, &new_epos); if (result < 0) return; @@ -1404,35 +1166,34 @@ prep_hilite(spos, epos, maxlines) prep_startpos = nprep_startpos; prep_endpos = nprep_endpos; } -#endif /* - * Simple pattern matching function. - * It supports no metacharacters like *, etc. + * Set the pattern to be used for line filtering. */ - static int -match(pattern, buf, pfound, pend) - char *pattern, *buf; - char **pfound, **pend; + public void +set_filter_pattern(pattern, search_type) + char *pattern; + int search_type; { - register char *pp, *lp; + clr_filter(); + if (pattern == NULL || *pattern == '\0') + clear_pattern(&filter_info); + else + set_pattern(&filter_info, pattern, search_type); + screen_trashed = 1; +} - for ( ; *buf != '\0'; buf++) - { - for (pp = pattern, lp = buf; *pp == *lp; pp++, lp++) - if (*pp == '\0' || *lp == '\0') - break; - if (*pp == '\0') - { - if (pfound != NULL) - *pfound = buf; - if (pend != NULL) - *pend = lp; - return (1); - } - } - return (0); +/* + * Is there a line filter in effect? + */ + public int +is_filtering() +{ + if (ch_getflags() & CH_HELPFILE) + return (0); + return prev_pattern(&filter_info); } +#endif #if HAVE_V8_REGCOMP /* diff --git a/commands/less/less/signal.c b/external/bsd/less/dist/signal.c similarity index 89% rename from commands/less/less/signal.c rename to external/bsd/less/dist/signal.c index 28ea8850d..d6b81b6e1 100644 --- a/commands/less/less/signal.c +++ b/external/bsd/less/dist/signal.c @@ -1,7 +1,7 @@ -/* $NetBSD: signal.c,v 1.6 2006/10/26 01:33:08 mrg Exp $ */ +/* $NetBSD: signal.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ /* - * Copyright (C) 1984-2004 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -42,6 +42,7 @@ extern int linenums; extern int wscroll; extern int reading; extern int quit_on_intr; +extern long jump_sline_fraction; /* * Interrupt signal handler. @@ -51,6 +52,7 @@ extern int quit_on_intr; u_interrupt(type) int type; { + bell(); #if OS2 LSIGNAL(SIGINT, SIG_ACK); #endif @@ -66,7 +68,7 @@ u_interrupt(type) getkey(); #endif if (reading) - intread(); + intread(); /* May longjmp */ } #ifdef SIGTSTP @@ -161,13 +163,12 @@ init_signals(on) #endif #ifdef SIGWINCH (void) LSIGNAL(SIGWINCH, winch); -#else +#endif #ifdef SIGWIND (void) LSIGNAL(SIGWIND, winch); #endif #ifdef SIGQUIT (void) LSIGNAL(SIGQUIT, SIG_IGN); -#endif #endif } else { @@ -250,6 +251,8 @@ psignals() if (sc_width != old_width || sc_height != old_height) { wscroll = (sc_height + 1) / 2; + calc_jump_sline(); + calc_shift_count(); screen_trashed = 1; } } @@ -257,25 +260,6 @@ psignals() if (tsignals & S_INTERRUPT) { if (quit_on_intr) - quit(QUIT_OK); - bell(); - /* - * {{ You may wish to replace the bell() with - * error("Interrupt", NULL_PARG); }} - */ - - /* - * If we were interrupted while in the "calculating - * line numbers" loop, turn off line numbers. - */ - if (lnloop) - { - lnloop = 0; - if (linenums == 2) - screen_trashed = 1; - linenums = 0; - error("Line numbers turned off", NULL_PARG); - } - + quit(QUIT_INTERRUPT); } } diff --git a/commands/less/less/tags.c b/external/bsd/less/dist/tags.c similarity index 97% rename from commands/less/less/tags.c rename to external/bsd/less/dist/tags.c index 2e7c7663c..e827b3b0d 100644 --- a/commands/less/less/tags.c +++ b/external/bsd/less/dist/tags.c @@ -1,7 +1,7 @@ -/* $NetBSD: tags.c,v 1.8 2006/10/26 01:33:08 mrg Exp $ */ +/* $NetBSD: tags.c,v 1.3 2011/07/03 20:14:13 tron Exp $ */ /* - * Copyright (C) 1984-2004 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -58,7 +58,7 @@ static int getentry(); * * Use either pattern or line number. * findgtag() always uses line number, so pattern is always NULL. - * findctag() usually either pattern (in which case line number is 0), + * findctag() uses either pattern (in which case line number is 0), * or line number (in which case pattern is NULL). */ struct tag { @@ -77,10 +77,10 @@ static struct taglist taglist = { TAG_END, TAG_END }; static struct tag *curtag; #define TAG_INS(tp) \ - (tp)->next = taglist.tl_first; \ - (tp)->prev = TAG_END; \ - taglist.tl_first->prev = (tp); \ - taglist.tl_first = (tp); + (tp)->next = TAG_END; \ + (tp)->prev = taglist.tl_last; \ + taglist.tl_last->next = (tp); \ + taglist.tl_last = (tp); #define TAG_RM(tp) \ (tp)->next->prev = (tp)->prev; \ @@ -420,7 +420,7 @@ ctagsearch() * starting position of that line in linepos. */ linepos = pos; - pos = forw_raw_line(pos, &line); + pos = forw_raw_line(pos, &line, (int *)NULL); if (linenum != 0) linenum++; diff --git a/commands/less/less/ttyin.c b/external/bsd/less/dist/ttyin.c similarity index 95% rename from commands/less/less/ttyin.c rename to external/bsd/less/dist/ttyin.c index c1934ee7d..b4c940d39 100644 --- a/commands/less/less/ttyin.c +++ b/external/bsd/less/dist/ttyin.c @@ -1,5 +1,7 @@ +/* $NetBSD: ttyin.c,v 1.2 2011/07/03 19:51:26 tron Exp $ */ + /* - * Copyright (C) 1984-2004 Mark Nudelman + * Copyright (C) 1984-2011 Mark Nudelman * * You may distribute under the terms of either the GNU General Public * License or the Less License, as specified in the README file. @@ -102,10 +104,6 @@ getchr() { char c; int result; -#if 0 - int hex_in = 0; - int hex_value = 0; -#endif do { @@ -139,6 +137,9 @@ getchr() #endif #if 0 /* allow entering arbitrary hex chars for testing */ /* ctrl-A followed by two hex chars makes a byte */ + { + int hex_in = 0; + int hex_value = 0; if (c == CONTROL('A')) { hex_in = 2; @@ -164,6 +165,7 @@ getchr() } c = hex_value; } + } #endif /* * Various parts of the program cannot handle diff --git a/external/bsd/less/dist/version.c b/external/bsd/less/dist/version.c new file mode 100644 index 000000000..14ef4670e --- /dev/null +++ b/external/bsd/less/dist/version.c @@ -0,0 +1,750 @@ +/* $NetBSD: version.c,v 1.2 2011/07/03 19:51:26 tron Exp $ */ + +/* + * Copyright (C) 1984-2011 Mark Nudelman + * + * You may distribute under the terms of either the GNU General Public + * License or the Less License, as specified in the README file. + * + * For more information about less, or for information on how to + * contact the author, see the README file. + */ + + +/* +----------------------- CHANGE HISTORY -------------------------- + + 1/29/84 Allowed use on standard input + 2/1/84 Added E, N, P commands + 4/17/84 Added '=' command, 'stop' signal handling + 4/20/84 Added line folding +v2 4/27/84 Fixed '=' command to use BOTTOM_PLUS_ONE, + instead of TOP, added 'p' & 'v' commands +v3 5/3/84 Added -m and -t options, '-' command +v4 5/3/84 Added LESS environment variable +v5 5/3/84 New comments, fixed '-' command slightly +v6 5/15/84 Added -Q, visual bell +v7 5/24/84 Fixed jump_back(n) bug: n should count real + lines, not folded lines. Also allow number on G command. +v8 5/30/84 Re-do -q and -Q commands +v9 9/25/84 Added "+" argument +v10 10/10/84 Fixed bug in -b argument processing +v11 10/18/84 Made error() ring bell if \n not entered. +----------------------------------------------------------------- +v12 2/13/85 Reorganized signal handling and made portable to 4.2bsd. +v13 2/16/85 Reword error message for '-' command. +v14 2/22/85 Added -bf and -bp variants of -b. +v15 2/25/85 Miscellaneous changes. +v16 3/13/85 Added -u flag for backspace processing. +v17 4/13/85 Added j and k commands, changed -t default. +v18 4/20/85 Rewrote signal handling code. +v19 5/2/85 Got rid of "verbose" eq_message(). + Made search() scroll in some cases. +v20 5/21/85 Fixed screen.c ioctls for System V. +v21 5/23/85 Fixed some first_cmd bugs. +v22 5/24/85 Added support for no RECOMP nor REGCMP. +v23 5/25/85 Miscellanous changes and prettying up. + Posted to USENET. +----------------------------------------------------------------- +v24 6/3/85 Added ti,te terminal init & de-init. + (Thanks to Mike Kersenbrock) +v25 6/8/85 Added -U flag, standout mode underlining. +v26 6/9/85 Added -M flag. + Use underline termcap (us) if it exists. +v27 6/15/85 Renamed some variables to make unique in + 6 chars. Minor fix to -m. +v28 6/28/85 Fixed right margin bug. +v29 6/28/85 Incorporated M.Rose's changes to signal.c +v30 6/29/85 Fixed stupid bug in argument processing. +v31 7/15/85 Added -p flag, changed repaint algorithm. + Added kludge for magic cookie terminals. +v32 7/16/85 Added cat_file if output not a tty. +v33 7/23/85 Added -e flag and EDITOR. +v34 7/26/85 Added -s flag. +v35 7/27/85 Rewrote option handling; added option.c. +v36 7/29/85 Fixed -e flag to work if not last file. +v37 8/10/85 Added -x flag. +v38 8/19/85 Changed prompting; created prompt.c. +v39 8/24/85 (Not -p) does not initially clear screen. +v40 8/26/85 Added "skipping" indicator in forw(). + Posted to USENET. +----------------------------------------------------------------- +v41 9/17/85 ONLY_RETURN, control char commands, + faster search, other minor fixes. +v42 9/25/85 Added ++ command line syntax; + ch_fsize for pipes. +v43 10/15/85 Added -h flag, changed prim.c algorithms. +v44 10/16/85 Made END print in all cases of eof; + ignore SIGTTOU after receiv ing SIGTSTP. +v45 10/16/85 Never print backspaces unless -u. +v46 10/24/85 Backwards scroll in jump_loc. +v47 10/30/85 Fixed bug in edit(): *first_cmd==0 +v48 11/16/85 Use TIOCSETN instead of TIOCSETP. + Added marks (m and ' commands). + Posted to USENET. +----------------------------------------------------------------- +v49 1/9/86 Fixed bug: signal didn't clear mcc. +v50 1/15/86 Added ' (quote) to gomark. +v51 1/16/86 Added + cmd, fixed problem if first_cmd + fails, made g cmd sort of "work" on pipes + ev en if bof is no longer buffered. +v52 1/17/86 Made short files work better. +v53 1/20/86 Added -P option. +v54 1/20/86 Changed help to use HELPFILE. +v55 1/23/86 Messages work better if not tty output. +v56 1/24/86 Added -l option. +v57 1/31/86 Fixed -l to get confirmation before + ov erwriting an existing file. +v58 8/28/86 Added filename globbing. +v59 9/15/86 Fixed some bugs with very long filenames. +v60 9/26/86 Incorporated changes from Leith (Casey) + Leedom for boldface and -z option. +v61 9/26/86 Got rid of annoying repaints after ! cmd. + Posted to USENET. +----------------------------------------------------------------- +v62 12/23/86 Added is_directory(); change -z default to + -1 instead of 24; cat-and-exit if -e and + file is less than a screenful. +v63 1/8/87 Fixed bug in cat-and-exit if > 1 file. +v64 1/12/87 Changed puts/putstr, putc/putchr, + getc/getchr to av oid name conflict with + stdio functions. +v65 1/26/87 Allowed '-' command to change NUMBER + v alued options (thanks to Gary Puckering) +v66 2/13/87 Fixed bug: prepaint should use force=1. +v67 2/24/87 Added !! and % expansion to ! command. +v68 2/25/87 Added SIGWINCH and TIOCGWINSZ support; + changed is_directory to bad_file. + (thanks to J. Robert Ward) +v69 2/25/87 Added SIGWIND and WIOCGETD (for Unix PC). +v70 3/13/87 Changed help cmd from 'h' to 'H'; better + error msgs in bad_file, errno_message. +v71 5/11/87 Changed -p to -c, made triple -c/-C + for clear-eol like more's -c. +v72 6/26/87 Added -E, -L, use $SHELL in lsystem(). + (thanks to Stev e Spearman) +v73 6/26/87 Allow Examine "#" for previous file. + Posted to USENET 8/25/87. +----------------------------------------------------------------- +v74 9/18/87 Fix conflict in EOF symbol with stdio.h, + Make os.c more portable to BSD. +v75 9/23/87 Fix problems in get_term (thanks to + Paul Eggert); new backwards scrolling in + jump_loc (thanks to Marion Hakanson). +v76 9/23/87 Added -i flag; allow single "!" to + inv oke a shell (thanks to Franco Barber). +v77 9/24/87 Added -n flag and line number support. +v78 9/25/87 Fixed problem with prompts longer than + the screen width. +v79 9/29/87 Added the _ command. +v80 10/6/87 Allow signal to break out of linenum scan. +v81 10/6/87 Allow -b to be changed from within less. +v82 10/7/87 Add cmd_decode to use a table for key + binding (thanks to Dav id Nason). +v83 10/9/87 Allow .less file for user-defined keys. +v84 10/11/87 Fix -e/-E problems (thanks to Felix Lee). +v85 10/15/87 Search now keeps track of line numbers. +v86 10/20/87 Added -B option and autobuf; fixed + "pipe error" bug. +v87 3/1/88 Fix bug re BSD signals while reading file. +v88 3/12/88 Use new format for -P option (thanks to + der Mouse), allow "+-c" without message, + fix bug re BSD hangup. +v89 3/18/88 Turn off line numbers if linenum scan + is interrupted. +v90 3/30/88 Allow -P from within less. +v91 3/30/88 Added tags file support (new -t option) + (thanks to Brian Campbell). +v92 4/4/88 Added -+option syntax. +v93 4/11/88 Add support for slow input (thanks to + Joe Orost & apologies for taking almost + 3 years to get this in!) +v94 4/11/88 Redo reading/signal stuff. +v95 4/20/88 Repaint screen better after signal. +v96 4/21/88 Add /! and ?! commands. +v97 5/17/88 Allow -l/-L from within less. + Eliminate some static arrays (use calloc). + Posted to USENET. +----------------------------------------------------------------- +v98 10/14/88 Fix incorrect calloc call; uninitialized + var in exec_mca; core dump on unknown TERM. + Make v cmd work if past last line of file. + Fix some signal bugs. +v99 10/29/88 Allow space between -X and string, + when X is a string-valued option. +v100 1/5/89 Fix globbing bug when $SHELL not set; + allow spaces after -t command. +v101 1/6/89 Fix problem with long (truncated) lines + in tags file (thanks to Neil Dixon). +v102 1/6/89 Fix bug with E# when no prev file; + allow spaces after -l command. +v103 3/14/89 Add -N, -f and -? options. Add z and w + commands. Add %L for prompt strings. +v104 3/16/89 Added EDITPROTO. +v105 3/20/89 Fix bug in find_linenum which cached + incorrectly on long lines. +v106 3/31/89 Added -k option and multiple lesskey + files. +v107 4/27/89 Add 8-bit char support and -g option. + Split option code into 3 files. +v108 5/5/89 Allocate position table dynamically + (thanks to Paul Eggert); change % command + from "percent" to vi-style brace finder. +v109 5/10/89 Added ESC-% command, split prim.c. +v110 5/24/89 Fixed bug in + option; fixed repaint bug + under Sun windows (thanks to Paul Eggert). +v111 5/25/89 Generalized # and % expansion; use + calloc for some error messages. +v112 5/30/89 Get rid of ESC-%, add {}()[] commands. +v113 5/31/89 Optimize lseeks (thanks to Paul Eggert). +v114 7/25/89 Added ESC-/ and ESC-/! commands. +v115 7/26/89 Added ESC-n command. +v116 7/31/89 Added find_pos to optimize g command. +v117 8/1/89 Change -f option to -r. +v118 8/2/89 Save positions for all previous files, + not just the immediately previous one. +v119 8/7/89 Save marks across file boundaries. + Add file handle stuff. +v120 8/11/89 Add :ta command. +v121 8/16/89 Add -f option. +v122 8/30/89 Fix performance with many buffers. +v123 8/31/89 Verbose prompts for string options. + Posted beta to USENET. +----------------------------------------------------------------- +v124 9/18/89 Reorganize search commands, + N = rev, ESC-n = span, add ESC-N. +v125 9/18/89 Fix tab bug (thanks to Alex Liu). + Fix EOF bug when both -w and -c. +v126 10/25/89 Add -j option. +v127 10/27/89 Fix problems with blank lines before BOF. +v128 10/27/89 Add %bj, etc. to prompt strings. +v129 11/3/89 Add -+,-- commands; add set-option and + unset-option to lesskey. +v130 11/6/89 Generalize A_EXTRA to string, remove + set-option, unset-option from lesskey. +v131 11/7/89 Changed name of EDITPROTO to LESSEDIT. +v132 11/8/89 Allow editing of command prefix. +v133 11/16/89 Add -y option (thanks to Jeff Sullivan). +v134 12/1/89 Glob filenames in the -l command. +v135 12/5/89 Combined {}()[] commands into one, and + added ESC-^F and ESC-^B commands. +v136 1/20/90 Added -S, -R flags. Added | command. + Added warning for binary files. (thanks + to Richard Brittain and J. Sullivan). +v137 1/21/90 Rewrote horrible pappend code. + Added * notation for hi-bit chars. +v138 1/24/90 Fix magic cookie terminal handling. + Get rid of "cleanup" loop in ch_get. +v139 1/27/90 Added MSDOS support. (many thanks + to Richard Brittain). +v140 2/7/90 Editing a new file adds it to the + command line list. +v141 2/8/90 Add edit_list for editing >1 file. +v142 2/10/90 Add :x command. +v143 2/11/90 Add * and @ modifies to search cmds. + Change ESC-/ cmd from /@* to / *. +v144 3/1/90 Messed around with ch_zero; + no real change. +v145 3/2/90 Added -R and -v/-V for MSDOS; + renamed FILENAME to avoid conflict. +v146 3/5/90 Pull cmdbuf functions out of command.c +v147 3/7/90 Implement ?@; fix multi-file edit bugs. +v148 3/29/90 Fixed bug in :e then :e#. +v149 4/3/90 Change error,ierror,query to use PARG. +v150 4/6/90 Add LESS_CHARSET, LESS_CHARDEF. +v151 4/13/90 Remove -g option; clean up ispipe. +v152 4/14/90 lsystem() closes input file, for + editors which require exclusive open. +v153 4/18/90 Fix bug if SHELL unset; + fix bug in overstrike control char. +v154 4/25/90 Output to fd 2 via buffer. +v155 4/30/90 Ignore -i if uppercase in pattern + (thanks to Michael Rendell.) +v156 5/3/90 Remove scroll limits in forw() & back(); + causes problems with -c. +v157 5/4/90 Forward search starts at next real line + (not screen line) after jump target. +v158 6/14/90 Added F command. +v159 7/29/90 Fix bug in exiting: output not flushed. +v160 7/29/90 Clear screen before initial output w/ -c. +v161 7/29/90 Add -T flag. +v162 8/14/90 Fix bug with +F on command line. +v163 8/21/90 Added LESSBINFMT variable. +v164 9/5/90 Added -p, LINES, COLUMNS and + unset mark ' == BOF, for 1003.2 D5. +v165 9/6/90 At EOF with -c set, don't display empty + screen when try to page forward. +v166 9/6/90 Fix G when final line in file wraps. +v167 9/11/90 Translate CR/LF -> LF for 1003.2. +v168 9/13/90 Return to curr file if "tag not found". +v169 12/12/90 G goes to EOF even if file has grown. +v170 1/17/91 Add optimization for BSD _setjmp; + fix #include ioctl.h TERMIO problem. + (thanks to Paul Eggert) + Posted to USENET. +----------------------------------------------------------------- +v171 3/6/91 Fix -? bug in get_filename. +v172 3/15/91 Fix G bug in empty file. + Fix bug with ?\n and -i and uppercase + pattern at EOF! + (thanks to Paul Eggert) +v173 3/17/91 Change N cmd to not permanently change + direction. (thanks to Brian Matthews) +v174 3/18/91 Fix bug with namelogfile not getting + cleared when change files. +v175 3/18/91 Fix bug with ++cmd on command line. + (thanks to Jim Meyering) +v176 4/2/91 Change | to not force current screen, + include marked line, start/end from + top of screen. Improve search speed. + (thanks to Don Mears) +v177 4/2/91 Add LESSHELP variable. + Fix bug with F command with -e. + Try /dev/tty for input before using fd 2. + Patches posted to USENET 4/2/91. +----------------------------------------------------------------- +v178 4/8/91 Fixed bug in globbing logfile name. + (thanks to Jim Meyering) +v179 4/9/91 Allow negative -z for screen-relative. +v180 4/9/91 Clear to eos rather than eol if "db"; + don't use "sr" if "da". + (thanks to Tor Lillqvist) +v181 4/18/91 Fixed bug with "negative" chars 80 - FF. + (thanks to Benny Sander Hofmann) +v182 5/16/91 Fixed bug with attribute at EOL. + (thanks to Brian Matthews) +v183 6/1/91 Rewrite linstall to do smart config. +v184 7/11/91 Process \b in searches based on -u + rather than -i. +v185 7/11/91 -Pxxx sets short prompt; assume SIGWINCH + after a SIGSTOP. (thanks to Ken Laprade) +----------------------------------------------------------------- +v186 4/20/92 Port to MS-DOS (Microsoft C). +v187 4/23/92 Added -D option & TAB_COMPLETE_FILENAME. +v188 4/28/92 Added command line editing features. +v189 12/8/92 Fix mem overrun in anscreen.c:init; + fix edit_list to recover from bin file. +v190 2/13/93 Make TAB enter one filename at a time; + create ^L with old TAB functionality. +v191 3/10/93 Defer creating "flash" page for MS-DOS. +v192 9/6/93 Add BACK-TAB. +v193 9/17/93 Simplify binary_file handling. +v194 1/4/94 Add rudiments of alt_filename handling. +v195 1/11/94 Port back to Unix; support keypad. +----------------------------------------------------------------- +v196 6/7/94 Fix bug with bad filename; fix IFILE + type problem. (thanks to David MacKenzie) +v197 6/7/94 Fix bug with .less tables inserted wrong. +v198 6/23/94 Use autoconf installation technology. + (thanks to David MacKenzie) +v199 6/29/94 Fix MS-DOS build (thanks to Tim Wiegman). +v200 7/25/94 Clean up copyright, minor fixes. + Posted to prep.ai.mit.edu +----------------------------------------------------------------- +v201 7/27/94 Check for no memcpy; add casts to calloc; + look for regcmp in libgen.a. + (thanks to Kaveh Ghazi). +v202 7/28/94 Fix bug in edit_next/edit_prev with + non-existant files. +v203 8/2/94 Fix a variety of configuration bugs on + various systems. (thanks to Sakai + Kiyotaka, Harald Koenig, Bjorn Brox, + Teemu Rantanen, and Thorsten Lockert) +v204 8/3/94 Use strerror if available. + (thanks to J.T. Conklin) +v205 8/5/94 Fix bug in finding "me" termcap entry. + (thanks to Andreas Stolcke) +8/10/94 v205+: Change BUFSIZ to LBUFSIZE to avoid name + conflict with stdio.h. + Posted to prep.ai.mit.edu +----------------------------------------------------------------- +v206 8/10/94 Use initial_scrpos for -t to avoid + displaying first page before init(). + (thanks to Dominique Petitpierre) +v207 8/12/94 Fix bug if stdout is not tty. +v208 8/16/94 Fix bug in close_altfile if goto err1 + in edit_ifile. (Thanks to M.J. Hewitt) +v209 8/16/94 Change scroll to wscroll to avoid + conflict with library function. +v210 8/16/94 Fix bug with bold on 8 bit chars. + (thanks to Vitor Duarte) +v211 8/16/94 Don't quit on EOI in jump_loc / forw. +v212 8/18/94 Use time_t if available. +v213 8/20/94 Allow ospeed to be defined in termcap.h. +v214 8/20/94 Added HILITE_SEARCH, -F, ESC-u cmd. + (thanks to Paul Lew and Bob Byrnes) +v215 8/23/94 Fix -i toggle behavior. +v216 8/23/94 Process BS in all searches, not only -u. +v217 8/24/94 Added -X flag. +v218 8/24/94 Reimplement undo_search. +v219 8/24/94 Find tags marked with line number + instead of pattern. +v220 8/24/94 Stay at same position after SIG_WINCH. +v221 8/24/94 Fix bug in file percentage in big file. +v222 8/25/94 Do better if can't reopen current file. +v223 8/27/94 Support setlocale. + (thanks to Robert Joop) +v224 8/29/94 Revert v216: process BS in search + only if -u. +v225 9/6/94 Rewrite undo_search again: toggle. +v226 9/15/94 Configuration fixes. + (thanks to David MacKenzie) +v227 9/19/94 Fixed strerror config problem. + Posted to prep.ai.mit.edu +----------------------------------------------------------------- +v228 9/21/94 Fix bug in signals: repeated calls to + get_editkeys overflowed st_edittable. +v229 9/21/94 Fix "Nothing to search" error if -a + and SRCH_PAST_EOF. +v230 9/21/94 Don't print extra error msg in search + after regerror(). +v231 9/22/94 Fix hilite bug if search matches 0 chars. + (thanks to John Polstra) +v232 9/23/94 Deal with weird systems that have + termios.h but not tcgetattr(). + Posted to prep.ai.mit.edu +----------------------------------------------------------------- +v233 9/26/94 Use get_term() instead of pos_init() in + psignals to re-get lower_left termcap. + (Thanks to John Malecki) +v234 9/26/94 Make MIDDLE closer to middle of screen. +v235 9/27/94 Use local strchr if system doesn't have. +v236 9/28/94 Don't use libucb; use libterm if + libtermcap & libcurses doesn't work. + (Fix for Solaris; thanks to Frank Kaefer) +v237 9/30/94 Use system isupper() etc if provided. + Posted to prep.ai.mit.edu +----------------------------------------------------------------- +v238 10/6/94 Make binary non-blinking if LESSBINFMT + is set to a string without a *. +v239 10/7/94 Don't let delimit_word run back past + beginning of cmdbuf. +v240 10/10/94 Don't write into termcap buffer. + (Thanks to Benoit Speckel) +v241 10/13/94 New lesskey file format. + Don't expand filenames in search command. +v242 10/14/94 Allow lesskey specification of "literal". +v243 10/14/94 Add #stop command to lesskey. +v244 10/16/94 Add -f flag to lesskey. +v245 10/25/94 Allow TAB_COMPLETE_FILENAME to be undefd. +v246 10/27/94 Move help file to /usr/local/share. +v247 10/27/94 Add -V option. +v248 11/5/94 Add -V option to lesskey. +v249 11/5/94 Remove -f flag from lesskey; default + input file is ~/.lesskey.in, not stdin. +v250 11/7/94 Lesskey input file "-" means stdin. +v251 11/9/94 Convert cfgetospeed result to ospeed. + (Thanks to Andrew Chernov) +v252 11/16/94 Change default lesskey input file from + .lesskey.in to .lesskey. + Posted to prep.ai.mit.edu +----------------------------------------------------------------- +v253 11/21/94 Fix bug when tags file has a backslash. +v254 12/6/94 Fix -k option. +v255 12/8/94 Add #define EXAMINE to disable :e etc. +v256 12/10/94 Change highlighting: only highlite search + results (but now it is reliable). +v257 12/10/94 Add goto_line and repaint_highlight + to optimize highlight repaints. +v258 12/12/94 Fixup in hilite_line if BS_SPECIAL. +v259 12/12/94 Convert to autoconf 2.0. +v260 12/13/94 Add SECURE define. +v261 12/14/94 Use system WERASE char as EC_W_BACKSPACE. +v262 12/16/94 Add -g/-G flag and screen_hilite. +v263 12/20/94 Reimplement/optimize -G flag behavior. +v264 12/23/94 Allow EXTRA string after line-edit cmd + in lesskey file. +v265 12/24/94 Add LESSOPEN=|cmd syntax. +v266 12/26/94 Add -I flag. +v267 12/28/94 Formalize the four-byte header emitted + by a LESSOPEN pipe. +v268 12/28/94 Get rid of four-byte header. +v269 1/2/95 Close alt file before open new one. + Avoids multiple popen(). +v270 1/3/95 Use VISUAL; use S_ISDIR/S_ISREG; fix + config problem with Solaris POSIX regcomp. +v271 1/4/95 Don't quit on read error. +v272 1/5/95 Get rid of -L. +v273 1/6/95 Fix ch_ungetchar bug; don't call + LESSOPEN on a pipe. +v274 1/6/95 Ported to OS/2 (thanks to Kai Uwe Rommel) +v275 1/18/95 Fix bug if toggle -G at EOF. +v276 1/30/95 Fix OS/2 version. +v277 1/31/95 Add "next" charset; don't display ^X + for X > 128. +v278 2/14/95 Change default for -G. + Posted to prep.ai.mit.edu +----------------------------------------------------------------- +v279 2/22/95 Add GNU options --help, --version. + Minor config fixes. +v280 2/24/95 Clean up calls to glob(); don't set # + if we can't open the new file. +v281 2/24/95 Repeat search should turn on hilites. +v282 3/2/95 Minor fixes. +v283 3/2/95 Fix homefile; make OS2 look in $HOME. +v284 3/2/95 Error if "v" on LESSOPENed file; + "%" figures out file size on pipe. +v285 3/7/95 Don't set # in lsystem; + lesskey try $HOME first. +v286 3/7/95 Reformat change history (too much free time?). +v287 3/8/95 Fix hilite bug if overstrike multiple chars. +v288 3/8/95 Allow lesskey to override get_editkey keys. +v289 3/9/95 Fix adj_hilite bug when line gets processed by + hilite_line more than once. +v290 3/9/95 Make configure automatically. Fix Sequent problem + with incompatible sigsetmask(). + Posted to prep.ai.mit.edu +----------------------------------------------------------------- +v291 3/21/95 Add #env to lesskey. Fix MS-DOS build. + Posted to simtel. +----------------------------------------------------------------- +v292 4/24/95 Add MS-DOS support for Borland C. + Fix arrow keys in MS-DOS versions. +v293 4/28/95 Add auto-versioning stuff to make dist. +v294 5/12/95 Fix Borland build. +v295 1/20/96 Fix search on squished file; add /@@. +v296 1/23/96 Allow cmdbuf larger than screen width. +v297 1/24/96 Don't call termcap if tgetent fails; + add #defines for buffers. +v298 1/24/96 Change @@ to ^K. + Add alternate search modifiers ^N, ^F, ^E. +v299 1/25/96 Fix percent overflow in jump_percent (thanks to Brent Wiese); + don't send "ti" after shell command till RETURN pressed. +v300 1/25/96 Change -U to print tabs as ^I. +v301 1/30/96 Make hilites work in cmd F output. +v302 1/31/96 Fix cmd F to notice window-change signals. +v303 1/31/96 Add ESC-SPACE command. +v304 2/1/96 Add ^R search modifier; add LESSSECURE. +v305 2/2/96 Workaround Linux /proc kernel bug; add LESSKEY. +v306 3/16/96 Minor fixes. +v307 3/25/96 Allow cmd line arg "--"; fix DOS & OS/2 defines.h. +v308 4/4/96 Port to OS-9 (thanks to Boisy Pitre); fix -d. +v309 4/9/96 Fix OS-9 version; fix tags bug with "$". +v310 4/10/96 Get rid of HELPFILE. +v311 4/22/96 Add Windows32 support; merge doscreen.c into screen.c. +v312 4/24/96 Don't quit after "cannot reopen" error. +v313 4/25/96 Added horizontal scrolling. +v314 4/26/96 Modified -e to quit on reaching end of a squished file. +v315 4/26/96 Fix "!;TAB" bug. +v316 5/2/96 Make "|a" when (a < curr screen) go to end of curr screen. +v317 5/14/96 Various fixes for the MS-DOS and OS/2 builds. + Added ## and %% handling for filenames +v318 5/29/96 Port to OS-9 Microware compiler; minor fixes + (thanks to Martin Gregorie). +v319 7/8/96 Fix Windows port (thanks to Jeff Paquette). +v320 7/11/96 Final fixes for Windows port. +v321 7/18/96 Minor fixes. + Posted to Web page. +----------------------------------------------------------------- +v322 8/13/96 Fix bug in shell escape from help file; add support for + Microsoft Visual C under Windows; numerous small fixes. +v323 8/19/96 Fixes for Windows version (thanks to Simon Munton); + fix for Linux library weirdness (thanks to Jim Diamond); + port to DJGPP (thanks to Eli Zaretskii). +v324 8/21/96 Add support for spaces in filenames (thanks to Simon Munton). +v325 8/21/96 Add lessecho, for spaces in filenames under Unix. +v326 8/27/96 Fix DJGPP version. +v327 9/1/96 Reorganize lglob, make spaces in filenames work better in Unix. +v328 10/7/96 Append / to directory name in filename completion. + Fix MS-DOS and OS-9 versions. +v329 10/11/96 Fix more MS-DOS bugs; add LESSSEPARATOR; add -" option. + Add LESSMETACHARS, LESSMETAESCAPE. +v330 10/21/96 Minor fixes. + Posted to Web page. +----------------------------------------------------------------- +v331 4/22/97 Various Windows fixes (thanks to Gurusamy Sarathy). +v332 4/22/97 Enter filenames from cmd line into edit history. + Posted to Web page. +----------------------------------------------------------------- +v333 3/4/99 Changed -w to highlite new line after forward movement. +v334 3/9/99 Avoid overflowing prompt buffer; add %d and %D. +v335 3/20/99 Add EBCDIC support (thanks to Thomas Dorner). + Use HOMEDRIVE/HOMEPATH on Windows (thanks to Preston Bannister). + Posted to Web page. +----------------------------------------------------------------- +v336 4/8/99 Fix installation bugs. +v337 4/9/99 Fix another installation bug. + Posted to Web page. +----------------------------------------------------------------- +v338 4/13/99 Add support for long option names. +v339 4/18/99 Add \k, long option names to lesskey. Add -^P. Add :d. +v340 4/21/99 Add regexec2. Fix Windows build. + Posted to Web page. +----------------------------------------------------------------- +v341 5/6/99 Add -F option; %c & ?c prompt escapes. + (Thanks to Michele Maltoni) +v342 7/22/99 Add system-wide lesskey file; allow GPL or Less License. +v343 9/23/99 Support UTF-8 (Thanks to Robert Brady). + Add %P and ?P in prompts. +v344 10/27/99 -w highlights target line of g and p commands. +v345 10/29/99 Make -R pass thru ESC but not other control chars. + Posted to Web page. +----------------------------------------------------------------- +v346 11/4/99 Fix bugs in long option processing; R cmd should clear hilites. + Posted to Web page. +----------------------------------------------------------------- +v347 12/13/99 Fixes for DJGPP version (thanks to Eli Zaretskii). +v348 12/28/99 Fix deleting file with marks (thanks to Dimitar Jekov). + Fix color problem in DJGPP version (thanks to Eli Zaretskii). +v349 1/24/00 Fix minor DJGPP bugs; check environment vars for UTF-8; + add --with-editor (thanks to Eli, Markus Kuhn, Thomas Schoepf). +v350 3/1/00 Fix clear-while-standout bug. +v351 3/5/00 Change -M and = prompts to show top & bottom line number. + Posted to Web page. +----------------------------------------------------------------- +v352 3/8/00 Fix scan_option NULL dereference. +----------------------------------------------------------------- +v353 3/20/00 Fix SECURE compile bug, allow space after numeric option. +v354 3/23/00 Add support for PCRE; add --with-regex configure option. +----------------------------------------------------------------- +v355 6/28/00 Add -# option (thanks to Andy Levinson). +v356 7/5/00 Add -J option. +v357 7/6/00 Support sigprocmask. +----------------------------------------------------------------- +v358 7/8/00 Fix problems with #stop in lesskey file. + Posted to Web page. +----------------------------------------------------------------- +v359 9/10/00 Fixes for Win32 display problems (thanks to Maurizio Vairani). +v360 1/17/01 Move sysless to etc. +v361 12/4/01 Add IBM-1047 charset & EBCDIC fixes (thanks to Thomas Dorner). + Fix 32 bit dependencies (thanks to Paul Eggert). + Fix UTF-8 overstriking (thanks to Robert Brady). +v362 12/4/01 Make status column show search targets. +v363 12/6/01 Add --no-keypad option. + Add variable width tabstops (thanks to Peter Samuelson). +v364 12/10/01 Better handling of very long lines in input; + Fix horizontal shifting of colored text. +v365 12/11/01 Fix overstriking of tabs; + Add support for global(1) and multiple tag matches + (thanks to Shigio Yamaguchi and Tim Vanderhoek). +v366 12/11/01 Fixes for OS/2 (thanks to Kyosuke Tokoro). +v367 12/13/01 Allow -D and -x options to terminate without dollar sign; + Right/left arrow when entering N are shift cmds, not line edit. +v368 12/18/01 Update lesskey commands. +v370 12/23/01 Fix tags error messages. + Posted to Web page. +----------------------------------------------------------------- +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. +----------------------------------------------------------------- +v382 2/3/04 Remove copyrighted code. +----------------------------------------------------------------- +v383 2/16/04 Add history file; add -K option; improve UTF-8 handling; + fix some signed char bugs (thanks to Christian Biere); + fix some upper/lower case bugs (thanks to Bjoern Jacke); + add erase2 char (thanks to David Lawrence); + add windows charset (thanks to Dimitar Zhekov). +v384 2/20/04 Improvements in UTF-8 handling. +v385 2/23/04 Fix UTF-8 output bug. +----------------------------------------------------------------- +v386 9/13/05 Improvements to UTF-8 shift & color (thanks to Charles Levert); + protect against invalid LESSOPEN and LESSCLOSE values. +v387 9/14/05 Update Charles Levert's UTF-8 patch. +v388 9/14/05 Change history behavior; change most sprintf calls to snprintf. +v389 9/14/05 Fix copy & paste with long lines; improve performance of + expand_linebuf; fix crash in init_mlist; +v390 9/15/05 Show search matches in status column even if -G is set. +----------------------------------------------------------------- +v391 9/17/05 Fix bugs. +v392 10/14/05 Fix line wrapping bug. +v393 10/19/05 Allow multiple attributes per char; fix bold+underline bug + (thanks again to Charles Levert). +v394 11/8/05 Fix prompt bug; fix compile problem in Windows build. +----------------------------------------------------------------- +v395 1/12/07 Update Unicode tables (thanks to Charles Levert); + don't chmod if LESSHISTFILE = /dev/null; + make -f work for directories; support DESTDIR in Makefile; + fix sigset_t detection in configure; + make "t" cmd traverse tags in correct order +v396 1/13/07 Add compatibility with POSIX more. +v397 3/21/07 Allow decimal point in number for % command; + Allow decimal point in number for -j option; + Allow n command to fetch last search pattern from history + (thanks to arno). +v398 3/22/07 Don't rewrite history file if not necessary; + fix bug when filenames contain "$". +v399 3/22/07 Don't move to bottom of screen at startup; + don't output extraneous newlines. +v400 3/23/07 Allow search to find pattern after null byte (PCRE and no-regex) + (thanks to Michael Constant). +----------------------------------------------------------------- +v401 3/24/07 Minor documentation fixes. +v402 3/30/07 Fix autoconf bug when memcpy etc are inline; + fix bug in terminating number following -j option. +v403 5/25/07 Fix Windows build. +v404 6/5/07 Fix display bug with F command and long lines. +v405 6/17/07 Fix display bug when using -w option. +v406 6/17/07 Fix secure build. +v407 8/16/07 Fix bugs; support CSI chars. +v408 10/1/07 Fix bug in -i with non-ASCII chars. +v409 10/12/07 Fix crash when viewing text with invalid UTF-8 sequences. +v411 11/6/07 Fix case-insensitive searching with non-ASCII text. +v412 11/6/07 Use symbolic SEEK constants. +v413 11/6/07 Fix search highlight bug with non-ASCII text. +v414 11/6/07 Fix display bug with no-wrap terminals. +v415 11/14/07 Add --follow-name option. +v416 11/22/07 Fix crash when searching text with invalid UTF-8 sequences. +v417 12/31/07 Don't support single-char CSI in UTF-8 mode; + fix bug with -R and invalid CSI sequences; + fix bug searching text with SGR sequences with -r; + emulate SGR sequences in WIN32 build. +v418 12/31/07 Clean up. +----------------------------------------------------------------- +v419 1/16/08 Make CSI char 0x9B work in UTF-8 mode (thanks to Colin Watson). +v420 2/24/08 Add & command; fix -F option; fix '' after G. +v421 2/24/08 Ignore filtered lines when searching. +v422 3/2/08 Output CR at startup. +v423 5/27/08 Clean up. +v424 6/16/08 Fix compile bug with pcre; don't filter help file. +v425 7/14/08 Fix non-ANSI code in list handling in ch.c. +v426 10/27/08 Fix ignaw terminal handling (thanks to Per Hedeland); + fix binary file detection in UTF-8 mode. +v427 3/16/09 A few Win32 fixes (thanks to Jason Hood). +v428 3/30/09 Add "|-" syntax to LESSOPEN. +v429 4/10/09 Fix search highlighting bug with underlined text. +----------------------------------------------------------------- +v430 4/22/09 Don't pass "-" to non-pipe LESSOPEN unless it starts with "-". +v431 4/29/09 Fix highlight bug when match is at end of line. +v432 6/27/09 Better fix for highlight bugs; + fix new problems with ignaw terminals. +v433 6/28/09 Cleanup search code. +v434 6/29/09 More cleanup. +v435 7/04/09 Fix bugs with non-regex filtering. +v436 7/05/09 Fix memory leak. +----------------------------------------------------------------- +v437 7/14/09 Fix bug in handling some long option names; + make percentage calculation more accurate. +v438 12/29/10 Fix bugs with -i/-I and & filtering; + exit with status 2 on ctrl-C with -K. +v439 12/31/10 Add -A option. +v440 1/5/11 Fix bug displaying prompt after = command. +v441 1/21/11 Fix semi-infinite loop if no newlines in file; + make new -A behavior the default. +----------------------------------------------------------------- +v442 3/2/11 Fix search bug. + Add ctrl-G line edit command. +v443 4/9/11 Fix Windows build. +v444 6/8/11 Fix ungetc bug; remove vestiges of obsolete -l option. +*/ + +char version[] = "444"; diff --git a/external/bsd/less/less2netbsd b/external/bsd/less/less2netbsd new file mode 100755 index 000000000..22640783d --- /dev/null +++ b/external/bsd/less/less2netbsd @@ -0,0 +1,121 @@ +#!/bin/sh +# +# $NetBSD: less2netbsd,v 1.5 2011/07/03 23:25:01 tron Exp $ +# +# Copyright (c) 2011 The NetBSD Foundation, Inc. +# All rights reserved. +# +# This code is derived from software contributed to The NetBSD Foundation +# by Matthias Scheler. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS +# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS +# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +# POSSIBILITY OF SUCH DAMAGE. +# + +# less2netbsd: +# Prepare a less source tree for import into the NetBSD source repository. + +PROGNAME=$(basename "$0") +if [ $# -ne 1 ] +then + echo "Usage: $PROGNAME " >&2 + exit 1 +fi +DIRNAME="$1" + +# Change to the source directory. +if [ -d "$DIRNAME" ] && cd "$DIRNAME" +then + : +else + echo "${PROGNAME}: cannot access directory \"$DIRNAME\"." >&2 + exit +fi + +# Check whether the source directory looks sane. +CHECK_FILES="LICENSE configure less.h version.c" +for FILENAME in $CHECK_FILES +do + if [ ! -f "$FILENAME" ] + then + echo "${PROGNAME}: less distribution incomplete." >&2 + exit + fi +done + +# Check whether the "configure" was run. +REQUIRED_HEADERS=defines.h +for FILENAME in $REQUIRED_HEADERS +do + if [ ! -f "$FILENAME" ] + then + echo "${PROGNAME}: Please run \"./configure\"." >&2 + exit + fi +done + +# Fix the permissions. +find . -type d -print0 | xargs -0 chmod 755 +find . -type f -print0 | xargs -0 chmod 644 +chmod 755 configure + +# Remove files generated by "configure". +REMOVE_FILES="Makefile config.log config.status configure.lineno" +rm -f $REMOVE_FILES + +# Add NetBSD RCS Ids. +find . -type f -name "*.[ch]" -print | +while read FILENAME +do + if ! grep -q '\$NetBSD' "$FILENAME" + then + NEW_FILENAME="${FILENAME}.new" + rm -f "${NEW_FILENAME}" + (echo "/* \$NetBSD\$ */" + echo "" + cat "$FILENAME") >"${NEW_FILENAME}" + mv -f "${NEW_FILENAME}" "$FILENAME" + fi +done + +# Remove formatted manual pages. +find . -type f -name "*.man" -delete + +# Rename unformatted manual pages. +find . -type f -name "*.nro" -print | +while read FILENAME +do + mv "$FILENAME" "${FILENAME%.nro}.1" +done + +# Determine the version number. +VERSION=$(sed -n -e 's#char version\[\] = "\(.*\)";#\1#p' version.c) + +# Print out information for the import. +cat <