freebsd-skq/usr.bin/col
ngie df47d8ed8d ------------------------------------------------------------------------
r288932 | ngie | 2015-10-06 10:15:07 -0700 (Tue, 06 Oct 2015) | 9 lines

Refactor the test/ Makefiles per recent changes to bsd.test.mk and
netbsd-tests.test.mk

- Eliminate explicit SRCTOP setting
- Eliminate explicit OBJ
- Convert all ad hoc NetBSD test integration over to netbsd-tests.test.mk
- Remove unnecessary TESTSDIR setting
- Use SRCTOP where possible for clarity

------------------------------------------------------------------------
2015-10-06 17:46:48 +00:00
..
tests ------------------------------------------------------------------------ 2015-10-06 17:46:48 +00:00
col.1 For half and reverse line feeds, recognize both SUSv2-style escape-digit 2015-05-10 11:41:38 +00:00
col.c For half and reverse line feeds, recognize both SUSv2-style escape-digit 2015-05-10 11:41:38 +00:00
Makefile Add regression test about reverse line feed to col(1) 2015-05-02 12:08:28 +00:00
Makefile.depend Add META_MODE support. 2015-06-13 19:20:56 +00:00
README

#	@(#)README	8.1 (Berkeley) 6/6/93
#
# $FreeBSD$

col - filter out reverse line feeds.

Options are:
	-b	do not print any backspaces (last character written is printed)
	-f	allow half line feeds in output, by default characters between
		lines are pushed to the line below
	-p	force unknown control sequences to be passed through unchanged
	-x	do not compress spaces into tabs.
	-l num	keep (at least) num lines in memory, 128 are kept by default

In the 32V source code to col(1) the default behavior was to NOT compress
spaces into tabs.  There was a -h option which caused it to compress spaces
into tabs.  There was no -x flag.

The 32V documentation, however, was consistent with the SVID (actually, V7
at the time) and documented a -x flag (as defined above) while making no
mention of a -h flag.  Just before 4.3BSD went out, CSRG updated the manual
page to reflect the way the code worked.  Suspecting that this was probably
the wrong way to go, this version adopts the SVID defaults, and no longer
documents the -h option.

Known differences between AT&T's col and this one (# is delimiter):
	Input			AT&T col		this col
	#\nabc\E7def\n#		#   def\nabc\r#		#   def\nabc\n#
	#a#			##			#a\n#
		- last line always ends with at least one \n (or \E9)
	#1234567 8\n#		#1234567\t8\n#		#1234567 8\n#
		- single space not expanded to tab
     -f #a\E8b\n#		#ab\n#			# b\E9\ra\n#
		- can back up past first line (as far as you want) so you
		  *can* have a super script on the first line
	#\E9_\ba\E8\nb\n#	#\n_\bb\ba\n#		#\n_\ba\bb\n#
		- always print last character written to a position,
		  AT&T col claims to do this but doesn't.

If a character is to be placed on a line that has been flushed, a warning
is produced (the AT&T col is silent).   The -l flag (not in AT&T col) can
be used to increase the number of lines buffered to avoid the problem.

General algorithm: a limited number of lines are buffered in a linked
list.  When a printable character is read, it is put in the buffer of
the current line along with the column it's supposed to be in.  When
a line is flushed, the characters in the line are sorted according to
column and then printed.