diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 19:41:07 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 19:41:07 +0000 |
commit | 3af6d22bb3850ab2bac67287e3a3d3b0e32868e5 (patch) | |
tree | 3ee7a3ec64525911fa865bb984c86d997d855527 /man3/fopencookie.3 | |
parent | Adding debian version 6.05.01-1. (diff) | |
download | manpages-3af6d22bb3850ab2bac67287e3a3d3b0e32868e5.tar.xz manpages-3af6d22bb3850ab2bac67287e3a3d3b0e32868e5.zip |
Merging upstream version 6.7.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'man3/fopencookie.3')
-rw-r--r-- | man3/fopencookie.3 | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/man3/fopencookie.3 b/man3/fopencookie.3 index 61f77bc..5d5d1d3 100644 --- a/man3/fopencookie.3 +++ b/man3/fopencookie.3 @@ -4,9 +4,9 @@ .\" .\" SPDX-License-Identifier: Linux-man-pages-copyleft .\" -.TH fopencookie 3 2023-07-20 "Linux man-pages 6.05.01" +.TH fopencookie 3 2023-12-29 "Linux man-pages 6.7" .SH NAME -fopencookie \- opening a custom stream +fopencookie \- open a custom stream .SH LIBRARY Standard C library .RI ( libc ", " \-lc ) @@ -15,7 +15,7 @@ Standard C library .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */" .B #define _FILE_OFFSET_BITS 64 .B #include <stdio.h> -.PP +.P .BI "FILE *fopencookie(void *restrict " cookie ", const char *restrict " mode , .BI " cookie_io_functions_t " io_funcs ); .fi @@ -31,7 +31,7 @@ is used to implement .BR fmemopen (3), which provides a stream interface to data that is stored in a buffer in memory. -.PP +.P In order to create a custom stream the programmer must: .IP \[bu] 3 Implement four "hook" functions that are used internally by the @@ -52,7 +52,7 @@ Call .BR fopencookie () to open a new stream and associate the cookie and hook functions with that stream. -.PP +.P The .BR fopencookie () function serves a purpose similar to @@ -60,14 +60,14 @@ function serves a purpose similar to it opens a new stream and returns a pointer to a .I FILE object that is used to operate on that stream. -.PP +.P The .I cookie argument is a pointer to the caller's cookie structure that is to be associated with the new stream. This pointer is supplied as the first argument when the standard I/O library invokes any of the hook functions described below. -.PP +.P The .I mode argument serves the same purpose as for @@ -83,13 +83,13 @@ and See .BR fopen (3) for details. -.PP +.P The .I io_funcs argument is a structure that contains four fields pointing to the programmer-defined hook functions that are used to implement this stream. The structure is defined as follows -.PP +.P .in +4n .EX typedef struct { @@ -100,7 +100,7 @@ typedef struct { } cookie_io_functions_t; .EE .in -.PP +.P The four fields are as follows: .TP .I cookie_read_function_t *read @@ -257,7 +257,6 @@ T{ .BR fopencookie () T} Thread safety MT-Safe .TE -.sp 1 .SH STANDARDS GNU. .SH EXAMPLES @@ -269,7 +268,7 @@ The program writes its command-line arguments to the stream, and then seeks through the stream reading two out of every five characters and writing them to standard output. The following shell session demonstrates the use of the program: -.PP +.P .in +4n .EX .RB "$" " ./a.out \[aq]hello world\[aq]" @@ -279,7 +278,7 @@ The following shell session demonstrates the use of the program: Reached end of file .EE .in -.PP +.P Note that a more general version of the program below could be improved to more robustly handle various error situations (e.g., opening a stream with a cookie that already has an open stream; |