Annotation of src/usr.bin/col/col.1, Revision 1.13
1.13 ! schwarze 1: .\" $OpenBSD: col.1,v 1.12 2014/10/17 21:10:56 schwarze Exp $
1.1 deraadt 2: .\" $NetBSD: col.1,v 1.4 1995/03/26 05:25:52 glass Exp $
3: .\"
4: .\" Copyright (c) 1990, 1993
5: .\" The Regents of the University of California. All rights reserved.
6: .\"
7: .\" This code is derived from software contributed to Berkeley by
8: .\" Michael Rendell.
9: .\"
10: .\" Redistribution and use in source and binary forms, with or without
11: .\" modification, are permitted provided that the following conditions
12: .\" are met:
13: .\" 1. Redistributions of source code must retain the above copyright
14: .\" notice, this list of conditions and the following disclaimer.
15: .\" 2. Redistributions in binary form must reproduce the above copyright
16: .\" notice, this list of conditions and the following disclaimer in the
17: .\" documentation and/or other materials provided with the distribution.
1.8 millert 18: .\" 3. Neither the name of the University nor the names of its contributors
1.1 deraadt 19: .\" may be used to endorse or promote products derived from this software
20: .\" without specific prior written permission.
21: .\"
22: .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
23: .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24: .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
25: .\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
26: .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27: .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28: .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29: .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30: .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31: .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32: .\" SUCH DAMAGE.
33: .\"
34: .\" @(#)col.1 8.1 (Berkeley) 6/29/93
35: .\"
1.13 ! schwarze 36: .Dd $Mdocdate: October 17 2014 $
1.1 deraadt 37: .Dt COL 1
38: .Os
39: .Sh NAME
40: .Nm col
1.11 jmc 41: .Nd filter reverse line feeds and backspaces from input
1.1 deraadt 42: .Sh SYNOPSIS
43: .Nm col
1.7 aaron 44: .Op Fl bfhx
1.1 deraadt 45: .Op Fl l Ar num
46: .Sh DESCRIPTION
1.4 aaron 47: .Nm
48: filters out reverse (and half-reverse) line feeds so that the output is
49: in the correct order with only forward and half-forward line
50: feeds, and replaces whitespace characters with tabs where possible.
1.1 deraadt 51: .Pp
1.4 aaron 52: .Nm
1.1 deraadt 53: reads from the standard input and writes to the standard output.
54: .Pp
55: The options are as follows:
1.6 aaron 56: .Bl -tag -width Ds
1.1 deraadt 57: .It Fl b
58: Do not output any backspaces, printing only the last character
59: written to each column position.
1.11 jmc 60: This can be useful in processing the output of
61: .Xr mandoc 1 .
1.1 deraadt 62: .It Fl f
1.4 aaron 63: Forward half-line feeds are permitted
64: .Pf ( Ns Dq fine
65: mode).
66: Normally characters printed on a half-line boundary are printed
1.1 deraadt 67: on the following line.
1.7 aaron 68: .It Fl h
69: Compress spaces into tabs.
70: This is the default behavior.
1.1 deraadt 71: .It Fl l Ar num
72: Buffer at least
73: .Ar num
74: lines in memory.
75: By default, 128 lines are buffered.
1.9 jmc 76: .It Fl x
77: Output multiple spaces instead of tabs.
1.1 deraadt 78: .El
79: .Pp
1.13 ! schwarze 80: In the input stream,
1.4 aaron 81: .Nm
1.13 ! schwarze 82: understands both the escape sequences of the form escape-digit
! 83: mandated by
! 84: .St -susv2
! 85: and the traditional
! 86: .Bx
! 87: format escape-control-character.
! 88: The control sequences for carriage motion and their ASCII values
! 89: are as follows:
1.1 deraadt 90: .Pp
1.12 schwarze 91: .Bl -tag -width "escape-backspace" -compact
92: .It escape\-bell
93: Reverse line feed (27 then 7).
1.13 ! schwarze 94: .It escape\-digit\-7
! 95: Reverse line feed (27 then 55).
1.12 schwarze 96: .It escape\-backspace
97: Half reverse line feed (27 then 8).
1.13 ! schwarze 98: .It escape\-digit\-8
! 99: Half reverse line feed (27 then 56).
1.12 schwarze 100: .It escape\-tab
101: Half forward line feed (27 then 9).
1.13 ! schwarze 102: .It escape\-digit\-9
! 103: Half forward line feed (27 then 57).
! 104: In
! 105: .Fl f
! 106: mode, this sequence may also occur in the output stream.
1.1 deraadt 107: .It backspace
1.4 aaron 108: Moves back one column (8); ignored in the first column.
1.1 deraadt 109: .It carriage return
110: (13)
111: .It newline
1.4 aaron 112: Forward line feed (10); also does carriage return.
1.1 deraadt 113: .It shift in
1.4 aaron 114: Shift to normal character set (15).
1.1 deraadt 115: .It shift out
1.4 aaron 116: Shift to alternate character set (14).
1.1 deraadt 117: .It space
1.4 aaron 118: Moves forward one column (32).
1.1 deraadt 119: .It tab
1.4 aaron 120: Moves forward to next tab stop (9).
1.1 deraadt 121: .It vertical tab
1.4 aaron 122: Reverse line feed (11).
1.1 deraadt 123: .El
124: .Pp
125: All unrecognized control characters and escape sequences are
126: discarded.
127: .Pp
1.4 aaron 128: .Nm
1.1 deraadt 129: keeps track of the character set as characters are read and makes
130: sure the character set is correct when they are output.
131: .Pp
132: If the input attempts to back up to the last flushed line,
1.4 aaron 133: .Nm
1.1 deraadt 134: will display a warning message.
135: .Sh SEE ALSO
1.11 jmc 136: .Xr expand 1
1.1 deraadt 137: .Sh HISTORY
138: A
1.4 aaron 139: .Nm
140: command appeared in
1.1 deraadt 141: .At v6 .