GNU bug report logs - #11044
RFE: fmt goal width

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: coreutils; Severity: wishlist; Reported by: Bruce Korb <bruce.korb@HIDDEN>; Keywords: patch; dated Mon, 19 Mar 2012 19:18:02 UTC; Maintainer for coreutils is bug-coreutils@HIDDEN.
Added tag(s) patch. Request was from Assaf Gordon <assafgordon@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Severity set to 'wishlist' from 'normal' Request was from Assaf Gordon <assafgordon@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 11044 <at> debbugs.gnu.org:


Received: (at 11044) by debbugs.gnu.org; 5 Apr 2012 14:18:09 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 05 10:18:08 2012
Received: from localhost ([127.0.0.1]:41247 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SFnVn-000320-5a
	for submit <at> debbugs.gnu.org; Thu, 05 Apr 2012 10:18:08 -0400
Received: from mail-yx0-f172.google.com ([209.85.213.172]:63666)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <bruce.korb@HIDDEN>) id 1SFnVi-00031P-75
	for 11044 <at> debbugs.gnu.org; Thu, 05 Apr 2012 10:18:05 -0400
Received: by yenm5 with SMTP id m5so663206yen.3
	for <11044 <at> debbugs.gnu.org>; Thu, 05 Apr 2012 07:17:18 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:from:date:message-id:subject:to:cc:content-type;
	bh=63TiIht/RsNahTUrimC4dGzOzr2WGl1K/QzrA+pXIT4=;
	b=rLi0nQJ7EJlHSUWgqGs54SP5j+pxnLGYfWdkwZtYc7Ct2e4vBB8ZWNCGmcOoAIlO0C
	omLW+hvD+kCdPUy9595AGI6VzyQEgnqH7hceAn/XYN2TnU1C2mPcSSfw5SBH/NSoTl2N
	JC/i2qYHfQvgK61DRKnmTg8OvErBPOUzYrY9KHxB9zedDW8uV3H0LPeoxfcQsKzymBL/
	vxbz/rdm49NcVRk8cRvpbsYXAcCvIc3T6Wmx8UUIt8Fa6F+q1i0SiIRm8lR/Igu8EMmH
	16GzvxiiokfBmOLX5uxCePQPx7Y9t//FybEGafLbZggEZ8LQaTO6PmxeonfrF+7cdV2X
	+aTw==
Received: by 10.50.222.202 with SMTP id qo10mr5066819igc.0.1333635437861; Thu,
	05 Apr 2012 07:17:17 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.42.168.131 with HTTP; Thu, 5 Apr 2012 07:16:57 -0700 (PDT)
From: Bruce Korb <bruce.korb@HIDDEN>
Date: Thu, 5 Apr 2012 07:16:57 -0700
Message-ID: <CAKRnqNLMcP75up7o_9LLZUNPJs30M_qqpDoOM+rcQVhFropCQg@HIDDEN>
Subject: Re: bug#11044: only an RFE now (was bug & RFE)
To: Jim Meyering <jim@HIDDEN>
Content-Type: text/plain; charset=ISO-8859-1
X-Spam-Score: -2.6 (--)
X-Debbugs-Envelope-To: 11044
Cc: 11044 <at> debbugs.gnu.org, Eric Blake <eblake@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.6 (--)

Hi Jim,

The bug was the sym link issue on the web site, since corrected.

On Thu, Apr 5, 2012 at 2:22 AM, Jim Meyering <jim@HIDDEN> wrote:
> If no one replies after a few days, it's best to presume
> that your message requires more than casual feedback, and
> that those inclined to provide feedback have not found time.

Sorry.  I was getting antsy because days were becoming weeks.

> The number of conditions in the above description is a red flag.

I didn't really like the maybe-its-a-number-maybe-a-file thingy either.
I did it because someone asked me to make it more BSD compatible.
I chose to then add that compatibility rather than go extra review rounds.
Oh, well.  The number of conditions was to avoid a "fmt 72" problem
when there was a file named "72".  BSD (and Plan9?) is less careful.

> Adding a new goal-specifying option sounds fine,

I'll strip down the patch.

> IMHO, it is best not to emulate such an interface.

Let's not get into vehement agreement on this and just agree to agree.

> - the fmt patch is incomplete (no doc, news, tests)

No news and no tests, but the doc was there.

Cheers - Bruce




Information forwarded to bug-coreutils@HIDDEN:
bug#11044; Package coreutils. Full text available.

Message received at 11044 <at> debbugs.gnu.org:


Received: (at 11044) by debbugs.gnu.org; 5 Apr 2012 09:23:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Apr 05 05:23:19 2012
Received: from localhost ([127.0.0.1]:40670 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SFiuU-00040S-I1
	for submit <at> debbugs.gnu.org; Thu, 05 Apr 2012 05:23:19 -0400
Received: from mx.meyering.net ([88.168.87.75]:38173)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <jim@HIDDEN>) id 1SFiuR-00040J-CP
	for 11044 <at> debbugs.gnu.org; Thu, 05 Apr 2012 05:23:16 -0400
Received: from rho.meyering.net (localhost.localdomain [127.0.0.1])
	by rho.meyering.net (Acme Bit-Twister) with ESMTP id E4DBF600E1;
	Thu,  5 Apr 2012 11:22:41 +0200 (CEST)
