Re: [PATCH] fgetc.3: Describe handling of ungetc(EOF, stream)

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

 



On 26/05/2023 16:28, Alejandro Colomar wrote:
Hi Ian!

On 5/26/23 17:19, Ian Abbott wrote:
As per the C standard, calling ungetc() with the character parameter
equal to EOF causes it to fail, returning EOF.

Signed-off-by: Ian Abbott <abbotti@xxxxxxxxx>
---
  man3/fgetc.3 | 8 +++++++-
  1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/man3/fgetc.3 b/man3/fgetc.3
index 75dcaeaf6..d6bf62327 100644
--- a/man3/fgetc.3
+++ b/man3/fgetc.3
@@ -62,7 +62,13 @@ A terminating null byte (\[aq]\e0\[aq])
  is stored after the last character in the buffer.
  .PP
  .BR ungetc ()
-pushes
+returns
+.B EOF
+if the value of
+.I c
+equals that of the macro
+.BR EOF ,
+otherwise it pushes

I would put that detail at the end of the description, rather than
the beginning.  In C code, that kind of short-cutting can help
reading, but in the manual, it's better left as a detail at the end
of it, to give it less importance.

OK, but I think it would still need some sort of remark in the first sentence to indicate that it does not always apply. Maybe something along the lines of:

  normally pushes c back to stream,  ...

Then add the c==EOF exception as a new paragraph along the lines of:

  If the value of c equals that of the macro EOF, nothing is
  pushed back to the stream and an error is returned.

--
-=( Ian Abbott <abbotti@xxxxxxxxx> || MEV Ltd. is a company  )=-
-=( registered in England & Wales.  Regd. number: 02862268.  )=-
-=( Regd. addr.: S11 & 12 Building 67, Europa Business Park, )=-
-=( Bird Hall Lane, STOCKPORT, SK3 0XA, UK. || www.mev.co.uk )=-




[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux