summaryrefslogtreecommitdiff
path: root/sysutils/less/files/patch-charset.c
diff options
context:
space:
mode:
authorAdam Weinberger <adamw@FreeBSD.org>2014-07-29 15:00:12 +0000
committerAdam Weinberger <adamw@FreeBSD.org>2014-07-29 15:00:12 +0000
commit7792c21583f7131ad63a9cb6e25b7ef38652d3a7 (patch)
tree35ae86a1ec3a303f6ac7c0146111c635eff41fb4 /sysutils/less/files/patch-charset.c
parent- Switch databases/libmemcache to USES=libtool, drop .la files (diff)
Rename sysutils/ patch-xy patches to reflect the files they modify.
Notes
Notes: svn path=/head/; revision=363335
Diffstat (limited to 'sysutils/less/files/patch-charset.c')
-rw-r--r--sysutils/less/files/patch-charset.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/sysutils/less/files/patch-charset.c b/sysutils/less/files/patch-charset.c
new file mode 100644
index 000000000000..d234169bdba3
--- /dev/null
+++ b/sysutils/less/files/patch-charset.c
@@ -0,0 +1,42 @@
+--- charset.c.orig 2010/10/30 02:38:17
++++ charset.c 2010/10/30 02:40:03
+@@ -408,6 +408,10 @@
+ control_char(c)
+ LWCHAR c;
+ {
++#ifdef COLOR_LESS
++ if (c == ESC)
++ return 0;
++#endif
+ c &= 0377;
+ return (chardef[c] & IS_CONTROL_CHAR);
+ }
+@@ -423,6 +427,20 @@
+ /* {{ This buffer can be overrun if LESSBINFMT is a long string. }} */
+ static char buf[32];
+
++#ifdef COLOR_LESS
++ if(c == ESC)
++ sprintf(buf, "%c", ESC);
++ else
++ {
++ c &= 0377;
++ if (!control_char(c))
++ sprintf(buf, "%c", c);
++ else if (!control_char(c ^ 0100))
++ sprintf(buf, "^%c", c ^ 0100);
++ else
++ sprintf(buf, binfmt, c);
++ }
++#else
+ c &= 0377;
+ if ((c < 128 || !utf_mode) && !control_char(c))
+ SNPRINTF1(buf, sizeof(buf), "%c", (int) c);
+@@ -446,6 +464,7 @@
+ #endif
+ else
+ SNPRINTF1(buf, sizeof(buf), binfmt, c);
++#endif
+ return (buf);
+ }
+