nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] Thoughts: header/address parsing

2014-08-05 06:41:41
Ken wrote:
% scan -width 9999 -format '%{x-spam-status}' messages ....

Aside, it would be nice if scan's -width grew an "infinite" value as
9999 is a little kludgy.  I was thinking `0', but that's not an error at
the moment, it seems to mean `The default is to use the width of the
terminal' -- http://git.savannah.gnu.org/cgit/nmh.git/tree/man/scan.man

So then I played a little bit.

    $ scan -format '%{subject}' .
    123456
    $ scan -width 3 -format '%{subject}' .
    12

Huh?

    $ scan -width 1 -format '%{subject}' . | od -c
    0000000  \n
    0000001
    $ scan -width 0 -format '%{subject}' . | od -c
    0000000   1   2   3   4   5   6  \n
    0000007
    $
    $ ed `mhpath .`
    619
    
/123456/s/$/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxends
    Subject: 
123456xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxends
    w
    687
    q
    $ tput cols   # MODE 7 FTW!
    40
    $ scan -width 0 -format '%{subject}' .
    123456xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    $ scan -width 0 -format '%{subject}' . | wc -c
    40
    $

I think -width is avoiding printing in the last column to avoid an
unwanted linefeed?  Either that, or it's out by one.  I don't suppose
it's deliberately counting the `\n'.

Anyway, it's a bit off-putting to get `12' for a `-width 3', especially
after reading the fine man page.

Cheers, Ralph.

_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
https://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>