]> git.saurik.com Git - apple/libc.git/blame - stdio/FreeBSD/fopen.3.patch
Libc-583.tar.gz
[apple/libc.git] / stdio / FreeBSD / fopen.3.patch
CommitLineData
224c7076
A
1--- fopen.3 2003-05-20 15:22:41.000000000 -0700
2+++ fopen.3.edit 2006-06-28 16:55:52.000000000 -0700
3@@ -40,8 +40,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@@ -49,17 +49,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@@ -107,6 +117,17 @@
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@@ -148,7 +169,7 @@
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@@ -160,7 +181,7 @@
73 function.
74 .Pp
75 If the
76-.Fa path
77+.Fa filename
78 argument is
79 .Dv NULL ,
80 .Fn freopen
81@@ -204,7 +225,7 @@
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