From: Jim Meyering <jim@HIDDEN>
To: Bruce Korb <bruce.korb@HIDDEN>
Subject: Re: bug#11044: bug & RFE
In-Reply-To: <4F76278B.2040309@HIDDEN> (Bruce Korb's message of "Fri, 30
	Mar 2012 14:37:15 -0700")
References: <4F677F0F.6090100@HIDDEN> <4F678A2D.4050609@HIDDEN>
	<CAKRnqNLE5akHiZqo42S-3iaXaLW2fM14XH4gs7RfU8Qk648Wyg@HIDDEN>
	<4F6799E0.9020108@HIDDEN>
	<CAKRnqNJd1Mb9mZq2A-o9K=wAv8v9Ej7UL+4KKFziuYn94L217Q@HIDDEN>
	<4F67CA4B.6040603@HIDDEN> <4F76278B.2040309@HIDDEN>
Date: Thu, 05 Apr 2012 11:22:41 +0200
Message-ID: <87obr6ttwe.fsf@HIDDEN>
Lines: 65
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 11044
Cc: 11044 <at> debbugs.gnu.org, Eric Blake <eblake@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

Hi Bruce,

Thanks for the patch.
[your subject also says "bug".
 Is there a bug fix somewhere in this patch? ]

Bruce Korb wrote:
> I guess nobody is listening.

If no one replies after a few days, it's best to presume
that your message requires more than casual feedback, and
that those inclined to provide feedback have not found time.

> BSD's implementation allows a goal specification and has a different
> default goal width computation anyway.  This change adds a "-g" option
> and allows the first two numeric operands to represent the goal width
> and actual line width.
>
> * src/fmt.c (main): implement the new option
> (check_for_goals): new function to implement the operands
> Based on BSD's and Plan-9's fmt programs.

...
> diff --git a/doc/coreutils.texi b/doc/coreutils.texi
> index 835c245..91ca957 100644
> --- a/doc/coreutils.texi
> +++ b/doc/coreutils.texi
> @@ -2133,7 +2133,7 @@ These commands reformat the contents of files.
>  a given number of characters (75 by default).  Synopsis:
>
>  @example
> -fmt [@var{option}]@dots{} [@var{file}]@dots{}
> +fmt [@var{option}]@dots{} [@var{goal} [@var{width}]] [@var{file}]@dots{}
>  @end example
>
>  @command{fmt} reads from the specified @var{file} arguments (or standard
> @@ -2144,6 +2144,13 @@ preserved in the output; successive input lines with different
>  indentation are not joined; tabs are expanded on input and introduced on
>  output.
>
> +@var{goal} and @var{width} are only recognized if neither
> +@var{-g}/@var{--goal} nor @var{-w}/@var{--width} have been specified; and if
> +the strings represent numbers; and if the numbers do not exceed about 2,500;
> +and if these strings do not match existing file names.  If @var{GOAL} is
> +provided but @var{width} not, then @var{width} will be set to @var{goal}
> +plus 10.

The number of conditions in the above description is a red flag.

Adding a new goal-specifying option sounds fine,
but the part that makes fmt interpret the first two arguments
as non-file-names when they happen to be numeric is dubious,
even though it's limited to when those numbers do not name files.
With that, when someone writes "fmt 1" to process their file named 1,
your modified fmt would work fine, but if somehow they run that command
in a directory without that file, fmt would act differently.
The current fmt would complain about "file not found",
while with the proposed change, it would use 1 as the goal-specifying
number and read from stdin.  That seems too surprising.

Putting it another way, with the *BSD version, "fmt 72 72" is equivalent
to "fmt -w72", most of the time.  But when run in a directory containing
a file named 72, it uses that file as input, instead.

IMHO, it is best not to emulate such an interface.




Information forwarded to bug-coreutils@HIDDEN:
bug#11044; Package coreutils. Full text available.

Message received at 11044 <at> debbugs.gnu.org:


Received: (at 11044) by debbugs.gnu.org; 30 Mar 2012 21:37:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 30 17:37:24 2012
Received: from localhost ([127.0.0.1]:59788 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SDjVb-0005LI-Fd
	for submit <at> debbugs.gnu.org; Fri, 30 Mar 2012 17:37:24 -0400
Received: from mail-pb0-f44.google.com ([209.85.160.44]:39126)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <bruce.korb@HIDDEN>) id 1SDjVX-0005L8-OC
	for 11044 <at> debbugs.gnu.org; Fri, 30 Mar 2012 17:37:21 -0400
Received: by pbbrq13 with SMTP id rq13so2102733pbb.3
	for <11044 <at> debbugs.gnu.org>; Fri, 30 Mar 2012 14:37:17 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=message-id:date:from:user-agent:mime-version:to:cc:subject
	:references:in-reply-to:content-type:content-transfer-encoding;
	bh=OklCo4hB1f1A4vsfovd5nB/ngCaSgKCRbLrTiHsAFJo=;
	b=vknsjExRBWgBkYLt+QpZ8o/tG5//dW6y7Ndgtjx2UjrJJIzKYpOOAIm1n42RoBbYlN
	lOC4ka8UBVaTxswAaLS92se132XdGABj/3T/pG59PKZmXiGqLAGH7vLxGAqATchpNAJ5
	bXtHv5SLksUaeHFuCjp2sNAWRXxMhbQ8jjXy1jOSOqFHluxhr+MVXNu49IuoDGAR23Mb
	Pz9897Xj03AX8z7UbGt7LFhR7S0cqc2vOd6wfcfzkRSFPLSO350TSK4w87SIgSK0bDPy
	D19aYisnaekcn5xEwZsTv90vCWo2f2+MHv36towEVHlyKnjDMWIZFl1CP3JCxTbcUc4F
	yWig==
Received: by 10.68.216.35 with SMTP id on3mr519245pbc.150.1333143437750;
	Fri, 30 Mar 2012 14:37:17 -0700 (PDT)
Received: from [192.168.10.2] ([75.0.182.150])
	by mx.google.com with ESMTPS id f2sm8175532pbr.16.2012.03.30.14.37.16
	(version=TLSv1/SSLv3 cipher=OTHER);
	Fri, 30 Mar 2012 14:37:17 -0700 (PDT)
Message-ID: <4F76278B.2040309@HIDDEN>
Date: Fri, 30 Mar 2012 14:37:15 -0700
From: Bruce Korb <bruce.korb@HIDDEN>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:11.0) Gecko/20120312 Thunderbird/11.0
MIME-Version: 1.0
To: Eric Blake <eblake@HIDDEN>
Subject: Re: bug#11044: bug & RFE
References: <4F677F0F.6090100@HIDDEN> <4F678A2D.4050609@HIDDEN>
	<CAKRnqNLE5akHiZqo42S-3iaXaLW2fM14XH4gs7RfU8Qk648Wyg@HIDDEN>
	<4F6799E0.9020108@HIDDEN>
	<CAKRnqNJd1Mb9mZq2A-o9K=wAv8v9Ej7UL+4KKFziuYn94L217Q@HIDDEN>
	<4F67CA4B.6040603@HIDDEN>
In-Reply-To: <4F67CA4B.6040603@HIDDEN>
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.6 (--)
X-Debbugs-Envelope-To: 11044
Cc: 11044 <at> debbugs.gnu.org, Bruce Korb <bruce.korb@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.6 (--)

Hi Eric,

I guess nobody is listening.

BSD's implementation allows a goal specification and has a different
default goal width computation anyway.  This change adds a "-g" option
and allows the first two numeric operands to represent the goal width
and actual line width.

* src/fmt.c (main): implement the new option
(check_for_goals): new function to implement the operands
Based on BSD's and Plan-9's fmt programs.
---
  THANKS.in          |    3 ++
  doc/coreutils.texi |   23 +++++++++++--
  src/fmt.c          |   88 +++++++++++++++++++++++++++++++++++++++++++++++++--
  3 files changed, 106 insertions(+), 8 deletions(-)

diff --git a/THANKS.in b/THANKS.in
index d23f7b3..9a525c4 100644
--- a/THANKS.in
+++ b/THANKS.in
@@ -97,6 +99,7 @@ Brian M. Carlson                    sandals@HIDDEN
  Brian Silverman                     bsilverman@HIDDEN
  Brian Youmans                       3diff@HIDDEN
  Britton Leo Kerin                   fsblk@HIDDEN
+Bruce Korb                          bkorb@HIDDEN
  Bruce Robertson                     brucer@HIDDEN
  Carl Johnson                        carlj@HIDDEN
  Carl Lowenstein                     cdl@HIDDEN
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 835c245..91ca957 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -2133,7 +2133,7 @@ These commands reformat the contents of files.
  a given number of characters (75 by default).  Synopsis:

  @example
-fmt [@var{option}]@dots{} [@var{file}]@dots{}
+fmt [@var{option}]@dots{} [@var{goal} [@var{width}]] [@var{file}]@dots{}
  @end example

  @command{fmt} reads from the specified @var{file} arguments (or standard
@@ -2144,6 +2144,13 @@ preserved in the output; successive input lines with different
  indentation are not joined; tabs are expanded on input and introduced on
  output.

+@var{goal} and @var{width} are only recognized if neither
+@var{-g}/@var{--goal} nor @var{-w}/@var{--width} have been specified; and if
+the strings represent numbers; and if the numbers do not exceed about 2,500;
+and if these strings do not match existing file names.  If @var{GOAL} is
+provided but @var{width} not, then @var{width} will be set to @var{goal}
+plus 10.
+
  @cindex line-breaking
  @cindex sentences and line-breaking
  @cindex Knuth, Donald E.
@@ -2203,9 +2210,17 @@ between sentences to two spaces.
  @opindex -@var{width}
  @opindex -w
  @opindex --width
-Fill output lines up to @var{width} characters (default 75).  @command{fmt}
-initially tries to make lines about 7% shorter than this, to give it
-room to balance line lengths.
+Fill output lines up to @var{width} characters (default 75 or @var{goal} plus 10,
+if @var{goal} is provided).
+
+@item -@var{goal}
+@itemx -g @var{goal}
+@itemx --goal=@var{goal}
+@opindex -@var{goal}
+@opindex -g
+@opindex --goal
+@command{fmt} initially tries to make lines @var{goal} characters wide.
+By default, this is 7% shorter than @var{width}.

  @item -p @var{prefix}
  @itemx --prefix=@var{prefix}
diff --git a/src/fmt.c b/src/fmt.c
index 89d13a6..95ae149 100644
--- a/src/fmt.c
+++ b/src/fmt.c
@@ -68,7 +68,7 @@ typedef long int COST;
  #define SQR(n)        ((n) * (n))
  #define EQUIV(n)    SQR ((COST) (n))

-/* Cost of a filled line n chars longer or shorter than best_width.  */
+/* Cost of a filled line n chars longer or shorter than goal_width.  */
  #define SHORT_COST(n)    EQUIV ((n) * 10)

  /* Cost of the difference between adjacent filled lines.  */
@@ -167,6 +167,7 @@ static void put_paragraph (WORD *finish);
  static void put_line (WORD *w, int indent);
  static void put_word (WORD *w);
  static void put_space (int space);
+static void check_for_goals (char ** argv);

  /* Option values.  */

@@ -201,7 +202,7 @@ static int prefix_lead_space;
  static int prefix_length;

  /* The preferred width of text lines, set to LEEWAY % less than max_width.  */
-static int best_width;
+static int goal_width;

  /* Dynamic variables.  */

@@ -286,6 +287,7 @@ Mandatory arguments to long options are mandatory for short options too.\n\
    -t, --tagged-paragraph    indentation of first line different from second\n\
    -u, --uniform-spacing     one space between words, two after sentences\n\
    -w, --width=WIDTH         maximum line width (default of 75 columns)\n\
+  -g, --goal=WIDTH          goal width (default of 93% of width)\n\
  "), stdout);
        fputs (HELP_OPTION_DESCRIPTION, stdout);
        fputs (VERSION_OPTION_DESCRIPTION, stdout);
@@ -308,6 +310,7 @@ static struct option const long_options[] =
    {"tagged-paragraph", no_argument, NULL, 't'},
    {"uniform-spacing", no_argument, NULL, 'u'},
    {"width", required_argument, NULL, 'w'},
+  {"goal", required_argument, NULL, 'g'},
    {GETOPT_HELP_OPTION_DECL},
    {GETOPT_VERSION_OPTION_DECL},
    {NULL, 0, NULL, 0},
@@ -319,6 +322,7 @@ main (int argc, char **argv)
    int optchar;
    bool ok = true;
    char const *max_width_option = NULL;
+  char const *goal_width_option = NULL;

    initialize_main (&argc, &argv);
    set_program_name (argv[0]);
@@ -376,6 +380,10 @@ main (int argc, char **argv)
          max_width_option = optarg;
          break;

+      case 'g':
+        goal_width_option = optarg;
+        break;
+
        case 'p':
          set_prefix (optarg);
          break;
@@ -398,7 +406,25 @@ main (int argc, char **argv)
        max_width = tmp;
      }

-  best_width = max_width * (2 * (100 - LEEWAY) + 1) / 200;
+  if (goal_width_option)
+    {
+      /* Limit goal_width to max_width.  */
+      unsigned long int tmp;
+      if (! (xstrtoul (goal_width_option, NULL, 10, &tmp, "") == LONGINT_OK
+             && tmp <= max_width))
+        error (EXIT_FAILURE, 0, _("invalid width: %s"),
+               quote (goal_width_option));
+      goal_width = tmp;
+      if (max_width_option == NULL)
+        max_width = goal_width + 10;
+    }
+  else
+    {
+      goal_width = max_width * (2 * (100 - LEEWAY) + 1) / 200;
+    }
+
+  if ((max_width_option == NULL) && (goal_width_option == NULL))
+    check_for_goals (argv);

    if (optind == argc)
      fmt (stdin);
@@ -435,6 +461,53 @@ main (int argc, char **argv)
    exit (ok ? EXIT_SUCCESS : EXIT_FAILURE);
  }

