From owner-svn-src-head@FreeBSD.ORG Sun May 10 11:41:40 2015 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3807E979; Sun, 10 May 2015 11:41:40 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0C1081368; Sun, 10 May 2015 11:41:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t4ABfdlH079881; Sun, 10 May 2015 11:41:39 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t4ABfdRU079879; Sun, 10 May 2015 11:41:39 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201505101141.t4ABfdRU079879@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Sun, 10 May 2015 11:41:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r282722 - head/usr.bin/col X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 10 May 2015 11:41:40 -0000 Author: bapt Date: Sun May 10 11:41:38 2015 New Revision: 282722 URL: https://svnweb.freebsd.org/changeset/base/282722 Log: For half and reverse line feeds, recognize both SUSv2-style escape-digit and BSD-style escape-control-char sequences in the input stream. Submitted by: schwarze at OpenBSD Discussed with: schwarze at OpenBSD Obtained from: OpenBSD Modified: head/usr.bin/col/col.1 head/usr.bin/col/col.c Modified: head/usr.bin/col/col.1 ============================================================================== --- head/usr.bin/col/col.1 Sun May 10 11:24:16 2015 (r282721) +++ head/usr.bin/col/col.1 Sun May 10 11:41:38 2015 (r282722) @@ -31,7 +31,7 @@ .\" @(#)col.1 8.1 (Berkeley) 6/29/93 .\" $FreeBSD$ .\" -.Dd August 4, 2004 +.Dd May 10, 2015 .Dt COL 1 .Os .Sh NAME @@ -82,18 +82,33 @@ recognized and interpreted by itself, wh Output multiple spaces instead of tabs. .El .Pp -The control sequences for carriage motion that +In the input stream, .Nm -understands and their decimal 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 "carriage return" -compact +.It ESC\-BELL +reverse line feed (escape then bell). .It ESC\-7 -reverse line feed (escape then 7) +reverse line feed (escape then 7). +.It ESC\-BACKSPACE +half reverse line feed (escape then backspace). .It ESC\-8 -half reverse line feed (escape then 8) +half reverse line feed (escape then 8). +.It ESC\-TAB +half forward line feed (escape than tab). .It ESC\-9 -half forward line feed (escape then 9) +half forward line feed (escape then 9). +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 Modified: head/usr.bin/col/col.c ============================================================================== --- head/usr.bin/col/col.c Sun May 10 11:24:16 2015 (r282721) +++ head/usr.bin/col/col.c Sun May 10 11:41:38 2015 (r282722) @@ -205,12 +205,23 @@ main(int argc, char **argv) continue; case ESC: /* just ignore EOF */ switch(getwchar()) { + /* + * In the input stream, accept both the + * XPG5 sequences ESC-digit and the + * traditional BSD sequences ESC-ctrl. + */ + case '\007': + /* FALLTHROUGH */ case RLF: addto_lineno(&cur_line, -2); break; + case '\010': + /* FALLTHROUGH */ case RHLF: addto_lineno(&cur_line, -1); break; + case '\011': + /* FALLTHROUGH */ case FHLF: addto_lineno(&cur_line, 1); if (cur_line > max_line)