A NOTE has been added to this issue. ====================================================================== http://austingroupbugs.net/view.php?id=701 ====================================================================== Reported By: geoffclare Assigned To: ====================================================================== Project: 1003.1(2013)/Issue7+TC1 Issue ID: 701 Category: System Interfaces Type: Error Severity: Objection Priority: normal Status: New Name: Geoff Clare Organization: The Open Group User Reference: Section: ungetc(), ungetwc() Page Number: 2170, 2172 Line Number: 69084, 69130 Interp Status: --- Final Accepted Text: ====================================================================== Date Submitted: 2013-05-20 11:20 UTC Last Modified: 2019-08-30 09:26 UTC ====================================================================== Summary: unget[w]c() and file position after discarding push back ====================================================================== Relationships ID Summary ---------------------------------------------------------------------- related to 0000087 fflush and ungetc related to 0000816 does fflush(NULL) affect seekable read ... ======================================================================
---------------------------------------------------------------------- (0004546) geoffclare (manager) - 2019-08-30 09:26 http://austingroupbugs.net/view.php?id=701#c4546 ---------------------------------------------------------------------- Proposed changes (implementing the direction agreed in 2019-08-29 meeting) ... On page 2193 line 70128 section ungetc(), change:<blockquote>A successful call to <i>ungetc</i>() shall clear the end-of-file indicator for the stream. The value of the file-position indicator for the stream after all pushed-back bytes have been read, or discarded by calling <i>fseek</i>(), <i>fseeko</i>(), <i>fsetpos</i>(), or <i>rewind</i>() (but not <i>fflush</i>()), shall be the same as it was before the bytes were pushed back. The file-position indicator is decremented by each successful call to <i>ungetc</i>(); if its value was 0 before a call, its value is unspecified after the call.</blockquote>to:<blockquote>A successful call to <i>ungetc</i>() shall clear the end-of-file indicator for the stream. The file-position indicator for the stream shall be decremented by each successful call to <i>ungetc</i>(); if its value was 0 before a call, its value is unspecified after the call. The value of the file-position indicator after all pushed-back bytes have been read shall be the same as it was before the bytes were pushed back. </blockquote> On page 2193 line 70143 section ungetc(), change RATIONALE from "None" to:<blockquote>The C standard includes the text "The value of the file position indicator for the stream after reading or discarding all pushed-back characters shall be the same as it was before the characters were pushed back." POSIX.1 omits "or discarding" from this because it is redundant - in the C standard the discarding is done by file positioning functions and does not affect the position set by those functions. In particular, a relative seek using <i>fseek</i>() or <i>fseeko</i>() with SEEK_CUR adjusts the position relative to the position on entry to the function, not the position after the pushed-back bytes have been discarded. POSIX.1 also requires <i>fflush</i>() to discard pushed back bytes in situations where the C standard says the behavior of <i>fflush</i>() is undefined.</blockquote> On page 2195 line 70175 section ungetwc(), change:<blockquote>A successful call to <i>ungetwc</i>() shall clear the end-of-file indicator for the stream. The value of the file-position indicator for the stream after all pushed-back characters have been read, or discarded by calling <i>fseek</i>(), <i>fseeko</i>(), <i>fsetpos</i>(), or <i>rewind</i>() (but not <i>fflush</i>()), shall be the same as it was before the characters were pushed back. The file-position indicator is decremented (by one or more) by each successful call to <i>ungetwc</i>(); if its value was 0 before a call, its value is unspecified after the call.</blockquote>to:<blockquote>A successful call to <i>ungetwc</i>() shall clear the end-of-file indicator for the stream. The file-position indicator for the stream shall be decremented (by one or more) by each successful call to <i>ungetwc</i>(); if its value was 0 before a call, its value is unspecified after the call. The value of the file-position indicator after all pushed-back characters have been read shall be the same as it was before the characters were pushed back. </blockquote> On page 2195 line 70193 section ungetwc(), change RATIONALE from "None" to:<blockquote>The C standard includes the text "The value of the file position indicator for the stream after reading or discarding all pushed-back wide characters shall be the same as it was before the wide characters were pushed back." POSIX.1 omits "or discarding" from this because it is redundant - in the C standard the discarding is done by file positioning functions and does not affect the position set by those functions. In particular, a relative seek using <i>fseek</i>() or <i>fseeko</i>() with SEEK_CUR adjusts the position relative to the position on entry to the function, not the position after the pushed-back wide characters have been discarded. POSIX.1 also requires <i>fflush</i>() to discard pushed back wide characters in situations where the C standard says the behavior of <i>fflush</i>() is undefined.</blockquote> Issue History Date Modified Username Field Change ====================================================================== 2013-05-20 11:20 geoffclare New Issue 2013-05-20 11:20 geoffclare Name => Geoff Clare 2013-05-20 11:20 geoffclare Organization => The Open Group 2013-05-20 11:20 geoffclare Section => ungetc(), ungetwc() 2013-05-20 11:20 geoffclare Page Number => 2170, 2172 2013-05-20 11:20 geoffclare Line Number => 69084, 69130 2013-05-20 11:20 geoffclare Interp Status => --- 2013-05-20 11:20 geoffclare Tag Attached: c99 2014-04-10 14:54 nick Note Added: 0002218 2016-09-02 15:29 nick Note Added: 0003373 2019-08-29 16:09 eblake Relationship added related to 0000816 2019-08-29 16:21 eblake Relationship added related to 0000087 2019-08-30 09:26 geoffclare Note Added: 0004546 ======================================================================