From cee6fe7563d96f028c6e9343a81e24f9c7f70296 Mon Sep 17 00:00:00 2001 From: delphij Date: Mon, 8 Oct 2007 16:17:42 +0000 Subject: Resolve conflicts to complete less v408 import. Approved by: re (kensmith) --- contrib/less/less.h | 3 ++ contrib/less/line.c | 10 +++--- contrib/less/search.c | 42 +++++++++++++++-------- contrib/less/signal.c | 2 ++ release/doc/en_US.ISO8859-1/relnotes/article.sgml | 2 +- 5 files changed, 38 insertions(+), 21 deletions(-) diff --git a/contrib/less/less.h b/contrib/less/less.h index ada9e27..eb40a0f 100644 --- a/contrib/less/less.h +++ b/contrib/less/less.h @@ -150,6 +150,8 @@ void free(); #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 @@ 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) diff --git a/contrib/less/line.c b/contrib/less/line.c index c1a31fb..217c24c 100644 --- a/contrib/less/line.c +++ b/contrib/less/line.c @@ -269,7 +269,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; @@ -524,7 +524,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); @@ -603,13 +603,13 @@ store_char(ch, a, rep, pos) /* 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 @@ 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. diff --git a/contrib/less/search.c b/contrib/less/search.c index e81bce5..c3a3e76 100644 --- a/contrib/less/search.c +++ b/contrib/less/search.c @@ -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 @@ cvt_text(odst, osrc, lenp, ops) 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 @@ cvt_text(odst, osrc, lenp, ops) break; } else /* Just copy. */ - *dst++ = *src; + put_wchar(&dst, ch); } if ((ops & CVT_CRLF) && dst > odst && dst[-1] == '\r') dst--; @@ -182,14 +190,18 @@ get_cvt_ops() * 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 @@ adj_hilite_ansi(cvt_ops, line, line_len, npos) 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 diff --git a/contrib/less/signal.c b/contrib/less/signal.c index 26dcadd..def985d 100644 --- a/contrib/less/signal.c +++ b/contrib/less/signal.c @@ -93,6 +93,8 @@ winch(type) { LSIGNAL(SIGWINCH, winch); sigs |= S_WINCH; + if (reading) + intread(); } #else #ifdef SIGWIND diff --git a/release/doc/en_US.ISO8859-1/relnotes/article.sgml b/release/doc/en_US.ISO8859-1/relnotes/article.sgml index 6d4b39a..60a65d2 100644 --- a/release/doc/en_US.ISO8859-1/relnotes/article.sgml +++ b/release/doc/en_US.ISO8859-1/relnotes/article.sgml @@ -2314,7 +2314,7 @@ mdconfig_md1="-t vnode -f /var/foo.img" 4.1.8 to 4.1.23. less has been updated from v381 - to v406. &merged; + to v408. libpcap has been updated from 0.9.1 to 0.9.4. &merged; -- cgit v1.1