xref: /dflybsd-src/usr.bin/col/README (revision 86d7f5d305c6adaa56ff4582ece9859d73106103)
186d7f5d3SJohn Marino#	@(#)README	8.1 (Berkeley) 6/6/93
286d7f5d3SJohn Marino#
386d7f5d3SJohn Marino# $FreeBSD: src/usr.bin/col/README,v 1.1.1.1.14.1 2001/08/04 01:27:00 mikeh Exp $
486d7f5d3SJohn Marino# $DragonFly: src/usr.bin/col/README,v 1.2 2003/06/17 04:29:25 dillon Exp $
586d7f5d3SJohn Marino
686d7f5d3SJohn Marinocol - filter out reverse line feeds.
786d7f5d3SJohn Marino
886d7f5d3SJohn MarinoOptions are:
986d7f5d3SJohn Marino	-b	do not print any backspaces (last character written is printed)
1086d7f5d3SJohn Marino	-f	allow half line feeds in output, by default characters between
1186d7f5d3SJohn Marino		lines are pushed to the line below
1286d7f5d3SJohn Marino	-p	force unknown control sequences to be passed through unchanged
1386d7f5d3SJohn Marino	-x	do not compress spaces into tabs.
1486d7f5d3SJohn Marino	-l num	keep (at least) num lines in memory, 128 are kept by default
1586d7f5d3SJohn Marino
1686d7f5d3SJohn MarinoIn the 32V source code to col(1) the default behavior was to NOT compress
1786d7f5d3SJohn Marinospaces into tabs.  There was a -h option which caused it to compress spaces
1886d7f5d3SJohn Marinointo tabs.  There was no -x flag.
1986d7f5d3SJohn Marino
2086d7f5d3SJohn MarinoThe 32V documentation, however, was consistent with the SVID (actually, V7
2186d7f5d3SJohn Marinoat the time) and documented a -x flag (as defined above) while making no
2286d7f5d3SJohn Marinomention of a -h flag.  Just before 4.3BSD went out, CSRG updated the manual
2386d7f5d3SJohn Marinopage to reflect the way the code worked.  Suspecting that this was probably
2486d7f5d3SJohn Marinothe wrong way to go, this version adopts the SVID defaults, and no longer
2586d7f5d3SJohn Marinodocuments the -h option.
2686d7f5d3SJohn Marino
2786d7f5d3SJohn MarinoKnown differences between AT&T's col and this one (# is delimiter):
2886d7f5d3SJohn Marino	Input			AT&T col		this col
2986d7f5d3SJohn Marino	#\nabc\E7def\n#		#   def\nabc\r#		#   def\nabc\n#
3086d7f5d3SJohn Marino	#a#			##			#a\n#
3186d7f5d3SJohn Marino		- last line always ends with at least one \n (or \E9)
3286d7f5d3SJohn Marino	#1234567 8\n#		#1234567\t8\n#		#1234567 8\n#
3386d7f5d3SJohn Marino		- single space not expanded to tab
3486d7f5d3SJohn Marino     -f #a\E8b\n#		#ab\n#			# b\E9\ra\n#
3586d7f5d3SJohn Marino		- can back up past first line (as far as you want) so you
3686d7f5d3SJohn Marino		  *can* have a super script on the first line
3786d7f5d3SJohn Marino	#\E9_\ba\E8\nb\n#	#\n_\bb\ba\n#		#\n_\ba\bb\n#
3886d7f5d3SJohn Marino		- always print last character written to a position,
3986d7f5d3SJohn Marino		  AT&T col claims to do this but doesn't.
4086d7f5d3SJohn Marino
4186d7f5d3SJohn MarinoIf a character is to be placed on a line that has been flushed, a warning
4286d7f5d3SJohn Marinois produced (the AT&T col is silent).   The -l flag (not in AT&T col) can
4386d7f5d3SJohn Marinobe used to increase the number of lines buffered to avoid the problem.
4486d7f5d3SJohn Marino
4586d7f5d3SJohn MarinoGeneral algorithm: a limited number of lines are buffered in a linked
4686d7f5d3SJohn Marinolist.  When a printable character is read, it is put in the buffer of
4786d7f5d3SJohn Marinothe current line along with the column it's supposed to be in.  When
4886d7f5d3SJohn Marinoa line is flushed, the characters in the line are sorted according to
4986d7f5d3SJohn Marinocolumn and then printed.
50