+/* Check the first two operands for being numbers without a file by that name.
+   If there are no such files and the numbers are not too big, then accept
+   them as -g and -w options, respectively.  */
+
+static void
+check_for_goals (char ** argv)
+{
+  unsigned long v;
+
+  /* see if the first operand is a number.  That means there is no file
+     by that name and the operand fully translates to a number.  */
+  char * num = argv[optind];
+  if ((num == NULL) || access (num, R_OK))
+    return;
+  errno = 0;
+  v = strtoul (num, &num, 0);
+  if ((errno == 0) && (*num == '\0') && (v > 0) && (v < MAXCHARS/2))
+    goal_width = v;
+  else
+    return;
+  optind++;
+
+  /* see if the second operand is a number.  That means there is no file
+     by that name and the operand fully translates to a number.  */
+  num = argv[optind];
+  if ((num == NULL) || access (num, R_OK))
+    {
+      max_width = goal_width + 10;
+      return;
+    }
+  errno = 0;
+  v = strtoul (num, &num, 0);
+  if ((errno == 0) && (*num == '\0') && (v > 0) && (v < MAXCHARS/2))
+    {
+      max_width = v;
+      if (goal_width > max_width)
+        error (EXIT_FAILURE, 0, _("goal exceeds width:  %u > %u"),
+               goal_width, max_width);
+    }
+  else
+    {
+      max_width = goal_width + 10;
+      return;
+    }
+  optind++;
+}
+
  /* Trim space from the front and back of the string P, yielding the prefix,
     and record the lengths of the prefix and the space trimmed.  */

@@ -924,7 +997,7 @@ line_cost (WORD *next, int len)

    if (next == word_limit)
      return 0;
-  n = best_width - len;
+  n = goal_width - len;
    cost = SHORT_COST (n);
    if (next->next_break != word_limit)
      {
@@ -1010,3 +1083,10 @@ put_space (int space)
        out_column++;
      }
  }
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "gnu"
+ * indent-tabs-mode: nil
+ * End:
+ * end of fmt.c */
-- 
1.7.7




Information forwarded to bug-coreutils@HIDDEN:
bug#11044; Package coreutils. Full text available.

Message received at 11044 <at> debbugs.gnu.org:


Received: (at 11044) by debbugs.gnu.org; 30 Mar 2012 00:13:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 29 20:13:39 2012
Received: from localhost ([127.0.0.1]:45552 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1SDPTG-0002dC-Kc
	for submit <at> debbugs.gnu.org; Thu, 29 Mar 2012 20:13:39 -0400
Received: from mail-pb0-f44.google.com ([209.85.160.44]:35713)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <bruce.korb@HIDDEN>) id 1SDPSl-0002ca-Mf
	for 11044 <at> debbugs.gnu.org; Thu, 29 Mar 2012 20:13:37 -0400
Received: by pbbrq13 with SMTP id rq13so736950pbb.3
	for <11044 <at> debbugs.gnu.org>; Thu, 29 Mar 2012 16:41:37 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=sender:message-id:date:from:reply-to:organization:user-agent
	:mime-version:to:cc:subject:references:in-reply-to
	:x-forwarded-message-id:content-type:content-transfer-encoding;
	bh=o51DBEMCZp80MCAgRHJiMBVNG3OSznZXEOZVFNONjOo=;
	b=DnZuvewrR1vT/Nw7SywusToXQ/HIyDis5UKR0VyZML3/Hklc8D3EqZnOgwx98e9yRe
	F9bekpSd37FKah4qArt5ZeSlzB99P/0aCLqwaclrsXQQObqXewt7wLPzB9QEPwsPANZu
	pLz3G+g2668wZuesP9+RGHdZwmZwbw2Z9JJvnBJ7QJbUcFudqGy3ytr1/GWvYB9Vo+Q1
	ZfGN2BXlK56crPPOWFG6xKqrh7iaJn1feKLVV1qEk8RZ1oXsgPBCgSHHrtX7n6tGw2MQ
	RApVDa90H+XGczlACdjgepUMK1SxfF9igohSxOqkz02C3rI/gK5w/zR+kZiunfJALP7x
	flTg==
Received: by 10.68.190.42 with SMTP id gn10mr4171256pbc.94.1333064497561;
	Thu, 29 Mar 2012 16:41:37 -0700 (PDT)
Received: from [192.168.10.2] ([75.0.182.150])
	by mx.google.com with ESMTPS id m5sm5981232pbk.64.2012.03.29.16.41.36
	(version=TLSv1/SSLv3 cipher=OTHER);
	Thu, 29 Mar 2012 16:41:36 -0700 (PDT)
Message-ID: <4F74F32F.4080708@HIDDEN>
Date: Thu, 29 Mar 2012 16:41:35 -0700
From: Bruce Korb <bkorb@HIDDEN>
Organization: FSF
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:11.0) Gecko/20120312 Thunderbird/11.0
MIME-Version: 1.0
To: coreutils@HIDDEN
Subject: Fwd: [PATCH] fmt: optionalize line width goal
References: <4F68A271.6030101@HIDDEN>
In-Reply-To: <4F68A271.6030101@HIDDEN>
X-Forwarded-Message-Id: <4F68A271.6030101@HIDDEN>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -1.9 (-)
X-Debbugs-Envelope-To: 11044
Cc: 11044 <at> debbugs.gnu.org, Eric Blake <eblake@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
Reply-To: bkorb@HIDDEN
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -1.9 (-)

PING ????

-------- Original Message --------
Subject: [PATCH] fmt: optionalize line width goal
Date: Tue, 20 Mar 2012 08:29:53 -0700

BSD's implementation allows a goal specification and has a different
default goal width computation anyway.  This change adds a "-g" option
and allows the first two numeric operands to represent the goal width
and actual line width.

* src/fmt.c (main): implement the new option
(check_for_goals): new function to implement the operands
Based on BSD's and Plan-9's fmt programs.
---
  THANKS.in          |    3 ++
  doc/coreutils.texi |   23 +++++++++++--
  src/fmt.c          |   88 +++++++++++++++++++++++++++++++++++++++++++++++++--
  3 files changed, 106 insertions(+), 8 deletions(-)

diff --git a/THANKS.in b/THANKS.in
index d23f7b3..9a525c4 100644
--- a/THANKS.in
+++ b/THANKS.in
@@ -11,6 +11,8 @@ note to the bug-report mailing list (as seen at end of e.g., cp --help).
  ## is used to generate the THANKS file.  Note that numerous people listed
  ## here would have been listed as commit authors if we had been using git
  ## for version control when they contributed.
+##
+## Well, not completely true.  It misses sometimes.

  ???                                 kytek@HIDDEN
  A Costa                             agcosta@HIDDEN
@@ -97,6 +99,7 @@ Brian M. Carlson                    sandals@HIDDEN
  Brian Silverman                     bsilverman@HIDDEN
  Brian Youmans                       3diff@HIDDEN
  Britton Leo Kerin                   fsblk@HIDDEN
+Bruce Korb                          bkorb@HIDDEN
  Bruce Robertson                     brucer@HIDDEN
  Carl Johnson                        carlj@HIDDEN
  Carl Lowenstein                     cdl@HIDDEN
diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 835c245..91ca957 100644
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -2133,7 +2133,7 @@ These commands reformat the contents of files.
  a given number of characters (75 by default).  Synopsis:

  @example
-fmt [@var{option}]@dots{} [@var{file}]@dots{}
+fmt [@var{option}]@dots{} [@var{goal} [@var{width}]] [@var{file}]@dots{}
  @end example

  @command{fmt} reads from the specified @var{file} arguments (or standard
@@ -2144,6 +2144,13 @@ preserved in the output; successive input lines with different
  indentation are not joined; tabs are expanded on input and introduced on
  output.

+@var{goal} and @var{width} are only recognized if neither
+@var{-g}/@var{--goal} nor @var{-w}/@var{--width} have been specified; and if
+the strings represent numbers; and if the numbers do not exceed about 2,500;
+and if these strings do not match existing file names.  If @var{GOAL} is
+provided but @var{width} not, then @var{width} will be set to @var{goal}
+plus 10.
+
  @cindex line-breaking
  @cindex sentences and line-breaking
  @cindex Knuth, Donald E.
@@ -2203,9 +2210,17 @@ between sentences to two spaces.
  @opindex -@var{width}
  @opindex -w
  @opindex --width
-Fill output lines up to @var{width} characters (default 75).  @command{fmt}
-initially tries to make lines about 7% shorter than this, to give it
-room to balance line lengths.
+Fill output lines up to @var{width} characters (default 75 or @var{goal} plus 10,
+if @var{goal} is provided).
+
+@item -@var{goal}
+@itemx -g @var{goal}
+@itemx --goal=@var{goal}
+@opindex -@var{goal}
+@opindex -g
+@opindex --goal
+@command{fmt} initially tries to make lines @var{goal} characters wide.
+By default, this is 7% shorter than @var{width}.

  @item -p @var{prefix}
  @itemx --prefix=@var{prefix}
diff --git a/src/fmt.c b/src/fmt.c
index 89d13a6..95ae149 100644
--- a/src/fmt.c
+++ b/src/fmt.c
@@ -68,7 +68,7 @@ typedef long int COST;
  #define SQR(n)		((n) * (n))
  #define EQUIV(n)	SQR ((COST) (n))

-/* Cost of a filled line n chars longer or shorter than best_width.  */
+/* Cost of a filled line n chars longer or shorter than goal_width.  */
  #define SHORT_COST(n)	EQUIV ((n) * 10)

  /* Cost of the difference between adjacent filled lines.  */
@@ -167,6 +167,7 @@ static void put_paragraph (WORD *finish);
  static void put_line (WORD *w, int indent);
  static void put_word (WORD *w);
  static void put_space (int space);
+static void check_for_goals (char ** argv);

  /* Option values.  */

@@ -201,7 +202,7 @@ static int prefix_lead_space;
  static int prefix_length;

  /* The preferred width of text lines, set to LEEWAY % less than max_width.  */
-static int best_width;
+static int goal_width;

  /* Dynamic variables.  */

@@ -286,6 +287,7 @@ Mandatory arguments to long options are mandatory for short options too.\n\
    -t, --tagged-paragraph    indentation of first line different from second\n\
    -u, --uniform-spacing     one space between words, two after sentences\n\
    -w, --width=WIDTH         maximum line width (default of 75 columns)\n\
+  -g, --goal=WIDTH          goal width (default of 93% of width)\n\
  "), stdout);
        fputs (HELP_OPTION_DESCRIPTION, stdout);
        fputs (VERSION_OPTION_DESCRIPTION, stdout);
@@ -308,6 +310,7 @@ static struct option const long_options[] =
    {"tagged-paragraph", no_argument, NULL, 't'},
    {"uniform-spacing", no_argument, NULL, 'u'},
    {"width", required_argument, NULL, 'w'},
+  {"goal", required_argument, NULL, 'g'},
    {GETOPT_HELP_OPTION_DECL},
    {GETOPT_VERSION_OPTION_DECL},
    {NULL, 0, NULL, 0},
@@ -319,6 +322,7 @@ main (int argc, char **argv)
    int optchar;
    bool ok = true;
    char const *max_width_option = NULL;
+  char const *goal_width_option = NULL;

    initialize_main (&argc, &argv);
    set_program_name (argv[0]);
@@ -376,6 +380,10 @@ main (int argc, char **argv)
          max_width_option = optarg;
          break;

+      case 'g':
+        goal_width_option = optarg;
+        break;
+
        case 'p':
          set_prefix (optarg);
          break;
@@ -398,7 +406,25 @@ main (int argc, char **argv)
        max_width = tmp;
      }

-  best_width = max_width * (2 * (100 - LEEWAY) + 1) / 200;
+  if (goal_width_option)
+    {
+      /* Limit goal_width to max_width.  */
+      unsigned long int tmp;
+      if (! (xstrtoul (goal_width_option, NULL, 10, &tmp, "") == LONGINT_OK
+             && tmp <= max_width))
+        error (EXIT_FAILURE, 0, _("invalid width: %s"),
+               quote (goal_width_option));
+      goal_width = tmp;
+      if (max_width_option == NULL)
+        max_width = goal_width + 10;
+    }
+  else
+    {
+      goal_width = max_width * (2 * (100 - LEEWAY) + 1) / 200;
+    }
+
+  if ((max_width_option == NULL) && (goal_width_option == NULL))
+    check_for_goals (argv);

    if (optind == argc)
      fmt (stdin);
@@ -435,6 +461,53 @@ main (int argc, char **argv)
    exit (ok ? EXIT_SUCCESS : EXIT_FAILURE);
  }

+/* Check the first two operands for being numbers without a file by that name.
+   If there are no such files and the numbers are not too big, then accept
+   them as -g and -w options, respectively.  */
+
+static void
+check_for_goals (char ** argv)
+{
+  unsigned long v;
+
+  /* see if the first operand is a number.  That means there is no file
+     by that name and the operand fully translates to a number.  */
+  char * num = argv[optind];
+  if ((num == NULL) || access (num, R_OK))
+    return;
+  errno = 0;
+  v = strtoul (num, &num, 0);
+  if ((errno == 0) && (*num == '\0') && (v > 0) && (v < MAXCHARS/2))
+    goal_width = v;
+  else
+    return;
+  optind++;
+
+  /* see if the second operand is a number.  That means there is no file
+     by that name and the operand fully translates to a number.  */
+  num = argv[optind];
+  if ((num == NULL) || access (num, R_OK))
+    {
+      max_width = goal_width + 10;
+      return;
+    }
+  errno = 0;
+  v = strtoul (num, &num, 0);
+  if ((errno == 0) && (*num == '\0') && (v > 0) && (v < MAXCHARS/2))
+    {
+      max_width = v;
+      if (goal_width > max_width)
+        error (EXIT_FAILURE, 0, _("goal exceeds width:  %u > %u"),
+               goal_width, max_width);
+    }
+  else
+    {
+      max_width = goal_width + 10;
+      return;
+    }
+  optind++;
+}
+
  /* Trim space from the front and back of the string P, yielding the prefix,
     and record the lengths of the prefix and the space trimmed.  */

@@ -924,7 +997,7 @@ line_cost (WORD *next, int len)

    if (next == word_limit)
      return 0;
-  n = best_width - len;
+  n = goal_width - len;
    cost = SHORT_COST (n);
    if (next->next_break != word_limit)
      {
@@ -1010,3 +1083,10 @@ put_space (int space)
        out_column++;
      }
  }
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "gnu"
+ * indent-tabs-mode: nil
+ * End:
+ * end of fmt.c */
-- 
1.7.7





Information forwarded to bug-coreutils@HIDDEN:
bug#11044; Package coreutils. Full text available.

Message received at 11044 <at> debbugs.gnu.org:


Received: (at 11044) by debbugs.gnu.org; 20 Mar 2012 00:38:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 19 20:38:19 2012
Received: from localhost ([127.0.0.1]:57455 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1S9n5e-00070U-4J
	for submit <at> debbugs.gnu.org; Mon, 19 Mar 2012 20:38:19 -0400
Received: from mail-pz0-f44.google.com ([209.85.210.44]:55768)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <bruce.korb@HIDDEN>) id 1S9n5b-00070M-GL
	for 11044 <at> debbugs.gnu.org; Mon, 19 Mar 2012 20:38:16 -0400
