Deleted Added
full compact
printf.3 (107619) printf.3 (108037)
1.\" Copyright (c) 1990, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Chris Torek and the American National Standards Committee X3,
6.\" on Information Processing Systems.
7.\"
8.\" Redistribution and use in source and binary forms, with or without

--- 20 unchanged lines hidden (view full) ---

29.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34.\" SUCH DAMAGE.
35.\"
36.\" @(#)printf.3 8.1 (Berkeley) 6/4/93
1.\" Copyright (c) 1990, 1991, 1993
2.\" The Regents of the University of California. All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Chris Torek and the American National Standards Committee X3,
6.\" on Information Processing Systems.
7.\"
8.\" Redistribution and use in source and binary forms, with or without

--- 20 unchanged lines hidden (view full) ---

29.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34.\" SUCH DAMAGE.
35.\"
36.\" @(#)printf.3 8.1 (Berkeley) 6/4/93
37.\" $FreeBSD: head/lib/libc/stdio/printf.3 107619 2002-12-04 18:57:46Z ru $
37.\" $FreeBSD: head/lib/libc/stdio/printf.3 108037 2002-12-18 12:45:11Z ru $
38.\"
39.Dd November 8, 2001
40.Dt PRINTF 3
41.Os
42.Sh NAME
43.Nm printf , fprintf , sprintf , snprintf , asprintf ,
44.Nm vprintf , vfprintf, vsprintf , vsnprintf , vasprintf
45.Nd formatted output conversion

--- 23 unchanged lines hidden (view full) ---

69.Ft int
70.Fn vasprintf "char **ret" "const char *format" "va_list ap"
71.Sh DESCRIPTION
72The
73.Fn printf
74family of functions produces output according to a
75.Fa format
76as described below.
38.\"
39.Dd November 8, 2001
40.Dt PRINTF 3
41.Os
42.Sh NAME
43.Nm printf , fprintf , sprintf , snprintf , asprintf ,
44.Nm vprintf , vfprintf, vsprintf , vsnprintf , vasprintf
45.Nd formatted output conversion

--- 23 unchanged lines hidden (view full) ---

69.Ft int
70.Fn vasprintf "char **ret" "const char *format" "va_list ap"
71.Sh DESCRIPTION
72The
73.Fn printf
74family of functions produces output according to a
75.Fa format
76as described below.
77.Fn Printf
77The
78.Fn printf
78and
79.Fn vprintf
79and
80.Fn vprintf
81functions
80write output to
81.Dv stdout ,
82the standard output stream;
83.Fn fprintf
84and
85.Fn vfprintf
86write output to the given output
87.Fa stream ;

--- 27 unchanged lines hidden (view full) ---

115and
116.Fn vsnprintf ,
117which return the number of characters that would have been printed if the
118.Fa size
119were unlimited
120(again, not including the final
121.Ql \e0 ) .
122.Pp
82write output to
83.Dv stdout ,
84the standard output stream;
85.Fn fprintf
86and
87.Fn vfprintf
88write output to the given output
89.Fa stream ;

--- 27 unchanged lines hidden (view full) ---

117and
118.Fn vsnprintf ,
119which return the number of characters that would have been printed if the
120.Fa size
121were unlimited
122(again, not including the final
123.Ql \e0 ) .
124.Pp
123.Fn Asprintf
125The
126.Fn asprintf
124and
125.Fn vasprintf
127and
128.Fn vasprintf
129functions
126set
127.Fa *ret
128to be a pointer to a buffer sufficiently large to hold the formatted string.
129This pointer should be passed to
130.Xr free 3
131to release the allocated storage when it is no longer needed.
132If sufficient space cannot be allocated,
133.Fn asprintf
134and
135.Fn vasprintf
136will return \-1 and set
137.Fa ret
138to be a
139.Dv NULL
140pointer.
141.Pp
130set
131.Fa *ret
132to be a pointer to a buffer sufficiently large to hold the formatted string.
133This pointer should be passed to
134.Xr free 3
135to release the allocated storage when it is no longer needed.
136If sufficient space cannot be allocated,
137.Fn asprintf
138and
139.Fn vasprintf
140will return \-1 and set
141.Fa ret
142to be a
143.Dv NULL
144pointer.
145.Pp
142.Fn Snprintf
146The
147.Fn snprintf
143and
144.Fn vsnprintf
148and
149.Fn vsnprintf
150functions
145will write at most
146.Fa size Ns \-1
147of the characters printed into the output string
148(the
149.Fa size Ns 'th
150character then gets the terminating
151.Ql \e0 ) ;
152if the return value is greater than or equal to the
153.Fa size
154argument, the string was too short
155and some of the printed characters were discarded.
156The output is always null-terminated.
157.Pp
151will write at most
152.Fa size Ns \-1
153of the characters printed into the output string
154(the
155.Fa size Ns 'th
156character then gets the terminating
157.Ql \e0 ) ;
158if the return value is greater than or equal to the
159.Fa size
160argument, the string was too short
161and some of the printed characters were discarded.
162The output is always null-terminated.
163.Pp
158.Fn Sprintf
164The
165.Fn sprintf
159and
160.Fn vsprintf
166and
167.Fn vsprintf
168functions
161effectively assume an infinite
162.Fa size .
163.Pp
164The format string is composed of zero or more directives:
165ordinary
166.\" multibyte
167characters (not
168.Cm % ) ,

--- 686 unchanged lines hidden ---
169effectively assume an infinite
170.Fa size .
171.Pp
172The format string is composed of zero or more directives:
173ordinary
174.\" multibyte
175characters (not
176.Cm % ) ,

--- 686 unchanged lines hidden ---