From owner-man-jp@jp.freebsd.org  Sun Jul 29 22:11:46 2001
Received: (from daemon@localhost)
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) id WAA00926;
	Sun, 29 Jul 2001 22:11:46 +0900 (JST)
	(envelope-from owner-man-jp@jp.FreeBSD.org)
Received: from mi01.iij4u.or.jp (mi01.iij4u.or.jp [210.130.0.81])
	by castle.jp.freebsd.org (8.9.3+3.2W/8.7.3) with ESMTP id WAA00921
	for <man-jp@jp.freebsd.org>; Sun, 29 Jul 2001 22:11:45 +0900 (JST)
	(envelope-from moriko@hh.iij4u.or.jp)
Received: from ruriruri.noe.mcu.or.jp (h086.p233.iij4u.or.jp [210.130.233.86])
	by mi01.iij4u.or.jp (8.8.8/MI1.3) with ESMTP id WAA08784
	for <man-jp@jp.freebsd.org>; Sun, 29 Jul 2001 22:11:45 +0900 (JST)
Received: from localhost (dhcp-251.noe.mcu.or.jp [172.16.2.251] (may be forged))
	by ruriruri.noe.mcu.or.jp (8.11.3/8.11.3) with ESMTP id f6TDBi789138;
	Sun, 29 Jul 2001 22:11:44 +0900 (JST)
	(envelope-from moriko@hh.iij4u.or.jp)
Date: Sun, 29 Jul 2001 22:11:44 +0900 (JST)
Message-Id: <20010729.221144.74755858.moriko@hoge.noe.mcu.or.jp>
To: man-jp@jp.freebsd.org
From: MORI Kouji <moriko@hh.iij4u.or.jp>
In-Reply-To: <20010729.105105.94798648.moriko@hoge.noe.mcu.or.jp>
References: <80r8v24xpx.fsf@kurishna.tri.asanuma.co.jp>
	<20010729.105105.94798648.moriko@hoge.noe.mcu.or.jp>
X-Mailer: Mew version 1.95b126 on Emacs 21.0 / Mule 5.0 (SAKAKI)
Mime-Version: 1.0
Content-Type: Multipart/Mixed;
 boundary="--Next_Part(Sun_Jul_29_22:11:44_2001_920)--"
Content-Transfer-Encoding: 7bit
Reply-To: man-jp@jp.freebsd.org
Precedence: list
X-Distribute: distribute version 2.1 (Alpha) patchlevel 24e+010328
X-Sequence: man-jp 3630
Subject: [man-jp 3630] Re: ja-less+iso-358.254 bold+underline patch
Errors-To: owner-man-jp@jp.freebsd.org
Sender: owner-man-jp@jp.freebsd.org
X-Originator: moriko@hh.iij4u.or.jp

----Next_Part(Sun_Jul_29_22:11:44_2001_920)--
Content-Type: Text/Plain; charset=iso-2022-jp
Content-Transfer-Encoding: 7bit

$B?9$G$9!#(B

