]> git.saurik.com Git - apple/libc.git/blob - stdio/FreeBSD/fopen.3.patch
Libc-763.11.tar.gz
[apple/libc.git] / stdio / FreeBSD / fopen.3.patch
1 --- fopen.3.bsdnew 2009-11-11 13:33:06.000000000 -0800
2 +++ fopen.3 2009-11-11 13:33:07.000000000 -0800
3 @@ -36,8 +36,8 @@
4 .Dt FOPEN 3
5 .Os
6 .Sh NAME
7 -.Nm fopen ,
8 .Nm fdopen ,
9 +.Nm fopen ,
10 .Nm freopen
11 .Nd stream open functions
12 .Sh LIBRARY
13 @@ -45,17 +45,27 @@
14 .Sh SYNOPSIS
15 .In stdio.h
16 .Ft FILE *
17 -.Fn fopen "const char * restrict path" "const char * restrict mode"
18 +.Fo fdopen
19 +.Fa "int fildes"
20 +.Fa "const char *mode"
21 +.Fc
22 .Ft FILE *
23 -.Fn fdopen "int fildes" "const char *mode"
24 +.Fo fopen
25 +.Fa "const char *restrict filename"
26 +.Fa "const char *restrict mode"
27 +.Fc
28 .Ft FILE *
29 -.Fn freopen "const char *path" "const char *mode" "FILE *stream"
30 +.Fo freopen
31 +.Fa "const char *restrict filename"
32 +.Fa "const char *restrict mode"
33 +.Fa "FILE *restrict stream"
34 +.Fc
35 .Sh DESCRIPTION
36 The
37 .Fn fopen
38 function
39 opens the file whose name is the string pointed to by
40 -.Fa path
41 +.Fa filename
42 and associates a stream with it.
43 .Pp
44 The argument
45 @@ -103,6 +113,17 @@ This is strictly for compatibility with
46 .St -isoC
47 and has no effect; the ``b'' is ignored.
48 .Pp
49 +Finally, as an extension to the standards (and thus may not be portable),
50 +.Fa mode
51 +string may end with the letter ``x'', which insists on creating a new file
52 +when used with ``w'' or ``a''.
53 +If
54 +.Fa path
55 +exists, then an error is returned (this is the equivalent of specifying
56 +.Dv O_EXCL
57 +with
58 +.Xr open 2 ) .
59 +.Pp
60 Any created files will have mode
61 .Pf \\*q Dv S_IRUSR
62 \&|
63 @@ -144,7 +165,7 @@ The
64 .Fn freopen
65 function
66 opens the file whose name is the string pointed to by
67 -.Fa path
68 +.Fa filename
69 and associates the stream pointed to by
70 .Fa stream
71 with it.
72 @@ -156,7 +177,7 @@ argument is used just as in the
73 function.
74 .Pp
75 If the
76 -.Fa path
77 +.Fa filename
78 argument is
79 .Dv NULL ,
80 .Fn freopen
81 @@ -200,7 +221,7 @@ or
82 .Sh RETURN VALUES
83 Upon successful completion
84 .Fn fopen ,
85 -.Fn fdopen
86 +.Fn fdopen ,
87 and
88 .Fn freopen
89 return a