-.\" $OpenBSD: col.1,v 1.12 2014/10/17 21:10:56 schwarze Exp $
+.\" $OpenBSD: col.1,v 1.13 2015/05/09 20:36:18 schwarze Exp $
.\" $NetBSD: col.1,v 1.4 1995/03/26 05:25:52 glass Exp $
.\"
.\" Copyright (c) 1990, 1993
.\"
.\" @(#)col.1 8.1 (Berkeley) 6/29/93
.\"
-.Dd $Mdocdate: October 17 2014 $
+.Dd $Mdocdate: May 9 2015 $
.Dt COL 1
.Os
.Sh NAME
Output multiple spaces instead of tabs.
.El
.Pp
-The control sequences for carriage motion that
+In the input stream,
.Nm
-understands and their decimal ASCII values are listed in the following
-table:
+understands both the escape sequences of the form escape-digit
+mandated by
+.St -susv2
+and the traditional
+.Bx
+format escape-control-character.
+The control sequences for carriage motion and their ASCII values
+are as follows:
.Pp
.Bl -tag -width "escape-backspace" -compact
.It escape\-bell
Reverse line feed (27 then 7).
+.It escape\-digit\-7
+Reverse line feed (27 then 55).
.It escape\-backspace
Half reverse line feed (27 then 8).
+.It escape\-digit\-8
+Half reverse line feed (27 then 56).
.It escape\-tab
Half forward line feed (27 then 9).
+.It escape\-digit\-9
+Half forward line feed (27 then 57).
+In
+.Fl f
+mode, this sequence may also occur in the output stream.
.It backspace
Moves back one column (8); ignored in the first column.
.It carriage return
-/* $OpenBSD: col.c,v 1.16 2015/05/08 16:30:07 schwarze Exp $ */
+/* $OpenBSD: col.c,v 1.17 2015/05/09 20:36:18 schwarze Exp $ */
/* $NetBSD: col.c,v 1.7 1995/09/02 05:48:50 jtc Exp $ */
/*-
#define SI '\017' /* shift in to normal character set */
#define SO '\016' /* shift out to alternate character set */
#define VT '\013' /* vertical tab (aka reverse line feed) */
-#define RLF '\007' /* ESC-07 reverse line feed */
-#define RHLF '\010' /* ESC-010 reverse half-line feed */
-#define FHLF '\011' /* ESC-011 forward half-line feed */
/* build up at least this many lines before flushing them out */
#define BUFFER_MARGIN 32
cur_col = 0;
continue;
case ESC: /* just ignore EOF */
+ /*
+ * In the input stream, accept both the
+ * XPG5 sequences ESC-digit and the
+ * traditional BSD sequences ESC-ctrl.
+ */
switch(getchar()) {
- case RLF:
+ case '7': /* reverse line feed */
+ /* FALLTHROUGH */
+ case '\007':
addto_lineno(&cur_line, -2);
break;
- case RHLF:
+ case '8': /* reverse half-line feed */
+ /* FALLTHROUGH */
+ case '\010':
addto_lineno(&cur_line, -1);
break;
- case FHLF:
+ case '9': /* forward half-line feed */
+ /* FALLTHROUGH */
+ case '\011':
addto_lineno(&cur_line, 1);
if (cur_line > max_line)
max_line = cur_line;
for (i = nb; --i >= 0;)
PUTC('\n');
if (half) {
+ /*
+ * In the output stream, always generate
+ * escape sequences conforming to XPG5.
+ */
PUTC(ESC);
- PUTC('\011');
+ PUTC('9');
if (!nb)
PUTC('\r');
}