On Thu, 6 Jun 2024, Ralph Corderoy wrote:

I thought you'd get a copy of my reply from the list as you were
a subscriber.  Perhaps it just crossed with your second copy to the
list.

So many embarrassing things at once, including my attempt at writing
C, a language I knew once.

And yes, I was checking the archives, but the June 2024 wasn't there
until I reloaded the page really hard after reading your second email.

What is going on?

ed(1) is behaving as documented.  :-)

Now I remember I must have run into this before.

https://lists.gnu.org/archive/html/bug-ed/2014-12/msg00009.html explains
this is desired behaviour of GNU ed(1). They have even added a funny
"loose exit code" option, probably out of the guilt feeling....

Since I spend most of my tty time on BSD, their ed behaves in a nice
way -- if the input is a terminal, it will not exit with an exit code > 0
in case of a non-fatal error. Even POSIX says,

If the standard input is a terminal device file, all input shall be flushed, 
and a new command read.
If the standard input is a regular file, ed shall terminate with a non-zero 
exit status.

although they say also say,

The following exit values shall be returned:

 0
    Successful completion without any file or command errors.

I have just built GNU ed 0.1 (the first version I can find from 1994) and it
does exit with 0 if an error has been made in the interactive session.

They have changed it in GNU ed 0.2 to do the following: what is supposed
to be an EXIT status is kept in the variable until the program decides
to exit anyway. Strange.

But this is not an mh topic. Thank you for your time,

Marcin

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to