[PATCH v4] 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.
v4: Rebased off master branch.
---
 man/man3/fgetc.3 | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/man/man3/fgetc.3 b/man/man3/fgetc.3
index 19aaecd16..8841bcf2e 100644
--- a/man/man3/fgetc.3
+++ b/man/man3/fgetc.3
@@ -62,7 +62,7 @@ A terminating null byte (\[aq]\[rs]0\[aq])
 is stored after the last character in the buffer.
 .P
 .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.
 .P
 Calls to the functions described here can be mixed with each other and with
 calls to other input functions from the
-- 
2.43.0





[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