Received: by dakl33 with SMTP id l33so10390460dak.3
	for <11044 <at> debbugs.gnu.org>; Mon, 19 Mar 2012 17:07:41 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=message-id:date:from:user-agent:mime-version:to:cc:subject
	:references:in-reply-to:content-type:content-transfer-encoding;
	bh=NQxk565wGIeB1fDzhSD55SBfvCp/JoCbW3Bjuw1gvJs=;
	b=gpW/f5QRSwCI9mrMI/8B6yjyPCIyWFoNJMdM/g9D5IiCy35d5UL2dpFEIY/H5lhKGJ
	lnLiFG6oJh1+j+Y0qs7lPiADrAICzUPW9/F7PoeORtyeOoFxC8z569bcGqxVGf9zb2iO
	W6GzlndmNhwBAumu1glEfkfYeTGdihUBq5wJ1PeEPemTbpGslcNNyVP2xsUAE8xRksfk
	QUasxxxv76p5gz9Jo5P+Y3ZGEbu/VpBBBySKbknjDHP8hbitc52XipCTlG4GhMqYV1NT
	5uJBNP7/4MaoXpYcOlG83afeibcyjRx3/gAdN2RRhLKnrF+R2mYJuY7ftXd4pWSkQdp/
	36mQ==
Received: by 10.68.225.39 with SMTP id rh7mr43645347pbc.104.1332202061923;
	Mon, 19 Mar 2012 17:07:41 -0700 (PDT)
Received: from [192.168.10.2] ([75.0.186.155])
	by mx.google.com with ESMTPS id f6sm12373661pbt.4.2012.03.19.17.07.40
	(version=TLSv1/SSLv3 cipher=OTHER);
	Mon, 19 Mar 2012 17:07:41 -0700 (PDT)
Message-ID: <4F67CA4B.6040603@HIDDEN>
Date: Mon, 19 Mar 2012 17:07:39 -0700
From: Bruce Korb <bruce.korb@HIDDEN>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:10.0.2) Gecko/20120215 Thunderbird/10.0.2
MIME-Version: 1.0
To: Eric Blake <eblake@HIDDEN>
Subject: Re: bug#11044: bug & RFE
References: <4F677F0F.6090100@HIDDEN> <4F678A2D.4050609@HIDDEN>
	<CAKRnqNLE5akHiZqo42S-3iaXaLW2fM14XH4gs7RfU8Qk648Wyg@HIDDEN>
	<4F6799E0.9020108@HIDDEN>
	<CAKRnqNJd1Mb9mZq2A-o9K=wAv8v9Ej7UL+4KKFziuYn94L217Q@HIDDEN>
In-Reply-To: <CAKRnqNJd1Mb9mZq2A-o9K=wAv8v9Ej7UL+4KKFziuYn94L217Q@HIDDEN>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -2.6 (--)
X-Debbugs-Envelope-To: 11044
Cc: 11044 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.6 (--)

The "T" crossings and "I" dottings ... I did the icky thing anyway.


diff --git a/doc/coreutils.texi b/doc/coreutils.texi
index 835c245..a9dabc4
--- a/doc/coreutils.texi
+++ b/doc/coreutils.texi
@@ -2133,7 +2133,7 @@ These commands reformat the contents of files.
  a given number of characters (75 by default).  Synopsis:

  @example
-fmt [@var{option}]@dots{} [@var{file}]@dots{}
+fmt [@var{option}]@dots{} [@var{goal} [@var{width}]] [@var{file}]@dots{}
  @end example

  @command{fmt} reads from the specified @var{file} arguments (or standard
@@ -2144,6 +2144,13 @@ preserved in the output; successive input lines with different
  indentation are not joined; tabs are expanded on input and introduced on
  output.

+@var{goal} and @var{width} are only recognized if neither
+@var{-g}/@var{--goal} nor @var{-w}/@var{--width} have been specified; and if
+the strings represent numbers; and if the numbers do not exceed about 2,500;
+and if these strings do not match existing file names.  If @var{goal} is
+provided but @var{width} not, then @var{width} will be set to @var{goal}
+plus 10.
+
  @cindex line-breaking
  @cindex sentences and line-breaking
  @cindex Knuth, Donald E.
@@ -2203,9 +2210,16 @@ between sentences to two spaces.
  @opindex -@var{width}
  @opindex -w
  @opindex --width
-Fill output lines up to @var{width} characters (default 75).  @command{fmt}
-initially tries to make lines about 7% shorter than this, to give it
-room to balance line lengths.
+Fill output lines up to @var{width} characters (default 75).
+
+@item -@var{goal}
+@itemx -g @var{goal}
+@itemx --goal=@var{goal}
+@opindex -@var{goal}
+@opindex -g
+@opindex --goal
+@command{fmt} initially tries to make lines @var{goal} characters wide.
+By default, this is 7% shorter than @var{width}.

  @item -p @var{prefix}
  @itemx --prefix=@var{prefix}




Information forwarded to bug-coreutils@HIDDEN:
bug#11044; Package coreutils. Full text available.

Message received at 11044 <at> debbugs.gnu.org:


Received: (at 11044) by debbugs.gnu.org; 19 Mar 2012 23:36:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 19 19:36:41 2012
Received: from localhost ([127.0.0.1]:57419 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1S9m7z-0005SM-UE
	for submit <at> debbugs.gnu.org; Mon, 19 Mar 2012 19:36:41 -0400
Received: from mail-pz0-f44.google.com ([209.85.210.44]:65266)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <bruce.korb@HIDDEN>) id 1S9m7n-0005S3-Er
	for 11044 <at> debbugs.gnu.org; Mon, 19 Mar 2012 19:36:38 -0400
Received: by dakl33 with SMTP id l33so10335189dak.3
	for <11044 <at> debbugs.gnu.org>; Mon, 19 Mar 2012 16:05:53 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=message-id:date:from:user-agent:mime-version:to:subject
	:content-type; bh=Uk/9E3D71ZEzqDP1IgJgrNLNNDnX9uZ2ry9b8jI1DnA=;
	b=U8eUf0DWmJkxxrAjx4tBpnGKQxGMZZO6Pb9l3kiufdUXNoJFdG+A3GSXv7rlslnqKm
	iZn6D36sMKAXVEYi69Dh3igQpSqD9pXwJxSdIpWYYaeT2sjA70s2zUsbYPnG98F8AGWP
	bEAzKt4JNQR0qRFcOv27QsLfF4qU4KXCC+XUsi6hbOnpfK73RYDdUh2U+05gdPRDk73g
	U1IrXe2/vpkjOsG8KrKy7unZOjALFfPsv5HX0VF5HjXYQMQNUGbWYiSn7k8ZQEIqana5
	uteblnIZU45xWEWlH3YfqEqFY7zcfeOivGMu/k5Aa2XACcFytLwHMQ3lDp+K5xfu5+no
	ilhg==
Received: by 10.68.225.39 with SMTP id rh7mr43323906pbc.104.1332198353861;
	Mon, 19 Mar 2012 16:05:53 -0700 (PDT)
Received: from [192.168.10.2] ([75.0.186.155])
	by mx.google.com with ESMTPS id o2sm12275315pbd.6.2012.03.19.16.05.52
	(version=TLSv1/SSLv3 cipher=OTHER);
	Mon, 19 Mar 2012 16:05:53 -0700 (PDT)
Message-ID: <4F67BBCF.4040704@HIDDEN>
Date: Mon, 19 Mar 2012 16:05:51 -0700
From: Bruce Korb <bruce.korb@HIDDEN>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:10.0.2) Gecko/20120215 Thunderbird/10.0.2
MIME-Version: 1.0
To: 11044 <at> debbugs.gnu.org, Eric Blake <eblake@HIDDEN>, coreutils@HIDDEN
Subject: RFE: -g <goal> for fmt(1) command
Content-Type: multipart/mixed; boundary="------------000904010405030900000807"
X-Spam-Score: -2.6 (--)
X-Debbugs-Envelope-To: 11044
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.6 (--)

This is a multi-part message in MIME format.
--------------000904010405030900000807
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit


--------------000904010405030900000807
Content-Type: text/x-patch;
 name="9999-current.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="9999-current.diff"

diff --git a/src/fmt.c b/src/fmt.c
index 89d13a6..68d95f1
--- a/src/fmt.c
+++ b/src/fmt.c
@@ -68,7 +68,7 @@ typedef long int COST;
 #define SQR(n)		((n) * (n))
 #define EQUIV(n)	SQR ((COST) (n))
 
-/* Cost of a filled line n chars longer or shorter than best_width.  */
+/* Cost of a filled line n chars longer or shorter than goal_width.  */
 #define SHORT_COST(n)	EQUIV ((n) * 10)
 
 /* Cost of the difference between adjacent filled lines.  */
@@ -167,6 +167,7 @@ static void put_paragraph (WORD *finish);
 static void put_line (WORD *w, int indent);
 static void put_word (WORD *w);
 static void put_space (int space);
+static void check_for_goals (char ** argv);
 
 /* Option values.  */
 
@@ -201,7 +202,7 @@ static int prefix_lead_space;
 static int prefix_length;
 
 /* The preferred width of text lines, set to LEEWAY % less than max_width.  */
