N'day :)

Ralph Corderoy wrote in <20180904094356.6d78621...@orac.inputplus.co.uk>:
 |>> On running this command, I type the four characters ‘bar\n’, and
 |>> then Ctrl-D, my TTY's EOF character, before the three seconds have
 |>> elapsed.  It appears thus, with ‘␣’ being the cursor.
 |>> 
 |>>     $ sleep 3; mail -s foo $LOGNAME
 |>>     bar
 |>>     ␣
 |>> 
 |>> As mail runs, it changes to
 |>> 
 |>>     $ sleep 3; mail -s foo $LOGNAME
 |>>     bar
 |>>     bar
 |>>     ^@␣
 |>
 |> I presume you have no*ignoreeof* and no*asksend* set.
 |
 |    $ cat ~/.mailrc
 |    unset askcc
 |    unset asksend
 |    set encoding=8bit
 |    set sendcharsets=utf-8
 |    set dot
 |    set sendwait
 |    set line-editor-disable
 |    set stealthmua=noagent
 |    $

Interesting.  And much more expensive than

  unset askcc asksend
  set encoding=8bit dot sendwait ...

Some expenses do not seem to matter to nmh users who consume
dozens of processes just for having a single look, of course. :-)

 |> I wonder whether you would be helped with a shell alias that sets
 |> *line-editor-disable* in addition, it would release the system from
 |> quite some unnecessary burdens in this case.
 |
 |I see it is set.

There you go.  Saving a lot.

 |>> Despite my EOF, no shell prompt appears so I type another EOF.  And
 |>> then two more.  Only then does mail exit and my $PS1 appear.
 |>
 |> Yes, in raw terminal mode VEOF has no meaning actually.
 |
 |Agreed.  But as a user I shouldn't need to know that it's switched to
 |raw mode.  mail(1) used to be happy taking the TTY's EOF.

I absolutely agree with that.  It should just work. 

 |>> The email that arrives has the null byte suggested by the ‘^@’.
 |>
 |> If you input a NUL byte we will not mangle you.  Good.
 |
 |I did not input a NUL.  As I said above, it was `bar\n' and Ctrl-D.  And
 |raw mode doesn't turn Ctrl-D into NUL.  Here, I type `abc' Ctrl-D `def',
 |wait for the `.', then Enter and Ctrl-D.
 |
 |    $ (trap '' TTOU; old=`stty -g`; stty raw; sleep 3; stty $old; printf \
 |    .) & od -c
 |    abc^Ddef.
 |    0000000   a   b   c 004   d   e   f  \n
 |    0000010
 |    $
 |
 |The Ctrl-D correctly appears as EOT, as I'd expect in raw mode.

I see.  I meant ICANON (rather: of course), to what you could get
via ncurses(3) raw(3), for example, which has

  #ifdef TERMIOS
          buf.c_lflag &= (unsigned) ~(ICANON | ISIG | IEXTEN);
          buf.c_iflag &= (unsigned) ~(COOKED_INPUT);
          buf.c_cc[VMIN] = 1;
          buf.c_cc[VTIME] = 0;
  #else
          buf.sg_flags |= RAW;
  #endif

Always a pleasure.
Cheerio.

--steffen
|
|Der Kragenbaer,                The moon bear,
|der holt sich munter           he cheerfully and one by one
|einen nach dem anderen runter  wa.ks himself off
|(By Robert Gernhardt)

Reply via email to