]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man3/fopencookie.3
err.3: EXAMPLES: use EXIT_FAILURE rather than 1 as exit status
[thirdparty/man-pages.git] / man3 / fopencookie.3
index 0586dd20918b4c090a403bb27e6195c095efd93b..f7803936ce60b47b08e96f72626cc8f098cc6216 100644 (file)
@@ -23,7 +23,7 @@
 .\" the source, must acknowledge the copyright and authors of this work.
 .\" %%%LICENSE_END
 .\"
-.TH FOPENCOOKIE 3 2015-03-02 "Linux" "Linux Programmer's Manual"
+.TH FOPENCOOKIE 3 2020-04-11 "Linux" "Linux Programmer's Manual"
 .SH NAME
 fopencookie \- opening a custom stream
 .SH SYNOPSIS
@@ -104,18 +104,18 @@ The
 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
 .in +4n
-.nf
-
+.EX
 typedef struct {
     cookie_read_function_t  *read;
     cookie_write_function_t *write;
     cookie_seek_function_t  *seek;
     cookie_close_function_t *close;
 } cookie_io_functions_t;
-
-.fi
+.EE
 .in
+.PP
 The four fields are as follows:
 .TP
 .I cookie_read_function_t *read
@@ -183,7 +183,7 @@ argument specifies the new file offset depending on which
 of the following three values is supplied in
 .IR whence :
 .RS
-.TP 10
+.TP
 .B SEEK_SET
 The stream offset should be set
 .I *offset
@@ -256,7 +256,7 @@ T}  Thread safety   MT-Safe
 .TE
 .SH CONFORMING TO
 This function is a nonstandard GNU extension.
-.SH EXAMPLE
+.SH EXAMPLES
 The program below implements a custom stream whose functionality
 is similar (but not identical) to that available via
 .BR fmemopen (3).
@@ -265,17 +265,17 @@ 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
 .in +4n
-.nf
-
+.EX
 .RB "$" " ./a.out \(aqhello world\(aq"
 /he/
 / w/
 /d/
 Reached end of file
-
-.fi
+.EE
 .in
+.PP
 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;
@@ -436,11 +436,11 @@ main(int argc, char *argv[])
             exit(EXIT_FAILURE);
         }
         if (nread == 0) {
-            printf("Reached end of file\\n");
+            printf("Reached end of file\en");
             break;
         }
 
-        printf("/%.*s/\\n", nread, buf);
+        printf("/%.*s/\en", nread, buf);
     }
 
     exit(EXIT_SUCCESS);