public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* error.3: What happens if status = 0
@ 2021-02-18 21:55 Alejandro Colomar (man-pages)
  2021-02-19  9:09 ` AW: " Walter Harms
  0 siblings, 1 reply; 3+ messages in thread
From: Alejandro Colomar (man-pages) @ 2021-02-18 21:55 UTC (permalink / raw)
  To: Michael Kerrisk (man-pages); +Cc: linux-man, libc-alpha

Hi Michael,

I think it's not quite clear what happens when status = 0; for 
error[_at_line](3) from the text of the manual page.  From the glibc 
documentation[1], it seems that error(0, ...) is similar to warn(...), 
isn't it?

Thanks,

Alex

[1]: 
<https://www.gnu.org/software/libc/manual/html_node/Error-Messages.html#Error-Messages>

-- 
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* AW: error.3: What happens if status = 0
  2021-02-18 21:55 error.3: What happens if status = 0 Alejandro Colomar (man-pages)
@ 2021-02-19  9:09 ` Walter Harms
  2021-02-19 12:23   ` Michael Kerrisk (man-pages)
  0 siblings, 1 reply; 3+ messages in thread
From: Walter Harms @ 2021-02-19  9:09 UTC (permalink / raw)
  To: Alejandro Colomar (man-pages), Michael Kerrisk (man-pages)
  Cc: linux-man, libc-alpha

Hi,
yes, error(0,...) is a bit like warn(), it returns to the programm.

That supports what my man page says:

" If  status has a nonzero value, then error() calls exit(3) to terminate
       the program using the given value as the exit status."

may be you want an add on like:

"Otherwise error() returns."

re,
 wh
________________________________________
Von: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
Gesendet: Donnerstag, 18. Februar 2021 22:55:13
An: Michael Kerrisk (man-pages)
Cc: linux-man@vger.kernel.org; libc-alpha@sourceware.org
Betreff: error.3: What happens if status = 0

Hi Michael,

I think it's not quite clear what happens when status = 0; for
error[_at_line](3) from the text of the manual page.  From the glibc
documentation[1], it seems that error(0, ...) is similar to warn(...),
isn't it?

Thanks,

Alex

[1]:
<https://www.gnu.org/software/libc/manual/html_node/Error-Messages.html#Error-Messages>

--
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: AW: error.3: What happens if status = 0
  2021-02-19  9:09 ` AW: " Walter Harms
@ 2021-02-19 12:23   ` Michael Kerrisk (man-pages)
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Kerrisk (man-pages) @ 2021-02-19 12:23 UTC (permalink / raw)
  To: Walter Harms, Alejandro Colomar (man-pages)
  Cc: mtk.manpages, linux-man, libc-alpha

Hi Alex, and Walter,
On 2/19/21 10:09 AM, Walter Harms wrote:
> Hi,
> yes, error(0,...) is a bit like warn(), it returns to the programm.
> 
> That supports what my man page says:
> 
> " If  status has a nonzero value, then error() calls exit(3) to terminate
>        the program using the given value as the exit status."
> 
> may be you want an add on like:
> 
> "Otherwise error() returns."
> 
> re,
>  wh
> ________________________________________
> Von: Alejandro Colomar (man-pages) <alx.manpages@gmail.com>
> Gesendet: Donnerstag, 18. Februar 2021 22:55:13
> An: Michael Kerrisk (man-pages)
> Cc: linux-man@vger.kernel.org; libc-alpha@sourceware.org
> Betreff: error.3: What happens if status = 0
> 
> Hi Michael,
> 
> I think it's not quite clear what happens when status = 0; for
> error[_at_line](3) from the text of the manual page.  From the glibc
> documentation[1], it seems that error(0, ...) is similar to warn(...),
> isn't it?

Yes, I think so. Justin and I could have been clearer on that
when the manual page was originally written. The point is
that if status==0, then error() simply returns after printing
its message. As Walter notes, the page implies this (see also the
text on 'error_message_count'), without saying so outright.

I applied the patch below.

Cheers,

Michael

diff --git a/man3/error.3 b/man3/error.3
index c3b4ccba4..87e454608 100644
--- a/man3/error.3
+++ b/man3/error.3
@@ -75,7 +75,8 @@ If \fIstatus\fP has a nonzero value, then
 .BR error ()
 calls
 .BR exit (3)
-to terminate the program using the given value as the exit status.
+to terminate the program using the given value as the exit status;
+otherwise it returns after printing the error message.
 .PP
 The
 .BR error_at_line ()


-- 
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-02-19 12:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-18 21:55 error.3: What happens if status = 0 Alejandro Colomar (man-pages)
2021-02-19  9:09 ` AW: " Walter Harms
2021-02-19 12:23   ` Michael Kerrisk (man-pages)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).