bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: RFC: wc --max-line-length vs. TABs [Re: Bug in wc


From: Bruno Haible
Subject: Re: RFC: wc --max-line-length vs. TABs [Re: Bug in wc
Date: Sat, 23 Aug 2008 00:14:28 +0200
User-agent: KMail/1.5.4

Hi Jim,

> This behavior is not specified, and is currently untested.
> (it's a GNU invention, from Bruno Haible in textutils-1.22d,
> which was back in 1997)

The intention of this option is and was to measure the maximum number of
screen columns used by a file. For many purposes, people are encouraged
to create/send/commit files with at most 80 screen columns. Or at most 79
screen columns for others. Or at most 74 columns for GNU texinfo files.
The option '-L' was intended as a fast check for this metric.

The original mail, sent to bug-gnu-utils on 1997-10-31, had this explanation:

  "While GNU "wc" returns the vertical extent of a piece of text - i.e. the
   number of lines - it does not yet return the horizontal extent of a piece
   of text - i.e. the number of columns. This is a useful functionality, if
   you want to know

     - whether a text will fit on the paper when sent to the printer,
     - whether an email exceeds the recommended 72 character limit,
     - (in combination with "nm") how long the identifiers were that made
       `ranlib' dump core,
     - etc."

I propose a clarification in the documentation (see below).

> I'm tempted to make the change, but it seems too drastic, after 11 years.
> Do any of you rely on the current TAB-counting behavior of GNU wc?
> 
> Bruno, what do you think?

If you change the option to count every tab as 1, or every character as 1
regardless of its screen width, the option -L is not usable for its main
purpose any more.

Bruno


2008-08-22  Bruno Haible  <address@hidden>

        * doc/coreutils.texi (wc invocation): Explain what the option -L
        measures.

--- coreutils.texi.bak  2008-08-22 23:55:47.000000000 +0200
+++ coreutils.texi      2008-08-22 23:59:03.000000000 +0200
@@ -3137,7 +3137,9 @@
 
 With the @option{--max-line-length} option, @command{wc} prints the length
 of the longest line per file, and if there is more than one file it
-prints the maximum (not the sum) of those lengths.
+prints the maximum (not the sum) of those lengths.  The line lengths here
+are measured in screen columns, according to the current locale and
+assuming tab positions in every 8th column.
 
 The program accepts the following options.  Also see @ref{Common options}.
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]