> $B$3$l$K$D$$$F(B patch $B$r:n$C$F$_$^$7$?!#$^$@IT40A4$G$9$,!"$H$j$"$($:(B

patch $B$r=$@5$7$^$7$?!#$*$*$`$M@5>o$KF0:n$9$k$h$&$K$J$C$F$$$k$H;W$$$^$9!#(B

-- 
$B?9(B $B9@Fs(B	(MORI Kouji)
E-mail: moriko@hh.iij4u.or.jp

----Next_Part(Sun_Jul_29_22:11:44_2001_920)--
Content-Type: Text/Plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="less.patch"

diff -u ../../../less/work/less-358/less.h ./less.h
--- ../../../less/work/less-358/less.h	Sun Jul 29 21:56:50 2001
+++ ./less.h	Sun Jul 29 21:24:23 2001
@@ -283,11 +283,11 @@
 
 /* Special chars used to tell put_line() to do something special */
 #define	AT_NORMAL	(0)
-#define	AT_UNDERLINE	(1)
-#define	AT_BOLD		(2)
-#define	AT_BLINK	(3)
-#define	AT_INVIS	(4)
-#define	AT_STANDOUT	(5)
+#define	AT_UNDERLINE	(1<<1)
+#define	AT_BOLD		(1<<2)
+#define	AT_BLINK	(1<<3)
+#define	AT_INVIS	(1<<4)
+#define	AT_STANDOUT	(1<<5)
 
 /*
  * Defines for multi character set and code set.
diff -u ../../../less/work/less-358/line.c ./line.c
--- ../../../less/work/less-358/line.c	Sun Jul 29 21:56:50 2001
+++ ./line.c	Sun Jul 29 21:44:48 2001
@@ -293,14 +293,14 @@
 attr_swidth(a)
 	int a;
 {
-	switch (a)
-	{
-	case AT_BOLD:		return (bo_s_width);
-	case AT_UNDERLINE:	return (ul_s_width);
-	case AT_BLINK:		return (bl_s_width);
-	case AT_STANDOUT:	return (so_s_width);
-	}
-	return (0);
+  int w = 0;
+
+  w += a & AT_BOLD      ? bo_s_width : 0;
+  w += a & AT_UNDERLINE ? ul_s_width : 0;
+  w += a & AT_BLINK     ? bl_s_width : 0;
+  w += a & AT_STANDOUT  ? so_s_width : 0;
+
+  return w;
 }
 
 /*
@@ -311,14 +311,14 @@
 attr_ewidth(a)
 	int a;
 {
-	switch (a)
-	{
-	case AT_BOLD:		return (bo_e_width);
-	case AT_UNDERLINE:	return (ul_e_width);
-	case AT_BLINK:		return (bl_e_width);
-	case AT_STANDOUT:	return (so_e_width);
-	}
-	return (0);
+  int w = 0;
+
+  w += a & AT_BOLD      ? bo_s_width : 0;
+  w += a & AT_UNDERLINE ? ul_s_width : 0;
+  w += a & AT_BLINK     ? bl_s_width : 0;
+  w += a & AT_STANDOUT  ? so_s_width : 0;
+
+  return w;
 }
 
 /*
@@ -498,7 +498,11 @@
 
 	linebuf[curr] = c;
 	charset[curr] = cs;
-	attr[curr] = a;
+	if (a == AT_NORMAL) {
+	  attr[curr] = AT_NORMAL;
+	} else {
+	  attr[curr] |= a;
+	}
 	column += w;
 	return (0);
 }
Only in ./: line.c~
diff -u ../../../less/work/less-358/output.c ./output.c
--- ../../../less/work/less-358/output.c	Sun Jul 29 21:56:50 2001
+++ ./output.c	Sun Jul 29 21:24:23 2001
@@ -67,20 +67,17 @@
 			 * Display the exit sequence for the old attribute
 			 * and the enter sequence for the new one.
 			 */
-			switch (curr_attr)
-			{
-			case AT_UNDERLINE:	ul_exit();	break;
-			case AT_BOLD:		bo_exit();	break;
-			case AT_BLINK:		bl_exit();	break;
-			case AT_STANDOUT:	so_exit();	break;
-			}
-			switch (a)
-			{
-			case AT_UNDERLINE:	ul_enter();	break;
-			case AT_BOLD:		bo_enter();	break;
-			case AT_BLINK:		bl_enter();	break;
-			case AT_STANDOUT:	so_enter();	break;
-			}
+
+		  if (curr_attr & AT_UNDERLINE)  ul_exit();
+		  if (curr_attr & AT_BOLD)       bo_exit();
+		  if (curr_attr & AT_BLINK)      bl_exit();
+		  if (curr_attr & AT_STANDOUT)   so_exit();
+
+		  if (a & AT_UNDERLINE)  ul_enter();
+		  if (a & AT_BOLD)       bo_enter();
+		  if (a & AT_BLINK)      bl_enter();
+		  if (a & AT_STANDOUT)   so_enter();
+
 			curr_attr = a;
 		}
 		if (curr_attr == AT_INVIS)
@@ -95,13 +92,11 @@
 #endif
 	}
 
-	switch (curr_attr)
-	{
-	case AT_UNDERLINE:	ul_exit();	break;
-	case AT_BOLD:		bo_exit();	break;
-	case AT_BLINK:		bl_exit();	break;
-	case AT_STANDOUT:	so_exit();	break;
-	}
+	if (curr_attr & AT_UNDERLINE)  ul_exit();
+	if (curr_attr & AT_BOLD)       bo_exit();
+	if (curr_attr & AT_BLINK)      bl_exit();
+	if (curr_attr & AT_STANDOUT)   so_exit();
+
 	final_attr = curr_attr;
 }
 
