Hello Elliot, On 4/10/19 9:30 PM, enh wrote:
Where is the initial read position for an "a+" stream? POSIX leaves this unspecified. Most BSD man pages are silent, and MacOS has the ambiguous "The stream is positioned at the end of the file", not differentiating between reads and writes other than to say that fseek(3) does not affect writes. glibc's documentation explicitly specifies that the initial read position is the beginning of the file. My new wording is based on the BSD implementations, so you may prefer to replace the non-glibc section with "unspecified", or indeed remove all claims about the initial read position. --- man3/fopen.3 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/man3/fopen.3 b/man3/fopen.3 index a0f564c39..5f4abb8ea 100644 --- a/man3/fopen.3 +++ b/man3/fopen.3 @@ -100,8 +100,10 @@ The stream is positioned at the end of the file. .B a+ Open for reading and appending (writing at end of file). The file is created if it does not exist. -The initial file position for reading is at the beginning of the file, -but output is always appended to the end of the file. +Output is always appended to the end of the file. +For glibc, the initial file position for reading is at +the beginning of the file, but for Android/BSD/MacOS, the +initial file position for reading is the end of the file. .PP The .I mode
Thanks! Patch applied. And I added a sentence noting that POSIX is silent on this detail. Cheers, Michael