-static int best_width;
+static int goal_width;
 
 /* Dynamic variables.  */
 
@@ -286,6 +287,7 @@ Mandatory arguments to long options are mandatory for short options too.\n\
   -t, --tagged-paragraph    indentation of first line different from second\n\
   -u, --uniform-spacing     one space between words, two after sentences\n\
   -w, --width=WIDTH         maximum line width (default of 75 columns)\n\
+  -g, --goal=WIDTH          goal width (default of 93% of width)\n\
 "), stdout);
       fputs (HELP_OPTION_DESCRIPTION, stdout);
       fputs (VERSION_OPTION_DESCRIPTION, stdout);
@@ -308,6 +310,7 @@ static struct option const long_options[] =
   {"tagged-paragraph", no_argument, NULL, 't'},
   {"uniform-spacing", no_argument, NULL, 'u'},
   {"width", required_argument, NULL, 'w'},
+  {"goal", required_argument, NULL, 'g'},
   {GETOPT_HELP_OPTION_DECL},
   {GETOPT_VERSION_OPTION_DECL},
   {NULL, 0, NULL, 0},
@@ -319,6 +322,7 @@ main (int argc, char **argv)
   int optchar;
   bool ok = true;
   char const *max_width_option = NULL;
+  char const *goal_width_option = NULL;
 
   initialize_main (&argc, &argv);
   set_program_name (argv[0]);
@@ -376,6 +380,10 @@ main (int argc, char **argv)
         max_width_option = optarg;
         break;
 
+      case 'g':
+        goal_width_option = optarg;
+        break;
+
       case 'p':
         set_prefix (optarg);
         break;
@@ -398,7 +406,23 @@ main (int argc, char **argv)
       max_width = tmp;
     }
 
-  best_width = max_width * (2 * (100 - LEEWAY) + 1) / 200;
+  if (goal_width_option)
+    {
+      /* Limit goal_width to max_width.  */
+      unsigned long int tmp;
+      if (! (xstrtoul (goal_width_option, NULL, 10, &tmp, "") == LONGINT_OK
+             && tmp <= max_width))
+        error (EXIT_FAILURE, 0, _("invalid width: %s"),
+               quote (goal_width_option));
+      goal_width = tmp;
+    }
+  else
+    {
+      goal_width = max_width * (2 * (100 - LEEWAY) + 1) / 200;
+    }
+
+  if ((max_width_option == NULL) && (goal_width_option == NULL))
+    check_for_goals (argv);
 
   if (optind == argc)
     fmt (stdin);
@@ -435,6 +459,53 @@ main (int argc, char **argv)
   exit (ok ? EXIT_SUCCESS : EXIT_FAILURE);
 }
 
+/* Check the first two operands for being numbers without a file by that name.
+   If there are no such files and the numbers are not too big, then accept
+   them as -g and -w options, respectively.  */
+
+static void
+check_for_goals (char ** argv)
+{
+  unsigned long v;
+
+  /* see if the first operand is a number.  That means there is no file
+     by that name and the operand fully translates to a number.  */
+  char * num = argv[optind];
+  if (access (num, R_OK))
+    return;
+  errno = 0;
+  v = strtoul (num, &num, 0);
+  if ((errno == 0) && (*num == '\0') && (v > 0) && (v < MAXCHARS/2))
+    goal_width = v;
+  else
+    return;
+  optind++;
+
+  /* see if the second operand is a number.  That means there is no file
+     by that name and the operand fully translates to a number.  */
+  num = argv[optind];
+  if (access (num, R_OK))
+    {
+      max_width = goal_width + 10;
+      return;
+    }
+  errno = 0;
+  v = strtoul (num, &num, 0);
+  if ((errno == 0) && (*num == '\0') && (v > 0) && (v < MAXCHARS/2))
+    {
+      max_width = v;
+      if (goal_width > max_width)
+        error (EXIT_FAILURE, 0, _("goal exceeds width:  %u > %u"),
+               goal_width, max_width);
+    }
+  else
+    {
+      max_width = goal_width + 10;
+      return;
+    }
+  optind++;
+}
+
 /* Trim space from the front and back of the string P, yielding the prefix,
    and record the lengths of the prefix and the space trimmed.  */
 
@@ -924,7 +995,7 @@ line_cost (WORD *next, int len)
 
   if (next == word_limit)
     return 0;
-  n = best_width - len;
+  n = goal_width - len;
   cost = SHORT_COST (n);
   if (next->next_break != word_limit)
     {
@@ -1010,3 +1081,10 @@ put_space (int space)
       out_column++;
     }
 }
+/*
+ * Local Variables:
+ * mode: C
+ * c-file-style: "gnu"
+ * indent-tabs-mode: nil
+ * End:
+ * end of fmt.c */

--------------000904010405030900000807--




Information forwarded to bug-coreutils@HIDDEN:
bug#11044; Package coreutils. Full text available.

Message received at 11044 <at> debbugs.gnu.org:


Received: (at 11044) by debbugs.gnu.org; 19 Mar 2012 21:37:26 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 19 17:37:26 2012
Received: from localhost ([127.0.0.1]:57362 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1S9kGb-0002ln-WD
	for submit <at> debbugs.gnu.org; Mon, 19 Mar 2012 17:37:26 -0400
Received: from mail-ob0-f172.google.com ([209.85.214.172]:44167)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <bruce.korb@HIDDEN>) id 1S9kGY-0002le-NP
	for 11044 <at> debbugs.gnu.org; Mon, 19 Mar 2012 17:37:24 -0400
Received: by obbtb4 with SMTP id tb4so1147239obb.3
	for <11044 <at> debbugs.gnu.org>; Mon, 19 Mar 2012 14:06:49 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-type:content-transfer-encoding;
	bh=zT9HzGfoV2RXZGDaOdDYPZoMXoOBooY2hVL49W4tL3M=;
	b=UoEA0AuTE7Ir2lZ+r868CMMnLHrK5aeb60B9zI9I2UfAGCGsI7PZJnL2I6WJ9nZ8lX
	gELOkETR8CeemUYUOMeuez4BBNQLY2ZRO/PkTPVCfZ0VTV5Hd6C9wuD7pK1JEgOo4SpW
	0Bycv80XksxNIxFFL5oD01qzZAjAv8fby3f0fOuHa+2iHZoBrpajuvtuISDrX3ESw38J
	Rux+GTUGoJqe6YnhtOcQjPpk2yaGasBykbZUXznT3jCQtS67FsjOK1dxjsXfIK0RikUt
	uEf+ODiQCASTnRwxwL1g1G7QKwB7BgXtv3OBT1xwseX9RGHvIVOAEBuYqIRhBol8Vwh2
	ktLA==
Received: by 10.50.94.229 with SMTP id df5mr9347882igb.1.1332191209740; Mon,
	19 Mar 2012 14:06:49 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.42.134.69 with HTTP; Mon, 19 Mar 2012 14:06:34 -0700 (PDT)
In-Reply-To: <4F6799E0.9020108@HIDDEN>
References: <4F677F0F.6090100@HIDDEN> <4F678A2D.4050609@HIDDEN>
	<CAKRnqNLE5akHiZqo42S-3iaXaLW2fM14XH4gs7RfU8Qk648Wyg@HIDDEN>
	<4F6799E0.9020108@HIDDEN>
From: Bruce Korb <bruce.korb@HIDDEN>
Date: Mon, 19 Mar 2012 14:06:34 -0700
Message-ID: <CAKRnqNJd1Mb9mZq2A-o9K=wAv8v9Ej7UL+4KKFziuYn94L217Q@HIDDEN>
Subject: Re: bug#11044: bug & RFE
To: Eric Blake <eblake@HIDDEN>
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -2.6 (--)
X-Debbugs-Envelope-To: 11044
Cc: 11044 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.6 (--)

Hi Eric,

On Mon, Mar 19, 2012 at 1:41 PM, Eric Blake <eblake@HIDDEN> wrote:
>> =A0 would you-all accept a patch that added a "-g" option to set the goa=
l
>> =A0 column as opposed to deriving it by multiplying the width by 0.93 ?
>
> Yes - I would welcome such a patch, on the grounds of supporting a use
> case currently possible in other existing implementations. =A0According t=
o
> http://www.manpagez.com/man/1/fmt/, there is no 'g' option, but BSD 'fmt
> 60 70' would operate like your proposed 'fmt -g 60 -w 70'. =A0In fact, it
> might even be worth to teach GNU fmt about a non-option numeric argument
> being treated as --width rather than as a file name.

I thought about that and decided to not suggest it.  I don't like
conflating something
that is, in essence, a configurable setting with real operands.  I'd
prefer to suggest
"-g" to our BSD friends.  :)

Were it to be implemented in GNU's fmt, you would have to pass two tests:

1. does it match a file name?  If not,
2. is the first (or second) operand a number? (decimal only, or hex/octal, =
too?)

"Icky"




Information forwarded to bug-coreutils@HIDDEN:
bug#11044; Package coreutils. Full text available.
Changed bug title to 'RFE: fmt goal width' from 'bug & RFE' Request was from Eric Blake <eblake@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 11044 <at> debbugs.gnu.org:


Received: (at 11044) by debbugs.gnu.org; 19 Mar 2012 21:11:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 19 17:11:53 2012
Received: from localhost ([127.0.0.1]:57353 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1S9jrs-0001P9-Bc
	for submit <at> debbugs.gnu.org; Mon, 19 Mar 2012 17:11:53 -0400
Received: from mx1.redhat.com ([209.132.183.28]:27861)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <eblake@HIDDEN>)
	id 1S9jre-0001Om-N4; Mon, 19 Mar 2012 17:11:50 -0400
Received: from int-mx02.intmail.prod.int.phx2.redhat.com
	(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])
	by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q2JKf5JK001906
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Mon, 19 Mar 2012 16:41:05 -0400
Received: from [10.3.113.125] (ovpn-113-125.phx2.redhat.com [10.3.113.125])
	by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP
	id q2JKf5Hd032119; Mon, 19 Mar 2012 16:41:05 -0400
Message-ID: <4F6799E0.9020108@HIDDEN>
Date: Mon, 19 Mar 2012 14:41:04 -0600
From: Eric Blake <eblake@HIDDEN>
Organization: Red Hat
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1
MIME-Version: 1.0
To: Bruce Korb <bruce.korb@HIDDEN>
Subject: Re: bug#11044: bug & RFE
References: <4F677F0F.6090100@HIDDEN> <4F678A2D.4050609@HIDDEN>
	<CAKRnqNLE5akHiZqo42S-3iaXaLW2fM14XH4gs7RfU8Qk648Wyg@HIDDEN>
In-Reply-To: <CAKRnqNLE5akHiZqo42S-3iaXaLW2fM14XH4gs7RfU8Qk648Wyg@HIDDEN>
X-Enigmail-Version: 1.4
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature";
	boundary="------------enig0253CEEB9CAC946B31EE8506"
X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12
X-Spam-Score: -6.9 (------)
X-Debbugs-Envelope-To: 11044
Cc: 11044 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.9 (------)

This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig0253CEEB9CAC946B31EE8506
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

retitle 11044 RFE: fmt goal width
thanks

On 03/19/2012 02:00 PM, Bruce Korb wrote:
> Hi Eric,
>=20
> On Mon, Mar 19, 2012 at 12:34 PM, Eric Blake <eblake@HIDDEN> wrote:=

>> As for fmt, I'll let others chime in; it's the sort of thing where a
>> patch speaks louder than requests.
>=20
> A "patch, please" reply is completely fine.  Going to the trouble of
> making a patch
> wherein the patch is not considered is not quite so fine.  I guess I
> should make it
> clearer:
>=20
>   would you-all accept a patch that added a "-g" option to set the goal=

>   column as opposed to deriving it by multiplying the width by 0.93 ?

Yes - I would welcome such a patch, on the grounds of supporting a use
case currently possible in other existing implementations.  According to
http://www.manpagez.com/man/1/fmt/, there is no 'g' option, but BSD 'fmt
60 70' would operate like your proposed 'fmt -g 60 -w 70'.  In fact, it
might even be worth to teach GNU fmt about a non-option numeric argument
being treated as --width rather than as a file name.

--=20
Eric Blake   eblake@HIDDEN    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


--------------enig0253CEEB9CAC946B31EE8506
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBCAAGBQJPZ5ngAAoJEKeha0olJ0NqKUoH/0N1DjJyGce92NT84+RBR/uB
I4CXYwT94prgf/vo8DGa0kfu2ZARvh21iGLWzAVbMinK4L7TP9zHV+UkDuUIY+rm
6NEptboGrmxnxhnPnpwg1FcJOYe5vcGeE8TCIwfTBTBNAUWl7K3vAKBvqdPnt03n
JY+AnlBVqFwMDwWzlJXt9yTXKYXaPFrHaA2EN1QGifoBK/aa2FtKnhLz+cXRSZvc
/19nlJL9+xeroH4z1RBR2QqP3KOlmTIgaAom6+V8ozf8wg22H+OXfZjYk9Pb3FWX
hcEFp9jOTXnJhjlOSICOEQyXQJR1/x1+kci4Q7F6ufZNsu63fTFUBy7o3q7ymrM=
=J9wS
-----END PGP SIGNATURE-----

--------------enig0253CEEB9CAC946B31EE8506--




Information forwarded to bug-coreutils@HIDDEN:
bug#11044; Package coreutils. Full text available.

Message received at 11044 <at> debbugs.gnu.org:


Received: (at 11044) by debbugs.gnu.org; 19 Mar 2012 20:30:52 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 19 16:30:52 2012
Received: from localhost ([127.0.0.1]:57333 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1S9jEB-0000Rp-QN
	for submit <at> debbugs.gnu.org; Mon, 19 Mar 2012 16:30:52 -0400
Received: from mail-iy0-f172.google.com ([209.85.210.172]:34177)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <bruce.korb@HIDDEN>) id 1S9jE9-0000Rh-1w
	for 11044 <at> debbugs.gnu.org; Mon, 19 Mar 2012 16:30:50 -0400
Received: by iazz13 with SMTP id z13so9338145iaz.3
	for <11044 <at> debbugs.gnu.org>; Mon, 19 Mar 2012 13:00:16 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=mime-version:in-reply-to:references:from:date:message-id:subject:to
	:cc:content-type;
	bh=cw1Q6MRRLrwcsTlx5Pj7VS1fiZ747pynkORR1ookDZE=;
	b=flCnkqqW+mnW2vFtLLo1a7wfk9ArewCPNY6Y5wh6rGvmAvrbydZ5fFyAb4UHGy3nzp
	TS7RI4mz2y220xZSm/tN1/cTBzv00UcarwIlqDnl15C653KcFYzPesP4FFUoJL2dexu2
	828lAVdg17YvlF4T2WimpfMHN6nCuIIZQ9+Ckg1XZRJ6y9hhPEiQzwh/unR56GuFFO7Q
	JKupjTsilSJUqL4M5jGsLhJHmRccW9EuiJwkYgEm2qnT+n+WwTINJz57v0iP/mIgmvDA
	8evZDVw1ExG8xflf8mn+fO4nVuLwTRgzK4ptqwXoniaYOySUSYGzYr9ICD9f6SfvcAYY
	7igQ==
Received: by 10.50.209.41 with SMTP id mj9mr591781igc.60.1332187216408; Mon,
	19 Mar 2012 13:00:16 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.42.134.69 with HTTP; Mon, 19 Mar 2012 13:00:01 -0700 (PDT)
In-Reply-To: <4F678A2D.4050609@HIDDEN>
References: <4F677F0F.6090100@HIDDEN> <4F678A2D.4050609@HIDDEN>
From: Bruce Korb <bruce.korb@HIDDEN>
Date: Mon, 19 Mar 2012 13:00:01 -0700
Message-ID: <CAKRnqNLE5akHiZqo42S-3iaXaLW2fM14XH4gs7RfU8Qk648Wyg@HIDDEN>
Subject: Re: bug#11044: bug & RFE
To: Eric Blake <eblake@HIDDEN>
Content-Type: text/plain; charset=ISO-8859-1
X-Spam-Score: -2.6 (--)
X-Debbugs-Envelope-To: 11044
Cc: 11044 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -2.6 (--)

Hi Eric,

On Mon, Mar 19, 2012 at 12:34 PM, Eric Blake <eblake@HIDDEN> wrote:
> As for fmt, I'll let others chime in; it's the sort of thing where a
> patch speaks louder than requests.

A "patch, please" reply is completely fine.  Going to the trouble of
making a patch
wherein the patch is not considered is not quite so fine.  I guess I
should make it
clearer:

  would you-all accept a patch that added a "-g" option to set the goal
  column as opposed to deriving it by multiplying the width by 0.93 ?

It would permit results consistent with BSD and Plan-9 flavors of fmt.

Thanks !




Information forwarded to bug-coreutils@HIDDEN:
bug#11044; Package coreutils. Full text available.

Message received at 11044 <at> debbugs.gnu.org:


Received: (at 11044) by debbugs.gnu.org; 19 Mar 2012 20:04:53 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 19 16:04:53 2012
Received: from localhost ([127.0.0.1]:57303 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1S9ip2-0008Ir-6v
	for submit <at> debbugs.gnu.org; Mon, 19 Mar 2012 16:04:52 -0400
Received: from mx1.redhat.com ([209.132.183.28]:43185)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <eblake@HIDDEN>) id 1S9iop-0008IY-PD
	for 11044 <at> debbugs.gnu.org; Mon, 19 Mar 2012 16:04:51 -0400
Received: from int-mx12.intmail.prod.int.phx2.redhat.com
	(int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25])
	by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q2JJY6b3004903
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK);
	Mon, 19 Mar 2012 15:34:06 -0400
Received: from [10.3.113.125] (ovpn-113-125.phx2.redhat.com [10.3.113.125])
	by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP
	id q2JJY5je032722; Mon, 19 Mar 2012 15:34:06 -0400
Message-ID: <4F678A2D.4050609@HIDDEN>
Date: Mon, 19 Mar 2012 13:34:05 -0600
From: Eric Blake <eblake@HIDDEN>
Organization: Red Hat
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:10.0.1) Gecko/20120216 Thunderbird/10.0.1
MIME-Version: 1.0
To: Bruce Korb <bruce.korb@HIDDEN>
Subject: Re: bug#11044: bug & RFE
References: <4F677F0F.6090100@HIDDEN>
In-Reply-To: <4F677F0F.6090100@HIDDEN>
X-Enigmail-Version: 1.4
OpenPGP: url=http://people.redhat.com/eblake/eblake.gpg
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature";
	boundary="------------enig1CD965B7B4321D99F65B503C"
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25
X-Spam-Score: -6.9 (------)
X-Debbugs-Envelope-To: 11044
Cc: 11044 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.9 (------)

This is an OpenPGP/MIME signed message (RFC 2440 and 3156)
--------------enig1CD965B7B4321D99F65B503C
Content-Type: text/plain; charset=windows-1252
Content-Transfer-Encoding: quoted-printable

On 03/19/2012 12:46 PM, Bruce Korb wrote:
> Hi,
>=20
> The web bug:  the symlink to coreutils.html from index.html is missing

Aargh.  This was my fault, due to a recent complaint about the
coreutils.en.html symlink not working.  I had applied this commit:

> update to latest symlink conventions
>=20
> Per https://www.gnu.org/server/standards/README.webmastering.html,
> index.html is automatically created, and any link that looks like
> a translation of html can no longer be created via .symlinks, but
> must instead be done via redirections.

since according to that web page:

> As a special case, if a page with the directory's name exists, and inde=
x.html does not exist, a link will be made from index.html to the main pa=
ge.

But maybe that only happens on directories where a .symlinks file
exists, and the fact that I removed .symlinks for coreutils.en.html
broke the index.html linking?

At any rate, I'll quickly fix that by re-adding .symlinks.

As for fmt, I'll let others chime in; it's the sort of thing where a
patch speaks louder than requests.

--=20
Eric Blake   eblake@HIDDEN    +1-919-301-3266
Libvirt virtualization library http://libvirt.org


--------------enig1CD965B7B4321D99F65B503C
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Public key at http://people.redhat.com/eblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBCAAGBQJPZ4otAAoJEKeha0olJ0NqwtwIAJbh179FSTaxm1LYBJ80M+fD
SXPY2MYqgCiQ7d6m+qvb5u2mqNIa54QDDOI9XKhp4f0A6NYjmPVRJGs5JkxDrGU/
q7r1PNrOQiB6w/c3h2KdVj+h8qc9dhuEgBKIujFKnpfI97FtO8Cmy7DTFXaY0o3r
a/tpnnseCCSH+jP0olw84dYPovjNv/MT7dWEUKjZohoSngVcCon+2EzSN6YqAroH
3KG1CNKixUYkbmHfoGJWOa/WsQw4GjYbdW8v0cYdfFFNhU5OZS5mY4toRHrwneAp
r6Z1U49QzzaS/ds7qQ2UYtejbGtg9kisfSnbFW4yBqK5UfQC8e+rpQcje/fYEAQ=
=PztB
-----END PGP SIGNATURE-----

--------------enig1CD965B7B4321D99F65B503C--




Information forwarded to bug-coreutils@HIDDEN:
bug#11044; Package coreutils. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 19 Mar 2012 19:17:32 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 19 15:17:32 2012
Received: from localhost ([127.0.0.1]:57258 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1S9i5C-0007EE-Mu
	for submit <at> debbugs.gnu.org; Mon, 19 Mar 2012 15:17:32 -0400
Received: from eggs.gnu.org ([208.118.235.92]:33338)
	by debbugs.gnu.org with esmtp (Exim 4.72)
	(envelope-from <bruce.korb@HIDDEN>) id 1S9i5A-0007E8-SG
	for submit <at> debbugs.gnu.org; Mon, 19 Mar 2012 15:17:29 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bruce.korb@HIDDEN>) id 1S9hbX-0000wm-P8
	for submit <at> debbugs.gnu.org; Mon, 19 Mar 2012 14:46:57 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
	RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:49584)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bruce.korb@HIDDEN>) id 1S9hbX-0000wW-Jo
	for submit <at> debbugs.gnu.org; Mon, 19 Mar 2012 14:46:51 -0400
Received: from eggs.gnu.org ([208.118.235.92]:57900)
	by lists.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bruce.korb@HIDDEN>) id 1S9hbT-0003l0-0g
	for bug-coreutils@HIDDEN; Mon, 19 Mar 2012 14:46:51 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <bruce.korb@HIDDEN>) id 1S9hbR-0000vO-71
	for bug-coreutils@HIDDEN; Mon, 19 Mar 2012 14:46:46 -0400
Received: from mail-pb0-f41.google.com ([209.85.160.41]:44352)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <bruce.korb@HIDDEN>) id 1S9hbQ-0000ur-Tb
	for bug-coreutils@HIDDEN; Mon, 19 Mar 2012 14:46:45 -0400
Received: by pbcup15 with SMTP id up15so1284572pbc.0
	for <bug-coreutils@HIDDEN>; Mon, 19 Mar 2012 11:46:42 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
	h=message-id:date:from:user-agent:mime-version:to:subject
	:content-type:content-transfer-encoding;
	bh=CWLw+WhUrthoZN8GbcjUskqGGBWSnU0I0ExIQqHKf3s=;
	b=rBmAS1mir/rXIAJMXhE9ENqTciDVcj8UAnbUf0e7R0+A1fY9Rx0XWmKcbKAfiSSded
	Nf2ojbMynI6caTqI3GqB+gyXdrf1sZwgYMbCvk5kSJ8ZJ38AhdIG8FrX4pPgvOifbt4D
	uSHUH3/+jJswO1w/uQWl3tpg/jhig4rsDo7EymZasjBYR8ro2/ds9Y0Jc6hkJFCZb4A8
	ufr6ex2J0iWVjpZGMczOu9Zdlasz77MvjeEpfhnbJ8AmmFHKeqTRGLjiUGLp8L+M3/FJ
	k/inDp469rQpmKpEU+7Q2GYVJHjjYnbName/myQi9iFWv4c1ZMCNopfH7D/9COyPAcij
	4aKQ==
Received: by 10.68.74.97 with SMTP id s1mr42639453pbv.46.1332182801938;
	Mon, 19 Mar 2012 11:46:41 -0700 (PDT)
Received: from [192.168.10.2] ([75.0.186.155])
	by mx.google.com with ESMTPS id o2sm11906789pbd.6.2012.03.19.11.46.40
	(version=TLSv1/SSLv3 cipher=OTHER);
	Mon, 19 Mar 2012 11:46:41 -0700 (PDT)
Message-ID: <4F677F0F.6090100@HIDDEN>
Date: Mon, 19 Mar 2012 11:46:39 -0700
From: Bruce Korb <bruce.korb@HIDDEN>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
	rv:10.0.2) Gecko/20120215 Thunderbird/10.0.2
MIME-Version: 1.0
To: bug-coreutils@HIDDEN
Subject: bug & RFE
Content-Type: text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding: 8bit
X-detected-operating-system: by eggs.gnu.org: Genre and OS details not
	recognized.
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3)
X-Received-From: 208.118.235.17
X-Spam-Score: -6.1 (------)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.13
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>,
	<mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -6.1 (------)

Hi,

The web bug:  the symlink to coreutils.html from index.html is missing

The RFE:  I'd like to be able to have a consistent, well-understood
line length from the fmt command:
‘--width=width’
    Fill output lines up to width characters (default 75). fmt initially
    tries to make lines about 7% shorter than this, to give it room to
    balance line lengths.

That is very nice and all, but that's not what other implementations do.
BSD uses "goal" and "maximum" to specify the fuzz and "-w" says "no fuzz".
So how about an option to specify a goal with the default goal being 93%
of "-w"?  Then I can just test to see if "-g" is accepted and use it.

Thank you!




Acknowledgement sent to Bruce Korb <bruce.korb@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-coreutils@HIDDEN. Full text available.
Report forwarded to bug-coreutils@HIDDEN:
bug#11044; Package coreutils. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Tue, 16 Oct 2018 16:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.