From owner-freebsd-bugs@FreeBSD.ORG Fri Jul 8 09:20:02 2011 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1B631065675 for ; Fri, 8 Jul 2011 09:20:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id C87778FC16 for ; Fri, 8 Jul 2011 09:20:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.4/8.14.4) with ESMTP id p689K1Gc093680 for ; Fri, 8 Jul 2011 09:20:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.4/8.14.4/Submit) id p689K1qD093679; Fri, 8 Jul 2011 09:20:01 GMT (envelope-from gnats) Resent-Date: Fri, 8 Jul 2011 09:20:01 GMT Resent-Message-Id: <201107080920.p689K1qD093679@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Bela Lubkin Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3A6DB1065673 for ; Fri, 8 Jul 2011 09:19:48 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 10E358FC25 for ; Fri, 8 Jul 2011 09:19:48 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p689JlGK022464 for ; Fri, 8 Jul 2011 09:19:47 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id p689Jlvx022463; Fri, 8 Jul 2011 09:19:47 GMT (envelope-from nobody) Message-Id: <201107080919.p689Jlvx022463@red.freebsd.org> Date: Fri, 8 Jul 2011 09:19:47 GMT From: Bela Lubkin To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: misc/158725: `column -t` always separates columns by 2 chars X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 08 Jul 2011 09:20:02 -0000 >Number: 158725 >Category: misc >Synopsis: `column -t` always separates columns by 2 chars >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri Jul 08 09:20:01 UTC 2011 >Closed-Date: >Last-Modified: >Originator: Bela Lubkin >Release: none >Organization: myself >Environment: Linux albatross 2.6.38-10-generic #46-Ubuntu SMP Tue Jun 28 15:05:41 UTC 2011 i686 i686 i386 GNU/Linux (well, you asked...) >Description: `column -t` always separates columns by 2 chars: $ echo "a b c" | column -t a b c I almost always want 1-space separation. Might as well make this tunable... >How-To-Repeat: Use `column -t` at all. >Fix: Attached patch is against Ubuntu 11.04 "bsdmainutils", which originated in FreeBSD somewhere long ago. Will need at least slight changes to apply to FreeBSD (man page mentions the Debian-added "-n" flag, although usage() does not...) Patch attached with submission follows: ========== diff -U1 usr.bin/column/column.c.orig usr.bin/column/column.c ========== --- usr.bin/column/column.c.orig 2011-07-08 01:29:43.000000000 -0700 +++ usr.bin/column/column.c 2011-07-08 01:43:53.000000000 -0700 @@ -75,2 +75,4 @@ +int between = 2; /* default blanks between columns */ + int entries; /* number of records */ @@ -101,3 +103,3 @@ tflag = xflag = 0; - while ((ch = getopt(argc, argv, "c:s:txn")) != -1) + while ((ch = getopt(argc, argv, "b:c:s:txn")) != -1) switch(ch) { @@ -109,2 +111,7 @@ break; + case 'b': + between = atoi(optarg); + if (between < 1) + errx(1, "`between' must be greater than 0"); + break; case 's': @@ -307,3 +314,3 @@ (void)wprintf(L"%ls%*ls", t->list[coloff] ? t->list[coloff] : L"", - lens[coloff] - t->len[coloff] + 2, L" "); + lens[coloff] - t->len[coloff] + between, L" "); (void)wprintf(L"%ls\n", t->list[coloff] ? t->list[coloff] : L""); @@ -370,3 +377,3 @@ (void)fprintf(stderr, - "usage: column [-tx] [-c columns] [-s sep] [file ...]\n"); + "usage: column [-tx] [-b between] [-c columns] [-s sep] [file ...]\n"); exit(1); ========== diff -U1 usr.bin/column/column.1.orig usr.bin/column/column.1 ========== --- usr.bin/column/column.1.orig 2011-07-08 01:29:43.000000000 -0700 +++ usr.bin/column/column.1 2011-07-08 02:10:43.000000000 -0700 @@ -43,2 +43,3 @@ .Op Fl ntx +.Op Fl b Ar between .Op Fl c Ar columns @@ -58,2 +59,8 @@ .Bl -tag -width indent +.It Fl b +Columns in +.Fl t +output are separated by +.Ar between +space characters (default 2). .It Fl c >Release-Note: >Audit-Trail: >Unformatted: