BSD 4_3_Reno release
[unix-history] / usr / src / usr.bin / col / col.1
index 0987f75..049252d 100644 (file)
-.\"    @(#)col.1       4.1 (Berkeley) %G%
+.\" Copyright (c) 1990 The Regents of the University of California.
+.\" All rights reserved.
 .\"
 .\"
-.TH COL 1
-.AT 3
-.SH NAME
-col \- filter reverse line feeds
-.SH SYNOPSIS
-.B col [\|\-bfx\|]
-.SH DESCRIPTION
-.I Col
-reads the standard input and writes the standard output.
-It performs the line overlays implied by reverse line
-feeds (ESC-7 in ASCII)
-and by forward and reverse half line feeds (ESC-9 and ESC-8).
-.I Col
-is particularly useful for filtering multicolumn
-output made with the `.rt' command of
-.I nroff
-and output resulting from use of the
-.IR tbl (1)
-preprocessor.
-.PP
-Although
-.I col
-accepts half line motions in its input, it normally does not
-emit them on output.
-Instead, text that would appear between lines is moved to the next lower
-full line boundary.
-This treatment can be suppressed by the
-.B \-f
-(fine) option; in this case
-the output from
-.I col
-may contain forward half line feeds (ESC-9), but will still never contain
-either kind of reverse line motion.
-.PP
-If the
-.B \-b
-option is given,
-.I col
-assumes that the output device in use is not capable of backspacing.
-In this case, if several characters are to appear in the same place,
-only the last one read will be taken.
-.PP
-The control characters SO (ASCII code 017),
-and SI (016) are assumed
-to start and end text in an alternate character set.
-The character set (primary or alternate) associated with each printing
-character read is remembered; on output, SO and SI characters are generated
-where necessary to maintain the correct treatment of each character.
-.PP
-.I Col
-normally converts white space to tabs to shorten printing time.
-If the
-.B \-x
-option is given, this conversion is suppressed.
-.PP
-All control characters are removed from the input except space,
-backspace,
-tab, return, newline, ESC (033) followed by one of 7, 8, 9, SI, SO, and VT
-(013).
-This last character is an alternate form of full reverse line feed, for
-compatibility with some other hardware conventions.
-All other non-printing characters are ignored.
-.SH "SEE ALSO"
-troff(1), tbl(1), greek(1)
-.SH BUGS
-Can't back up more than 128 lines.
-.br
-No more than 800 characters, including backspaces, on a line.
+.\" This code is derived from software contributed to Berkeley by
+.\" Michael Rendell.
+.\"
+.\" Redistribution and use in source and binary forms are permitted provided
+.\" that: (1) source distributions retain this entire copyright notice and
+.\" comment, and (2) distributions including binaries display the following
+.\" acknowledgement:  ``This product includes software developed by the
+.\" University of California, Berkeley and its contributors'' in the
+.\" documentation or other materials provided with the distribution and in
+.\" all advertising materials mentioning features or use of this software.
+.\" Neither the name of the University nor the names of its contributors may
+.\" be used to endorse or promote products derived from this software without
+.\" specific prior written permission.
+.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
+.\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
+.\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
+.\"
+.\"     @(#)col.1      6.6 (Berkeley) 7/24/90
+.\"
+.Dd July 24, 1990
+.Dt COL 1
+.Os BSD 4.4
+.Sh NAME
+.Nm col
+.Nd filter reverse line feeds from input
+.Sh SYNOPSIS
+.Nm col
+.Op Fl bfx
+.Op Fl l Ar num
+.Sh DESCRIPTION
+.Nm Col
+filters out reverse (and half reverse) line feeds so that the output is
+in the correct order and contains only forward and half forward line
+feeds, and replaces white-space characters with tabs where possible.
+This can be useful in processing the output of
+.Xr nroff 1
+and
+.Xr tbl  1 .
+.Pp
+.Nm Col
+reads from standard input and writes to standard output.
+.Pp
+The options are as follows:
+.Tw Fl
+.Tp Fl b
+Do not output any backspaces \- print only the last character
+written to each column position.
+.Tp Fl f
+Forward half line feeds are permitted (``fine'' mode).
+Normally characters printed on a half line boundary are printed
+on the following line.
+.Tp Fl x
+Output multiple spaces instead of tabs.
+.Tp Cx Fl l
+.Cx Ar num
+.Cx
+Buffer at least
+.Ar num
+lines in memory.
+By default, 128 lines are buffered.
+.Tp
+.Pp
+The control sequences for carriage motion that
+.Nm col
+understands and their decimal values are listed in the following
+table:
+.Pp
+.Dw carriage\ return
+.Di L
+.Dp ESC\-7
+reverse line feed (escape then 7)
+.Dp ESC\-8
+half reverse line feed (escape then 8)
+.Dp ESC\-9
+half forward line feed (escape then 9)
+.Dp backspace
+moves back one column (8); ignored in the first column
+.Dp carriage return
+(13)
+.Dp newline
+forward line feed (10); also does carriage return
+.Dp shift in
+shift to normal character set (15)
+.Dp shift out
+shift to alternate character set (14)
+.Dp space
+moves forward one column (32)
+.Dp tab
+moves forward to next tab stop (9)
+.Dp vertical tab
+reverse line feed (11)
+.Dp
+.Pp
+All unrecognized control characters and escape sequences are
+discarded.
+.Pp
+.Nm Col
+keeps track of the character set as characters are read and makes
+sure the character set is correct when they are output.
+.Pp
+If the input attempts to back up to the last flushed line,
+.Nm col
+will display a warning message.
+.Sh SEE ALSO
+.Xr expand 1 ,
+.Xr nroff 1 ,
+.Xr tbl 1
+.Sh HISTORY
+A
+.Nm col
+command
+appeared in Version 6 AT&T UNIX.  The BSD
+.Nm col
+is derived from code written by Michael Rendell.