diff -u ../../../less/work/less-358/screen.c ./screen.c
--- ../../../less/work/less-358/screen.c	Sun Jul  9 09:26:47 2000
+++ ./screen.c	Sun Jul 29 21:24:23 2001
@@ -1947,32 +1947,18 @@
 	 * cleared area with the current attribute.
 	 */
 	lower_left();
-	switch (attrmode)
-	{
-	case AT_STANDOUT:
-		so_exit();
-		clear_eol_bot();
-		so_enter();
-		break;
-	case AT_UNDERLINE:
-		ul_exit();
-		clear_eol_bot();
-		ul_enter();
-		break;
-	case AT_BOLD:
-		bo_exit();
-		clear_eol_bot();
-		bo_enter();
-		break;
-	case AT_BLINK:
-		bl_exit();
-		clear_eol_bot();
-		bl_enter();
-		break;
-	default:
-		clear_eol_bot();
-		break;
-	}
+
+	if (attrmode & AT_STANDOUT)  so_exit();
+	if (attrmode & AT_UNDERLINE) ul_exit();
+	if (attrmode & AT_BOLD)      bo_exit();
+	if (attrmode & AT_BLINK)     bl_exit();
+
+	clear_eol_bot();
+
+	if (attrmode & AT_STANDOUT)  so_enter();
+	if (attrmode & AT_UNDERLINE) ul_enter();
+	if (attrmode & AT_BOLD)      bo_enter();
+	if (attrmode & AT_BLINK)     bl_enter();
 }
 
 /*
@@ -1987,7 +1973,7 @@
 	flush();
 	SETCOLORS(so_fg_color, so_bg_color);
 #endif
-	attrmode = AT_STANDOUT;
+	attrmode |= AT_STANDOUT;
 }
 
 /*
@@ -2002,7 +1988,7 @@
 	flush();
 	SETCOLORS(nm_fg_color, nm_bg_color);
 #endif
-	attrmode = AT_NORMAL;
+	attrmode &= ~AT_STANDOUT;
 }
 
 /*
@@ -2018,7 +2004,7 @@
 	flush();
 	SETCOLORS(ul_fg_color, ul_bg_color);
 #endif
-	attrmode = AT_UNDERLINE;
+	attrmode |= AT_UNDERLINE;
 }
 
 /*
@@ -2033,7 +2019,7 @@
 	flush();
 	SETCOLORS(nm_fg_color, nm_bg_color);
 #endif
-	attrmode = AT_NORMAL;
+	attrmode &= ~AT_UNDERLINE;
 }
 
 /*
@@ -2048,7 +2034,7 @@
 	flush();
 	SETCOLORS(bo_fg_color, bo_bg_color);
 #endif
-	attrmode = AT_BOLD;
+	attrmode |= AT_BOLD;
 }
 
 /*
@@ -2063,7 +2049,7 @@
 	flush();
 	SETCOLORS(nm_fg_color, nm_bg_color);
 #endif
-	attrmode = AT_NORMAL;
+	attrmode &= ~AT_BOLD;
 }
 
 /*
@@ -2078,7 +2064,7 @@
 	flush();
 	SETCOLORS(bl_fg_color, bl_bg_color);
 #endif
-	attrmode = AT_BLINK;
+	attrmode |= AT_BLINK;
 }
 
 /*
@@ -2093,7 +2079,7 @@
 	flush();
 	SETCOLORS(nm_fg_color, nm_bg_color);
 #endif
-	attrmode = AT_NORMAL;
+	attrmode &= ~AT_BLINK;
 }
 
 #if 0 /* No longer used */

----Next_Part(Sun_Jul_29_22:11:44_2001_920)----
