Module Name: src
Committed By: kre
Date: Sat Nov 4 08:04:40 UTC 2017
Modified Files:
src/lib/libc/stdio: fopen.3
Log Message:
Some (mostly minor) wording improvements (IMO)
To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/lib/libc/stdio/fopen.3
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/lib/libc/stdio/fopen.3
diff -u src/lib/libc/stdio/fopen.3:1.33 src/lib/libc/stdio/fopen.3:1.34
--- src/lib/libc/stdio/fopen.3:1.33 Sat Nov 4 07:59:17 2017
+++ src/lib/libc/stdio/fopen.3 Sat Nov 4 08:04:40 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: fopen.3,v 1.33 2017/11/04 07:59:17 wiz Exp $
+.\" $NetBSD: fopen.3,v 1.34 2017/11/04 08:04:40 kre Exp $
.\"
.\" Copyright (c) 1990, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
@@ -62,29 +62,30 @@ and associates a stream with it.
The argument
.Fa mode
points to a string beginning with one of the following
-sequences (Additional characters may follow these sequences.):
+sequences, which may be followed by additional modifiers
+as indicated below:
.Bl -tag -width 4n
.It Dq Li a
-Append; open for writing.
+Append; open an existing or new file for writing in append mode.
The file is created if it does not exist.
.It Dq Li a+
-Append; open for reading and writing.
+Open for reading and writing in append mode.
The file is created if it does not exist.
.It Dq Li r
-Open for reading.
+Read; open an existing file for reading.
.It Dq Li r+
-Open for reading and writing.
+Open an existing file for reading and writing.
.It Dq Li w
-Open for writing.
-Truncate file to zero length or create file.
+Write; open an empty file for writing.
+Truncate an existing file to zero length or create a new file.
.It Dq Li w+
-Open for reading and writing.
+Open an empty file for reading and writing.
Truncate file to zero length or create file.
.El
.Pp
-Additionally, the
+After one of those, the
.Fa mode
-string can also include one of the following letters:
+string can also include one or more of the following modifier letters:
.Bl -tag -width 4n
.It Sq b
The letter
@@ -92,8 +93,11 @@ The letter
may appear either as a last character or as a character between the
characters in any of the two-character strings described above.
This is strictly for compatibility with
-.St -ansiC
-and has no effect; the
+.St -ansiC ,
+where it means open in
+.Dq binary
+mode which is identical to text mode here,
+so has no effect; the
.Sq b
is ignored.
.It Sq e
@@ -115,7 +119,7 @@ in the mode string restricts
.Fn fopen
to regular files; if the file opened is not a regular file,
.Fn fopen
-will fail.
+will close it, and fail.
This is a non
.St -ansiC
extension.
@@ -135,6 +139,9 @@ The letter
in the mode turns on exclusive open mode to the file
.Pq Dv O_EXCL
which means that the file will not be created if it already exists.
+In that case, the
+.Fn fopen
+will fail.
.El
.Pp
Any created files will have mode