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

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

 



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>
---
v2: Correct English grammar usage for "otherwise".
v3: Move detail of EOF special case to the end of the paragraph to give
    it less prominence, as suggested by Alex.
---
 man3/fgetc.3 | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/man3/fgetc.3 b/man3/fgetc.3
index 75dcaeaf6..a15d73b15 100644
--- a/man3/fgetc.3
+++ b/man3/fgetc.3
@@ -62,7 +62,7 @@ A terminating null byte (\[aq]\e0\[aq])
 is stored after the last character in the buffer.
 .PP
 .BR ungetc ()
-pushes
+normally pushes
 .I c
 back to
 .IR stream ,
@@ -71,6 +71,13 @@ cast to
 where it is available for subsequent read operations.
 Pushed-back characters
 will be returned in reverse order; only one pushback is guaranteed.
+If the value of
+.I c
+equals that of the macro
+.BR EOF ,
+nothing is pushed back to
+.I stream
+and an error is returned.
 .PP
 Calls to the functions described here can be mixed with each other and with
 calls to other input functions from the
-- 
2.39.2




[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