aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Kerrisk <mtk.manpages@gmail.com>2016-03-09 03:37:12 +0100
committerMichael Kerrisk <mtk.manpages@gmail.com>2016-03-09 03:42:26 +0100
commit58c55bb87bbeab19268b6669d90154b6fd384239 (patch)
treee3893df227090a0cd61b9e0d1c9b6271c8512a8d
parent02989b144ef1d25ef99feb3003a4e5dcf85ac728 (diff)
downloadman-pages-58c55bb87bbeab19268b6669d90154b6fd384239.tar.gz
fmemopen.3: Greatly expand description of 'mode' argument
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
-rw-r--r--man3/fmemopen.342
1 files changed, 30 insertions, 12 deletions
diff --git a/man3/fmemopen.3 b/man3/fmemopen.3
index 5fb7fda2cf..444b19356c 100644
--- a/man3/fmemopen.3
+++ b/man3/fmemopen.3
@@ -51,19 +51,37 @@ function opens a stream that permits the access specified by
The stream allows I/O to be performed on the string or memory buffer
pointed to by
.IR buf .
-This buffer must be at least
-.I size
-bytes long.
-.PP
-The argument
-.I mode
-is the same as for
-.BR fopen (3).
-If
+
+The
.I mode
-specifies an append mode, then the initial file position is set to
-the location of the first null byte (\(aq\\0\(aq) in the buffer;
-otherwise the initial file position is set to the start of the buffer.
+argument specifies the semantics of I/O on the stream,
+and is one of the following:
+.TP 8
+.I r
+The stream is opened for reading.
+.TP
+.I w
+The stream is opened for writing.
+.TP
+.I a
+Append; open the stream for writing,
+with the file initial position set to the first null byte.
+.TP
+.I r+
+Open the stream for reading and writing.
+.TP
+.I w+
+Open the stream for reading and writing.
+The buffer contents are truncated
+(i.e., \(aq\\0\(aq is placed in the first byte of the buffer).
+.TP
+.I a+
+Append; open the stream for reading and writing,
+with the file initial position set to the first null byte.
+.PP
+In all modes other than append,
+the initial position is set to the start of the buffer.
+.PP
Since glibc 2.9,
the letter \(aqb\(aq may be specified as the second character in
.IR mode .