fix to colcrt - fold unders onto blanks

Col. G. L. Sicherman colonel at sunybcs.UUCP
Thu Oct 9 00:19:54 AEST 1986


As the man page for colcrt(1) says under BUGS, underlines ought to be
folded onto blanks, BUT blah blah blah!  What we want is to view a line
like

	Has anybody seen my foo_bar?

as itself, and not as

	Has anybody seen my foo bar?
	                       -

Here are diffs to do it.  The line numbers may be off a bit.  As usual,
the proprietary etc. precludes etc. clearer posting.  A minor tradeoff
is that if you really feed Example 2 in, you'll get Example 1 out.

!38a33
!> char	dontsplitbl;
!59a55,57
!> 			case 'b':
!> 				dontsplitbl = 1;
!> 				break;
!61c59
!< 				printf("usage: %s [ - ] [ -2 ] [ file ... ]\n", progname);
!---
!> 				printf("usage: %s [ - ] [ -2 ] [ -b ] [ file ... ]\n", progname);
!185a183,184
!> 		if (dontsplitbl && i%2 != 0 && canmerge(page[i],page[i+1]))
!> 			merge(page[i],page[i+1]);
!224a224,246
!> 
!> /*
!>  *	The Colonel's stuff.
!>  */
!> 
!> int
!> canmerge(a,b)
!> char a[132], b[132];
!> {
!> 	register int i;
!> 	for (i=0; a[i] && b[i] && i<132; i++)
!> 		if ((' '!=a[i] || '-'!=b[i]) && ' '!=b[i]) return 0;
!> 	return 1;
!> }
!> 
!> merge(a,b)
!> char a[132], b[132];
!> {
!> 	register int i;
!> 	for (i=0; b[i] && i<132; i++)
!> 		if (' '==a[i] || !a[i]) a[i] = '-'==b[i]? '_': b[i];
!> 	bzero(b,132);
-- 
Col. G. L. Sicherman
UU: ...{rocksvax|decvax}!sunybcs!colonel
CS: colonel at buffalo-cs
BI: colonel at sunybcs, csdsiche at sunyabvc



More information about the Comp.bugs.4bsd.ucb-fixes mailing list