From owner-p4-projects@FreeBSD.ORG Wed Oct 17 02:46:04 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id C87FE16A41B; Wed, 17 Oct 2007 02:46:03 +0000 (UTC) Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 634EF16A419 for ; Wed, 17 Oct 2007 02:46:03 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 4DBD113C469 for ; Wed, 17 Oct 2007 02:46:03 +0000 (UTC) (envelope-from jb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id l9H2k32j072314 for ; Wed, 17 Oct 2007 02:46:03 GMT (envelope-from jb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id l9H2k2hg072311 for perforce@freebsd.org; Wed, 17 Oct 2007 02:46:02 GMT (envelope-from jb@freebsd.org) Date: Wed, 17 Oct 2007 02:46:02 GMT Message-Id: <200710170246.l9H2k2hg072311@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jb@freebsd.org using -f From: John Birrell To: Perforce Change Reviews Cc: Subject: PERFORCE change 127620 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Oct 2007 02:46:04 -0000 http://perforce.freebsd.org/chv.cgi?CH=127620 Change 127620 by jb@jb_freebsd1 on 2007/10/17 02:45:43 IF6 Affected files ... .. //depot/projects/dtrace6/src/contrib/less/NEWS#2 integrate .. //depot/projects/dtrace6/src/contrib/less/README#2 integrate .. //depot/projects/dtrace6/src/contrib/less/ch.c#2 integrate .. //depot/projects/dtrace6/src/contrib/less/charset.c#2 integrate .. //depot/projects/dtrace6/src/contrib/less/configure#2 integrate .. //depot/projects/dtrace6/src/contrib/less/configure.ac#2 integrate .. //depot/projects/dtrace6/src/contrib/less/filename.c#2 integrate .. //depot/projects/dtrace6/src/contrib/less/funcs.h#2 integrate .. //depot/projects/dtrace6/src/contrib/less/jump.c#2 integrate .. //depot/projects/dtrace6/src/contrib/less/less.h#2 integrate .. //depot/projects/dtrace6/src/contrib/less/less.man#2 integrate .. //depot/projects/dtrace6/src/contrib/less/less.nro#2 integrate .. //depot/projects/dtrace6/src/contrib/less/lessecho.man#2 integrate .. //depot/projects/dtrace6/src/contrib/less/lessecho.nro#2 integrate .. //depot/projects/dtrace6/src/contrib/less/lesskey.man#2 integrate .. //depot/projects/dtrace6/src/contrib/less/lesskey.nro#2 integrate .. //depot/projects/dtrace6/src/contrib/less/line.c#2 integrate .. //depot/projects/dtrace6/src/contrib/less/search.c#2 integrate .. //depot/projects/dtrace6/src/contrib/less/signal.c#2 integrate .. //depot/projects/dtrace6/src/contrib/less/version.c#2 integrate .. //depot/projects/dtrace6/src/contrib/one-true-awk/FIXES#2 integrate .. //depot/projects/dtrace6/src/contrib/one-true-awk/FREEBSD-upgrade#2 integrate .. //depot/projects/dtrace6/src/contrib/one-true-awk/awk.h#2 integrate .. //depot/projects/dtrace6/src/contrib/one-true-awk/awkgram.y#2 integrate .. //depot/projects/dtrace6/src/contrib/one-true-awk/b.c#2 integrate .. //depot/projects/dtrace6/src/contrib/one-true-awk/lex.c#2 integrate .. //depot/projects/dtrace6/src/contrib/one-true-awk/lib.c#2 integrate .. //depot/projects/dtrace6/src/contrib/one-true-awk/main.c#2 integrate .. //depot/projects/dtrace6/src/contrib/one-true-awk/makefile#2 integrate .. //depot/projects/dtrace6/src/contrib/one-true-awk/maketab.c#2 integrate .. //depot/projects/dtrace6/src/contrib/one-true-awk/proctab.c#2 integrate .. //depot/projects/dtrace6/src/contrib/one-true-awk/run.c#2 integrate .. //depot/projects/dtrace6/src/contrib/one-true-awk/tran.c#2 integrate .. //depot/projects/dtrace6/src/include/arpa/tftp.h#2 integrate .. //depot/projects/dtrace6/src/release/doc/en_US.ISO8859-1/relnotes/common/new.sgml#3 integrate .. //depot/projects/dtrace6/src/sbin/dhclient/dhclient-script#2 integrate .. //depot/projects/dtrace6/src/sbin/ifconfig/ifconfig.8#2 integrate .. //depot/projects/dtrace6/src/sbin/ifconfig/ifconfig.c#2 integrate .. //depot/projects/dtrace6/src/sbin/ipfw/ipfw2.c#2 integrate .. //depot/projects/dtrace6/src/share/man/man4/if_bridge.4#2 integrate .. //depot/projects/dtrace6/src/share/man/man4/lagg.4#2 integrate .. //depot/projects/dtrace6/src/share/zoneinfo/Makefile#2 integrate .. //depot/projects/dtrace6/src/sys/arm/arm/busdma_machdep.c#2 integrate .. //depot/projects/dtrace6/src/sys/arm/arm/mem.c#2 integrate .. //depot/projects/dtrace6/src/sys/arm/arm/pmap.c#2 integrate .. //depot/projects/dtrace6/src/sys/arm/arm/vm_machdep.c#2 integrate .. //depot/projects/dtrace6/src/sys/arm/include/pmap.h#2 integrate .. //depot/projects/dtrace6/src/sys/arm/include/sf_buf.h#2 integrate .. //depot/projects/dtrace6/src/sys/arm/include/vmparam.h#2 integrate .. //depot/projects/dtrace6/src/sys/arm/xscale/i80321/iq31244_machdep.c#2 integrate .. //depot/projects/dtrace6/src/sys/conf/kern.pre.mk#3 integrate .. //depot/projects/dtrace6/src/sys/dev/em/if_em.c#3 integrate .. //depot/projects/dtrace6/src/sys/dev/pci/pcireg.h#2 integrate .. //depot/projects/dtrace6/src/sys/fs/pseudofs/pseudofs_vnops.c#2 integrate .. //depot/projects/dtrace6/src/sys/kern/kern_thread.c#2 integrate .. //depot/projects/dtrace6/src/sys/modules/acpi/Makefile#2 integrate .. //depot/projects/dtrace6/src/sys/net/if_bridge.c#2 integrate .. //depot/projects/dtrace6/src/sys/netgraph/ng_l2tp.c#2 integrate .. //depot/projects/dtrace6/src/sys/opencrypto/cryptodev.c#2 integrate .. //depot/projects/dtrace6/src/sys/sys/proc.h#3 integrate .. //depot/projects/dtrace6/src/usr.bin/awk/Makefile#2 integrate .. //depot/projects/dtrace6/src/usr.bin/awk/b.c.diff#2 delete .. //depot/projects/dtrace6/src/usr.bin/awk/lib.c.diff#2 delete .. //depot/projects/dtrace6/src/usr.bin/awk/main.c.diff#2 delete .. //depot/projects/dtrace6/src/usr.bin/awk/run.c.diff#2 delete .. //depot/projects/dtrace6/src/usr.bin/awk/tran.c.diff#2 delete Differences ... ==== //depot/projects/dtrace6/src/contrib/less/NEWS#2 (text+ko) ==== @@ -13,6 +13,20 @@ ====================================================================== + 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. @@ -683,3 +697,4 @@ + ==== //depot/projects/dtrace6/src/contrib/less/README#2 (text+ko) ==== @@ -1,7 +1,7 @@ - Less, version 406 + Less, version 409 - This is the distribution of less, version 406, released 19 Jun 2007. + This is the distribution of less, version 409, released 12 Oct 2007. This program is part of the GNU project (http://www.gnu.org). This program is free software. You may redistribute it and/or ==== //depot/projects/dtrace6/src/contrib/less/ch.c#2 (text+ko) ==== @@ -128,6 +128,9 @@ POSITION pos; POSITION len; + if (thisfile == NULL) + return (EOI); + slept = FALSE; /* @@ -416,6 +419,9 @@ BLOCKNUM new_block; POSITION len; + if (thisfile == NULL) + return (0); + len = ch_length(); if (pos < ch_zero() || (len != NULL_POSITION && pos > len)) return (1); @@ -450,6 +456,9 @@ { POSITION len; + if (thisfile == NULL) + return (0); + if (ch_flags & CH_CANSEEK) ch_fsize = filesize(ch_file); @@ -503,6 +512,8 @@ public POSITION ch_length() { + if (thisfile == NULL) + return (NULL_POSITION); if (ignore_eoi) return (NULL_POSITION); if (ch_flags & CH_HELPFILE) @@ -516,6 +527,8 @@ public POSITION ch_tell() { + if (thisfile == NULL) + return (NULL_POSITION); return (ch_block * LBUFSIZE) + ch_offset; } @@ -527,6 +540,8 @@ { register int c; + if (thisfile == NULL) + return (EOI); c = ch_get(); if (c == EOI) return (EOI); @@ -546,6 +561,8 @@ public int ch_back_get() { + if (thisfile == NULL) + return (EOI); if (ch_offset > 0) ch_offset --; else @@ -586,6 +603,9 @@ { register struct buf *bp; + if (thisfile == NULL) + return; + if (!(ch_flags & CH_CANSEEK)) { /* @@ -769,6 +789,9 @@ { int keepstate = FALSE; + if (thisfile == NULL) + return; + if (ch_flags & (CH_CANSEEK|CH_POPENED|CH_HELPFILE)) { /* @@ -807,6 +830,8 @@ public int ch_getflags() { + if (thisfile == NULL) + return (0); return (ch_flags); } ==== //depot/projects/dtrace6/src/contrib/less/charset.c#2 (text+ko) ==== @@ -567,24 +567,29 @@ { 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) | @@ -592,6 +597,7 @@ ((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) | @@ -603,6 +609,56 @@ } /* + * 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 @@ -612,6 +668,7 @@ char *limit; { LWCHAR ch; + int len; char *p = *pp; if (!utf_mode) @@ -623,14 +680,15 @@ ch = (LWCHAR) ((p > limit) ? *--p : 0); } else if (dir > 0) { - if (p + utf_len(*p) > limit) + len = utf_len(*p); + if (p + len > limit) + { ch = 0; - else + p = limit; + } else { ch = get_wchar(p); - p++; - while (IS_UTF8_TRAIL(*p)) - p++; + p += len; } } else { ==== //depot/projects/dtrace6/src/contrib/less/configure#2 (text+ko) ==== @@ -6473,6 +6473,7 @@ /* end confdefs.h. */ #include #include +#include int main () { ==== //depot/projects/dtrace6/src/contrib/less/configure.ac#2 (text+ko) ==== @@ -304,7 +304,8 @@ AC_MSG_CHECKING(for locale) AC_TRY_LINK([#include -#include ], [setlocale(LC_CTYPE,""); isprint(0); iscntrl(0);], +#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([ ==== //depot/projects/dtrace6/src/contrib/less/filename.c#2 (text+ko) ==== @@ -482,7 +482,7 @@ for (i = 0; i < n; i++) { char c = data[i]; - if (ctldisp == OPT_ONPLUS && c == ESC) + if (ctldisp == OPT_ONPLUS && IS_CSI_START(c)) { while (++i < n && is_ansi_middle(data[i])) continue; ==== //depot/projects/dtrace6/src/contrib/less/funcs.h#2 (text+ko) ==== @@ -56,6 +56,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 (); ==== //depot/projects/dtrace6/src/contrib/less/jump.c#2 (text+ko) ==== @@ -31,6 +31,7 @@ jump_forw() { POSITION pos; + POSITION end_pos; if (ch_end_seek()) { @@ -42,11 +43,17 @@ * 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(); + } } /* ==== //depot/projects/dtrace6/src/contrib/less/less.h#2 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/contrib/less/less.h,v 1.5.8.2 2007/07/03 05:12:41 delphij Exp $ */ +/* $FreeBSD: src/contrib/less/less.h,v 1.5.8.3 2007/10/11 18:51:44 delphij Exp $ */ /* * Copyright (C) 1984-2007 Mark Nudelman * @@ -150,6 +150,8 @@ #define IS_DIGIT(c) ((c) >= '0' && (c) <= '9') #endif +#define IS_CSI_START(c) ((c) == ESC || ((unsigned char)(c)) == CSI) + #ifndef NULL #define NULL 0 #endif @@ -425,6 +427,7 @@ #endif /* IS_EBCDIC_HOST */ #define ESC CONTROL('[') +#define CSI ((unsigned char)'\233') #if _OSK_MWC32 #define LSIGNAL(sig,func) os9_signal(sig,func) ==== //depot/projects/dtrace6/src/contrib/less/less.man#2 (text+ko) ==== @@ -1544,4 +1544,4 @@ - Version 406: 19 Jun 2007 LESS(1) + Version 409: 12 Oct 2007 LESS(1) ==== //depot/projects/dtrace6/src/contrib/less/less.nro#2 (text+ko) ==== @@ -1,4 +1,4 @@ -.TH LESS 1 "Version 406: 19 Jun 2007" +.TH LESS 1 "Version 409: 12 Oct 2007" .SH NAME less \- opposite of more .SH SYNOPSIS ==== //depot/projects/dtrace6/src/contrib/less/lessecho.man#2 (text+ko) ==== @@ -46,4 +46,4 @@ - Version 406: 19 Jun 2007 LESSECHO(1) + Version 409: 12 Oct 2007 LESSECHO(1) ==== //depot/projects/dtrace6/src/contrib/less/lessecho.nro#2 (text+ko) ==== @@ -1,4 +1,4 @@ -.TH LESSECHO 1 "Version 406: 19 Jun 2007" +.TH LESSECHO 1 "Version 409: 12 Oct 2007" .SH NAME lessecho \- expand metacharacters .SH SYNOPSIS ==== //depot/projects/dtrace6/src/contrib/less/lesskey.man#2 (text+ko) ==== @@ -357,4 +357,4 @@ - Version 406: 19 Jun 2007 LESSKEY(1) + Version 409: 12 Oct 2007 LESSKEY(1) ==== //depot/projects/dtrace6/src/contrib/less/lesskey.nro#2 (text+ko) ==== @@ -1,4 +1,4 @@ -.TH LESSKEY 1 "Version 406: 19 Jun 2007" +.TH LESSKEY 1 "Version 409: 12 Oct 2007" .SH NAME lesskey \- specify key bindings for less .SH SYNOPSIS ==== //depot/projects/dtrace6/src/contrib/less/line.c#2 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/contrib/less/line.c,v 1.1.1.4.8.3 2007/07/03 05:12:41 delphij Exp $ */ +/* $FreeBSD: src/contrib/less/line.c,v 1.1.1.4.8.4 2007/10/11 18:51:44 delphij Exp $ */ /* * Copyright (C) 1984-2007 Mark Nudelman * @@ -269,7 +269,7 @@ 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; @@ -524,7 +524,7 @@ 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); @@ -603,13 +603,13 @@ /* Remove whole unrecognized sequence. */ do { --curr; - } while (linebuf[curr] != ESC); + } while (!IS_CSI_START(linebuf[curr])); 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; @@ -943,7 +943,7 @@ } 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. ==== //depot/projects/dtrace6/src/contrib/less/search.c#2 (text+ko) ==== @@ -1,4 +1,4 @@ -/* $FreeBSD: src/contrib/less/search.c,v 1.5.8.2 2007/07/03 05:12:41 delphij Exp $ */ +/* $FreeBSD: src/contrib/less/search.c,v 1.5.8.3 2007/10/11 18:51:44 delphij Exp $ */ /* * Copyright (C) 1984-2007 Mark Nudelman * @@ -16,6 +16,7 @@ #include "less.h" #include "position.h" +#include "charset.h" #define MINPOS(a,b) (((a) < (b)) ? (a) : (b)) #define MAXPOS(a,b) (((a) > (b)) ? (a) : (b)) @@ -120,24 +121,31 @@ int *lenp; int ops; { - register char *dst; - register char *src; + 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; src++) + for (src = osrc, dst = odst; src < src_end; ) { - if ((ops & CVT_TO_LC) && IS_UPPER(*src)) + ch = step_char(&src, +1, src_end); + if ((ops & CVT_TO_LC) && IS_UPPER(ch)) + { /* Convert uppercase to lowercase. */ - *dst++ = TO_LOWER(*src); - else if ((ops & CVT_BS) && *src == '\b' && dst > odst) + put_wchar(&dst, TO_LOWER(ch)); + } else if ((ops & CVT_BS) && ch == '\b' && dst > odst) + { /* Delete BS and preceding char. */ - dst--; - else if ((ops & CVT_ANSI) && *src == ESC) + 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. */ while (src + 1 != src_end) @@ -145,7 +153,7 @@ break; } else /* Just copy. */ - *dst++ = *src; + put_wchar(&dst, ch); } if ((ops & CVT_CRLF) && dst > odst && dst[-1] == '\r') dst--; @@ -182,14 +190,18 @@ * Are there any uppercase letters in this string? */ static int -is_ucase(s) - char *s; +is_ucase(str) + char *str; { - register char *p; + char *str_end = str + strlen(str); + LWCHAR ch; - for (p = s; *p != '\0'; p++) - if (IS_UPPER(*p)) + while (str < str_end) + { + ch = step_char(&str, +1, str_end); + if (IS_UPPER(ch)) return (1); + } return (0); } @@ -679,7 +691,7 @@ char *line_end = *line + line_len; if (cvt_ops & CVT_ANSI) - while (**line == ESC) + while (IS_CSI_START(**line)) { /* * Found an ESC. The file position moves ==== //depot/projects/dtrace6/src/contrib/less/signal.c#2 (text+ko) ==== @@ -8,7 +8,7 @@ * contact the author, see the README file. */ -/* $FreeBSD: src/contrib/less/signal.c,v 1.3.8.2 2007/07/03 05:12:41 delphij Exp $ */ +/* $FreeBSD: src/contrib/less/signal.c,v 1.3.8.3 2007/10/11 18:51:44 delphij Exp $ */ /* * Routines dealing with signals. @@ -93,6 +93,8 @@ { LSIGNAL(SIGWINCH, winch); sigs |= S_WINCH; + if (reading) + intread(); } #else #ifdef SIGWIND ==== //depot/projects/dtrace6/src/contrib/less/version.c#2 (text+ko) ==== @@ -693,6 +693,9 @@ 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. */ -char version[] = "406"; +char version[] = "409"; ==== //depot/projects/dtrace6/src/contrib/one-true-awk/FIXES#2 (text+ko) ==== @@ -25,6 +25,50 @@ This file lists all bug fixes, changes, etc., made since the AWK book was sent to the printers in August, 1987. +May 1, 2007: + fiddle in makefile to fix for BSD make; thanks to igor sobrado. + +Mar 31, 2007: + fixed some null pointer refs calling adjbuf. + +Feb 21, 2007: + fixed a bug in matching the null RE in sub and gsub. thanks to al aho + who actually did the fix (in b.c), and to wolfgang seeberg for finding + it and providing a very compact test case. + + fixed quotation in b.c; thanks to Hal Pratt and the Princeton Dante + Project. + + removed some no-effect asserts in run.c. + + fiddled maketab.c to not complain about bison-generated values. + + removed the obsolete -V argument; fixed --version to print the + version and exit. + + fixed wording and an outright error in the usage message; thanks to igor + sobrado and jason mcintyre. + + fixed a bug in -d that caused core dump if no program followed. + +Jan 1, 2007: + dropped mac.code from makefile; there are few non-MacOSX + mac's these days. + +Jan 17, 2006: + system() not flagged as unsafe in the unadvertised -safe option. + found it while enhancing tests before shipping the ;login: article. + practice what you preach. + + removed the 9-years-obsolete -mr and -mf flags. + + added -version and --version options. + + core dump on linux with BEGIN {nextfile}, now fixed. + + removed some #ifdef's in run.c and lex.c that appear to no + longer be necessary. + Apr 24, 2005: modified lib.c so that values of $0 et al are preserved in the END block, apparently as required by posix. thanks to havard eidnes ==== //depot/projects/dtrace6/src/contrib/one-true-awk/FREEBSD-upgrade#2 (text+ko) ==== @@ -1,4 +1,4 @@ -# $FreeBSD: src/contrib/one-true-awk/FREEBSD-upgrade,v 1.9 2005/05/16 19:19:32 ru Exp $ +# $FreeBSD: src/contrib/one-true-awk/FREEBSD-upgrade,v 1.9.2.1 2007/10/10 00:22:15 obrien Exp $ Import of the 2005/04/24 version of the "one true awk", as described in "The AWK Programming Language", by Al Aho, Brian Kernighan, and @@ -6,7 +6,7 @@ Original sources were taken from the Brian Kernighan's home page (http://cm.bell-labs.com/who/bwk/) and include bug fixes up thru -April 24, 2005. +May 01, 2007. The following files were removed for this import: @@ -21,4 +21,4 @@ The vendor import was done by: - cvs import src/contrib/one-true-awk BELL_LABS bwk_20050424 + cvs import src/contrib/one-true-awk BELL_LABS bwk_20070501 ==== //depot/projects/dtrace6/src/contrib/one-true-awk/awk.h#2 (text+ko) ==== @@ -30,7 +30,7 @@ typedef unsigned char uschar; -#define xfree(a) { if ((a) != NULL) { free((char *) a); a = NULL; } } +#define xfree(a) { if ((a) != NULL) { free((void *) (a)); (a) = NULL; } } #define NN(p) ((p) ? (p) : "(null)") /* guaranteed non-null for dprintf */ ==== //depot/projects/dtrace6/src/contrib/one-true-awk/awkgram.y#2 (text+ko) ==== @@ -50,7 +50,7 @@ %token NL ',' '{' '(' '|' ';' '/' ')' '}' '[' ']' %token ARRAY %token MATCH NOTMATCH MATCHOP -%token FINAL DOT ALL CCL NCCL CHAR OR STAR QUEST PLUS +%token FINAL DOT ALL CCL NCCL CHAR OR STAR QUEST PLUS EMPTYRE %token AND BOR APPEND EQ GE GT LE LT NE IN %token ARG BLTIN BREAK CLOSE CONTINUE DELETE DO EXIT FOR FUNC %token SUB GSUB IF INDEX LSUBSTR MATCHFCN NEXT NEXTFILE ==== //depot/projects/dtrace6/src/contrib/one-true-awk/b.c#2 (text+ko) ==== @@ -22,7 +22,7 @@ THIS SOFTWARE. ****************************************************************/ -/* lasciate ogne speranza, voi ch'entrate. */ +/* lasciate ogne speranza, voi ch'intrate. */ #define DEBUG @@ -44,10 +44,11 @@ #define parent(v) (v)->nnext #define LEAF case CCL: case NCCL: case CHAR: case DOT: case FINAL: case ALL: +#define ELEAF case EMPTYRE: /* empty string in regexp */ #define UNARY case STAR: case PLUS: case QUEST: /* encoding in tree Nodes: - leaf (CCL, NCCL, CHAR, DOT, FINAL, ALL): + leaf (CCL, NCCL, CHAR, DOT, FINAL, ALL, EMPTYRE): left is index, right contains value or pointer to value unary (STAR, PLUS, QUEST): left is child, right is null binary (CAT, OR): left and right are children @@ -182,6 +183,7 @@ void penter(Node *p) /* set up parent pointers and leaf indices */ { switch (type(p)) { + ELEAF LEAF info(p) = poscnt; poscnt++; @@ -206,6 +208,7 @@ void freetr(Node *p) /* free parse tree */ { switch (type(p)) { + ELEAF LEAF xfree(p); break; @@ -282,9 +285,21 @@ return c; } +static int collate_range_cmp(int a, int b) +{ + static char s[2][2]; + + if ((uschar)a == (uschar)b) + return 0; + s[0][0] = a; + s[1][0] = b; + return (strcoll(s[0], s[1])); +} + char *cclenter(const char *argp) /* add a character class */ { int i, c, c2; + int j; uschar *p = (uschar *) argp; uschar *op, *bp; static uschar *buf = 0; @@ -303,21 +318,24 @@ c2 = *p++; if (c2 == '\\') c2 = quoted((char **) &p); - if (c > c2) { /* empty; ignore */ + if (collate_range_cmp(c, c2) > 0) { bp--; i--; continue; } - while (c < c2) { - if (!adjbuf((char **) &buf, &bufsz, bp-buf+2, 100, (char **) &bp, 0)) + for (j = 0; j < NCHARS; j++) { + if ((collate_range_cmp(c, j) > 0) || + collate_range_cmp(j, c2) > 0) + continue; + if (!adjbuf((char **) &buf, &bufsz, bp-buf+2, 100, (char **) &bp, "cclenter1")) FATAL("out of space for character class [%.10s...] 2", p); - *bp++ = ++c; + *bp++ = j; i++; } continue; } } - if (!adjbuf((char **) &buf, &bufsz, bp-buf+2, 100, (char **) &bp, 0)) + if (!adjbuf((char **) &buf, &bufsz, bp-buf+2, 100, (char **) &bp, "cclenter2")) FATAL("out of space for character class [%.10s...] 3", p); *bp++ = c; i++; @@ -339,6 +357,7 @@ int *p; switch (type(v)) { + ELEAF LEAF f->re[info(v)].ltype = type(v); f->re[info(v)].lval.np = right(v); @@ -375,11 +394,12 @@ } int first(Node *p) /* collects initially active leaves of p into setvec */ - /* returns 1 if p matches empty string */ + /* returns 0 if p matches empty string */ { int b, lp; switch (type(p)) { + ELEAF LEAF lp = info(p); /* look for high-water mark of subscripts */ while (setcnt >= maxsetvec || lp >= maxsetvec) { /* guessing here! */ @@ -389,6 +409,10 @@ if (setvec == 0 || tmpset == 0) overflo("out of space in first()"); } + if (type(p) == EMPTYRE) { + setvec[lp] = 0; + return(0); + } if (setvec[lp] != 1) { setvec[lp] = 1; setcnt++; @@ -465,7 +489,7 @@ if (f->out[s]) return(1); do { - assert(*p < NCHARS); + /* assert(*p < NCHARS); */ if ((ns = f->gototab[s][*p]) != 0) s = ns; else @@ -496,7 +520,7 @@ do { if (f->out[s]) /* final state */ patlen = q-p; - assert(*q < NCHARS); + /* assert(*q < NCHARS); */ if ((ns = f->gototab[s][*q]) != 0) s = ns; else @@ -554,7 +578,7 @@ do { if (f->out[s]) /* final state */ patlen = q-p; - assert(*q < NCHARS); + /* assert(*q < NCHARS); */ if ((ns = f->gototab[s][*q]) != 0) s = ns; else @@ -601,9 +625,10 @@ lastre = prestr = (uschar *) p; /* prestr points to string to be parsed */ rtok = relex(); /* GNU compatibility: an empty regexp matches anything */ - if (rtok == '\0') + if (rtok == '\0') { /* FATAL("empty regular expression"); previous */ - return(op2(ALL, NIL, NIL)); + return(op2(EMPTYRE, NIL, NIL)); + } np = regexp(); if (rtok != '\0') FATAL("syntax error in regular expression %s at %s", lastre, prestr); @@ -627,6 +652,9 @@ case ALL: rtok = relex(); return (unary(op2(ALL, NIL, NIL))); + case EMPTYRE: + rtok = relex(); + return (unary(op2(ALL, NIL, NIL))); case DOT: rtok = relex(); return (unary(op2(DOT, NIL, NIL))); @@ -666,7 +694,7 @@ Node *concat(Node *np) { switch (rtok) { - case CHAR: case DOT: case ALL: case CCL: case NCCL: case '$': case '(': + case CHAR: case DOT: case ALL: case EMPTYRE: case CCL: case NCCL: case '$': case '(': return (concat(op2(CAT, np, primary()))); } return (np); @@ -787,7 +815,7 @@ else cflag = 0; n = 2 * strlen((const char *) prestr)+1; - if (!adjbuf((char **) &buf, &bufsz, n, n, (char **) &bp, 0)) + if (!adjbuf((char **) &buf, &bufsz, n, n, (char **) &bp, "relex1")) FATAL("out of space for reg expr %.10s...", lastre); for (; ; ) { if ((c = *prestr++) == '\\') { @@ -806,7 +834,7 @@ prestr[2 + cc->cc_namelen] == ']') { prestr += cc->cc_namelen + 3; for (i = 0; i < NCHARS; i++) { - if (!adjbuf((char **) &buf, &bufsz, bp-buf+1, 100, (char **) &bp, 0)) + if (!adjbuf((char **) &buf, &bufsz, bp-buf+1, 100, (char **) &bp, "relex2")) FATAL("out of space for reg expr %.10s...", lastre); if (cc->cc_func(i)) { *bp++ = i; @@ -855,6 +883,7 @@ if ((k == CHAR && c == ptoi(f->re[p[i]].lval.np)) || (k == DOT && c != 0 && c != HAT) || (k == ALL && c != 0) + || (k == EMPTYRE && c != 0) || (k == CCL && member(c, (char *) f->re[p[i]].lval.up)) || (k == NCCL && !member(c, (char *) f->re[p[i]].lval.up) && c != 0 && c != HAT)) { q = f->re[p[i]].lfollow; ==== //depot/projects/dtrace6/src/contrib/one-true-awk/lex.c#2 (text+ko) ==== >>> TRUNCATED FOR MAIL (1000 lines) <<<