Something went wrong. Try again.
Cider Isn't Darwin Emulation, Really
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933.\" Copyright (c) 1990, 1991, 1993.\" The Regents of the University of California. All rights reserved..\".\" This code is derived from software contributed to Berkeley by.\" Chris Torek and the American National Standards Committee X3,.\" on Information Processing Systems..\".\" Redistribution and use in source and binary forms, with or without.\" modification, are permitted provided that the following conditions.\" are met:.\" 1. Redistributions of source code must retain the above copyright.\" notice, this list of conditions and the following disclaimer..\" 2. Redistributions in binary form must reproduce the above copyright.\" notice, this list of conditions and the following disclaimer in the.\" documentation and/or other materials provided with the distribution..\" 4. Neither the name of the University nor the names of its contributors.\" may be used to endorse or promote products derived from this software.\" without specific prior written permission..\".\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION).\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF.\" SUCH DAMAGE..\".\" @(#)printf.3 8.1 (Berkeley) 6/4/93.\" $FreeBSD: src/lib/libc/stdio/printf.3,v 1.64 2009/12/02 07:51:25 brueffer Exp $.\".Dd December 2, 2009.Dt PRINTF 3.Os.Sh NAME.Nm printf , fprintf , sprintf , snprintf , asprintf , dprintf ,.Nm vprintf , vfprintf, vsprintf , vsnprintf , vasprintf, vdprintf.Nd formatted output conversion.Sh LIBRARY.Lb libc.Sh SYNOPSIS.In stdio.h.Ft int.Fn printf "const char * restrict format" ....Ft int.Fn fprintf "FILE * restrict stream" "const char * restrict format" ....Ft int.Fn sprintf "char * restrict str" "const char * restrict format" ....Ft int.Fn snprintf "char * restrict str" "size_t size" "const char * restrict format" ....Ft int.Fn asprintf "char **ret" "const char *format" ....Ft int.Fn dprintf "int fd" "const char * restrict format" ....In stdarg.h.Ft int.Fn vprintf "const char * restrict format" "va_list ap".Ft int.Fn vfprintf "FILE * restrict stream" "const char * restrict format" "va_list ap".Ft int.Fn vsprintf "char * restrict str" "const char * restrict format" "va_list ap".Ft int.Fn vsnprintf "char * restrict str" "size_t size" "const char * restrict format" "va_list ap".Ft int.Fn vasprintf "char **ret" "const char *format" "va_list ap".Ft int.Fn vdprintf "int fd" "const char * restrict format" "va_list ap".Sh DESCRIPTIONThe.Fn printffamily of functions produces output according to a.Fa formatas described below.The.Fn printfand.Fn vprintffunctionswrite output to.Dv stdout ,the standard output stream;.Fn fprintfand.Fn vfprintfwrite output to the given output.Fa stream ;.Fn dprintfand.Fn vdprintfwrite output to the given file descriptor;.Fn sprintf ,.Fn snprintf ,.Fn vsprintf ,and.Fn vsnprintfwrite to the character string.Fa s ;and.Fn asprintfand.Fn vasprintfdynamically allocate a new string with.Xr malloc 3 ..PpExtended locale versions of these functions are documented in.Xr printf_l 3 .See.Xr xlocale 3for more information..PpThese functions write the output under the control of a.Fa formatstring that specifies how subsequent arguments(or arguments accessed via the variable-length argument facilities of.Xr stdarg 3 )are converted for output..PpThese functions return the number of characters printed(not including the trailing.Ql \e0used to end output to strings) or a negative value if an output error occurs,except for.Fn snprintfand.Fn vsnprintf ,which return the number of characters that would have been printed if the.Fa nwere unlimited(again, not including the final.Ql \e0 ) ..PpThe.Fn asprintfand.Fn vasprintffunctionsset.Fa *retto be a pointer to a buffer sufficiently large to hold the formatted string.This pointer should be passed to.Xr free 3to release the allocated storage when it is no longer needed.If sufficient space cannot be allocated,.Fn asprintfand.Fn vasprintfwill return \-1 and set.Fa retto be a.Dv NULLpointer..PpThe.Fn snprintfand.Fn vsnprintffunctionswill write at most.Fa n Ns \-1of the characters printed into the output string(the.Fa n Ns \'thcharacter then gets the terminating.Ql \e0 ) ;if the return value is greater than or equal to the.Fa nargument, the string was too shortand some of the printed characters were discarded.The output is always null-terminated..PpThe.Fn sprintfand.Fn vsprintffunctionseffectively assume an infinite.Fa n ..PpFor those routines that write to a user-provided character string,that string and the format strings should not overlap, as thebehavior is undefined..PpThe format string is composed of zero or more directives:ordinary.\" multibytecharacters (not.Cm % ) ,which are copied unchanged to the output stream;and conversion specifications, each of which resultsin fetching zero or more subsequent arguments.Each conversion specification is introduced bythe.Cm %character.The arguments must correspond properly (after type promotion)with the conversion specifier.After the.Cm % ,the following appear in sequence:.Bl -bullet.ItAn optional field, consisting of a decimal digit string followed by a.Cm $ ,specifying the next argument to access.If this field is not provided, the argument following the lastargument accessed will be used.Arguments are numbered starting at.Cm 1 .If unaccessed arguments in the format string are interspersed with ones thatare accessed the results will be indeterminate..ItZero or more of the following flags:.Bl -tag -width ".So \ Sc (space)".It Sq Cm #The value should be converted to an.Dq alternate form .For.Cm c , d , i , n , p , s ,and.Cm uconversions, this option has no effect.For.Cm oconversions, the precision of the number is increased to force the firstcharacter of the output string to a zero.For.Cm xand.Cm Xconversions, a non-zero result has the string.Ql 0x(or.Ql 0Xfor.Cm Xconversions) prepended to it.For.Cm a , A , e , E , f , F , g ,and.Cm Gconversions, the result will always contain a decimal point, even if nodigits follow it (normally, a decimal point appears in the results ofthose conversions only if a digit follows).For.Cm gand.Cm Gconversions, trailing zeros are not removed from the result as theywould otherwise be..It So Cm 0 Sc (zero)Zero padding.For all conversions except.Cm n ,the converted value is padded on the left with zeros rather than blanks.If a precision is given with a numeric conversion.Cm ( d , i , o , u , i , x ,and.Cm X ) ,the.Cm 0flag is ignored..It Sq Cm \-A negative field width flag;the converted value is to be left adjusted on the field boundary.Except for.Cm nconversions, the converted value is padded on the right with blanks,rather than on the left with blanks or zeros.A.Cm \-overrides a.Cm 0if both are given..It So "\ " Sc (space)A blank should be left before a positive numberproduced by a signed conversion.Cm ( a , A , d , e , E , f , F , g , G ,or.Cm i ) ..It Sq Cm +A sign must always be placed before anumber produced by a signed conversion.A.Cm +overrides a space if both are used..It Sq Cm 'Decimal conversions.Cm ( d , u ,or.Cm i )or the integral portion of a floating point conversion.Cm ( for.Cm F )should be grouped and separated by thousands usingthe non-monetary separator returned by.Xr localeconv 3 ..El.ItAn optional separator character (.Cm \ , | \; | \ : | _) used for separating multiple values when printing an AltiVec or SSE vector,or other multi-value unit..PpNOTE: This is an extension to the.Fn printfspecification.Behaviour of these values for.Fn printf is only defined for operating systems conforming to the AltiVec Technology Programming Interface Manual.(At time of writing this includes only Mac OS X 10.2 and later.).ItAn optional decimal digit string specifying a minimum field width.If the converted value has fewer characters than the field width, it willbe padded with spaces on the left (or right, if the left-adjustmentflag has been given) to fill outthe field width..ItAn optional precision, in the form of a period.Cm \&.followed by anoptional digit string.If the digit string is omitted, the precision is taken as zero.This gives the minimum number of digits to appear for.Cm d , i , o , u , x ,and.Cm Xconversions, the number of digits to appear after the decimal-point for.Cm a , A , e , E , f ,and.Cm Fconversions, the maximum number of significant digits for.Cm gand.Cm Gconversions, or the maximum number of characters to be printed from astring for.Cm sconversions..ItAn optional length modifier, that specifies the size of the argument.The following length modifiers are valid for the.Cm d , i , n , o , u , x ,or.Cm Xconversion:.Bl -column ".Cm q Em (deprecated)" ".Vt signed char" ".Vt unsigned long long" ".Vt long long *".It Sy Modifier Ta Cm d , i Ta Cm o , u , x , X Ta Cm n.It Cm hh Ta Vt "signed char" Ta Vt "unsigned char" Ta Vt "signed char *".It Cm h Ta Vt short Ta Vt "unsigned short" Ta Vt "short *".It Cm l No (ell) Ta Vt long Ta Vt "unsigned long" Ta Vt "long *".It Cm ll No (ell ell) Ta Vt "long long" Ta Vt "unsigned long long" Ta Vt "long long *".It Cm j Ta Vt intmax_t Ta Vt uintmax_t Ta Vt "intmax_t *".It Cm t Ta Vt ptrdiff_t Ta (see note) Ta Vt "ptrdiff_t *".It Cm z Ta (see note) Ta Vt size_t Ta (see note).It Cm q Em (deprecated) Ta Vt quad_t Ta Vt u_quad_t Ta Vt "quad_t *".El.PpNote:the.Cm tmodifier, when applied to a.Cm o , u , x ,or.Cm Xconversion, indicates that the argument is of an unsigned typeequivalent in size to a.Vt ptrdiff_t .The.Cm zmodifier, when applied to a.Cm dor.Cm iconversion, indicates that the argument is of a signed type equivalent insize to a.Vt size_t .Similarly, when applied to an.Cm nconversion, it indicates that the argument is a pointer to a signed typeequivalent in size to a.Vt size_t ..PpThe following length modifier is valid for the.Cm a , A , e , E , f , F , g ,or.Cm Gconversion:.Bl -column ".Sy Modifier" ".Cm a , A , e , E , f , F , g , G".It Sy Modifier Ta Cm a , A , e , E , f , F , g , G.It Cm l No (ell) Ta Vt double(ignored, same behavior as without it).It Cm L Ta Vt "long double".El.PpThe following length modifier is valid for the.Cm cor.Cm sconversion:.Bl -column ".Sy Modifier" ".Vt wint_t" ".Vt wchar_t *".It Sy Modifier Ta Cm c Ta Cm s.It Cm l No (ell) Ta Vt wint_t Ta Vt "wchar_t *".El.PpThe AltiVec Technology Programming Interface Manual also defines five additional length modifierswhich can be used (in place of the conventional length modifiers) for the printing of AltiVec or SSE vectors:.Bl -tag -compact.It Cm vTreat the argument as a vector value, unit length will be determined by the conversionspecifier (default = 16 8-bit units for all integer conversions, 4 32-bit units for floating point conversions)..It Cm vh, hvTreat the argument as a vector of 8 16-bit units..It Cm vl, lvTreat the argument as a vector of 4 32-bit units..El.PpNOTE: The vector length specifiers are extensions to the.Fn printfspecification.Behaviour of these values for.Fn printf is only defined for operating systems conforming to the AltiVec Technology Programming Interface Manual.(At time of writing this includes only Mac OS X 10.2 and later.).PpAs a further extension, for SSE2 64-bit units:.Bl -tag -compact.It Cm vll, llvTreat the argument as a vector of 2 64-bit units..El.ItA character that specifies the type of conversion to be applied..El.PpA field width or precision, or both, may be indicated byan asterisk.Ql *or an asterisk followed by one or more decimal digits and a.Ql $instead of adigit string.In this case, an.Vt intargument supplies the field width or precision.A negative field width is treated as a left adjustment flag followed by apositive field width; a negative precision is treated as though it weremissing.If a single format directive mixes positional.Pq Li nn$and non-positional arguments, the results are undefined..PpThe conversion specifiers and their meanings are:.Bl -tag -width ".Cm diouxX".It Cm diouxXThe.Vt int(or appropriate variant) argument is converted to signed decimal.Cm ( dand.Cm i ) ,unsigned octal.Pq Cm o ,unsigned decimal.Pq Cm u ,or unsigned hexadecimal.Cm ( xand.Cm X )notation.The letters.Dq Li abcdefare used for.Cm xconversions; the letters.Dq Li ABCDEFare used for.Cm Xconversions.The precision, if any, gives the minimum number of digits that mustappear; if the converted value requires fewer digits, it is padded onthe left with zeros..It Cm DOUThe.Vt "long int"argument is converted to signed decimal, unsigned octal, or unsigneddecimal, as if the format had been.Cm ld , lo ,or.Cm lurespectively.These conversion characters are deprecated, and will eventually disappear..It Cm eEThe.Vt doubleargument is rounded and converted in the style.Sm off.Oo \- Oc Ar d Li \&. Ar ddd Li e \\*[Pm] Ar dd.Sm onwhere there is one digit before thedecimal-point characterand the number of digits after it is equal to the precision;if the precision is missing,it is taken as 6; if the precision iszero, no decimal-point character appears.An.Cm Econversion uses the letter.Ql E(rather than.Ql e )to introduce the exponent.The exponent always contains at least two digits; if the value is zero,the exponent is 00..PpFor.Cm a , A , e , E , f , F , g ,and.Cm Gconversions, positive and negative infinity are represented as.Li infand.Li -infrespectively when using the lowercase conversion character, and.Li INFand.Li -INFrespectively when using the uppercase conversion character.Similarly, NaN is represented as.Li nanwhen using the lowercase conversion, and.Li NANwhen using the uppercase conversion..It Cm fFThe.Vt doubleargument is rounded and converted to decimal notation in the style.Sm off.Oo \- Oc Ar ddd Li \&. Ar ddd ,.Sm onwhere the number of digits after the decimal-point characteris equal to the precision specification.If the precision is missing, it is taken as 6; if the precision isexplicitly zero, no decimal-point character appears.If a decimal point appears, at least one digit appears before it..It Cm gGThe.Vt doubleargument is converted in style.Cm for.Cm e(or.Cm For.Cm Efor.Cm Gconversions).The precision specifies the number of significant digits.If the precision is missing, 6 digits are given; if the precision is zero,it is treated as 1.Style.Cm eis used if the exponent from its conversion is less than \-4 or greater thanor equal to the precision.Trailing zeros are removed from the fractional part of the result; adecimal point appears only if it is followed by at least one digit..It Cm aAThe.Vt doubleargument is rounded and converted to hexadecimal notation in the style.Sm off.Oo \- Oc Li 0x Ar h Li \&. Ar hhhp Oo \\*[Pm] Oc Ar d ,.Sm onwhere the number of digits after the hexadecimal-point characteris equal to the precision specification.If the precision is missing, it is taken as enough to representthe floating-point number exactly, and no rounding occurs.If the precision is zero, no hexadecimal-point character appears.The.Cm pis a literal character.Ql p ,and the exponent consists of a positive or negative signfollowed by a decimal number representing an exponent of 2.The.Cm Aconversion uses the prefix.Dq Li 0X(rather than.Dq Li 0x ) ,the letters.Dq Li ABCDEF(rather than.Dq Li abcdef )to represent the hex digits, and the letter.Ql P(rather than.Ql p )to separate the mantissa and exponent..PpNote that there may be multiple valid ways to represent floating-pointnumbers in this hexadecimal format.For example,.Li 0x1.92p+1 , 0x3.24p+0 , 0x6.48p-1 ,and.Li 0xc.9p-2are all equivalent.The format chosen depends on the internal representation of thenumber, but the implementation guarantees that the length of themantissa will be minimized.Zeroes are always represented with a mantissa of 0 (preceded by a.Ql -if appropriate) and an exponent of.Li +0 ..It Cm CTreated as.Cm cwith the.Cm l(ell) modifier..It Cm cThe.Vt intargument is converted to an.Vt "unsigned char" ,and the resulting character is written..PpIf the.Cm l(ell) modifier is used, the.Vt wint_targument shall be converted to a.Vt wchar_t ,and the (potentially multi-byte) sequence representing thesingle wide character is written, including any shift sequences.If a shift sequence is used, the shift state is also restoredto the original state after the character..It Cm STreated as.Cm swith the.Cm l(ell) modifier..It Cm sThe.Vt "char *"argument is expected to be a pointer to an array of character type (pointerto a string).Characters from the array are written up to (but not including)a terminating.Dv NULcharacter;if a precision is specified, no more than the number specified arewritten.If a precision is given, no null characterneed be present; if the precision is not specified, or is greater thanthe size of the array, the array must contain a terminating.Dv NULcharacter..PpIf the.Cm l(ell) modifier is used, the.Vt "wchar_t *"argument is expected to be a pointer to an array of wide characters(pointer to a wide string).For each wide character in the string, the (potentially multi-byte)sequence representing thewide character is written, including any shift sequences.If any shift sequence is used, the shift state is also restoredto the original state after the string.Wide characters from the array are written up to (but not including)a terminating wide.Dv NULcharacter;if a precision is specified, no more than the number of bytes specified arewritten (including shift sequences).Partial characters are never written.If a precision is given, no null characterneed be present; if the precision is not specified, or is greater thanthe number of bytes required to render the multibyte representation ofthe string, the array must contain a terminating wide.Dv NULcharacter..It Cm pThe.Vt "void *"pointer argument is printed in hexadecimal (as if by.Ql %#xor.Ql %#lx ) ..It Cm nThe number of characters written so far is stored into theinteger indicated by the.Vt "int *"(or variant) pointer argument.No argument is converted..It Cm %A.Ql %is written.No argument is converted.The complete conversion specificationis.Ql %% ..El.PpThe decimal pointcharacter is defined in the program's locale (category.Dv LC_NUMERIC ) ..PpIn no case does a non-existent or small field width cause truncation ofa numeric field; if the result of a conversion is wider than the fieldwidth, thefield is expanded to contain the conversion result..Sh EXAMPLESTo print a date and time in the form.Dq Li "Sunday, July 3, 10:02" ,where.Fa weekdayand.Fa monthare pointers to strings:.Bd -literal -offset indent#include <stdio.h>fprintf(stdout, "%s, %s %d, %.2d:%.2d\en", weekday, month, day, hour, min);.Ed.PpTo print \*(Pito five decimal places:.Bd -literal -offset indent#include <math.h>#include <stdio.h>fprintf(stdout, "pi = %.5f\en", 4 * atan(1.0));.Ed.PpTo allocate a 128 byte string and print into it:.Bd -literal -offset indent#include <stdio.h>#include <stdlib.h>#include <stdarg.h>char *newfmt(const char *fmt, ...){ char *p; va_list ap; if ((p = malloc(128)) == NULL) return (NULL); va_start(ap, fmt); (void) vsnprintf(p, 128, fmt, ap); va_end(ap); return (p);}.Ed.Sh SECURITY CONSIDERATIONSThe.Fn sprintfand.Fn vsprintffunctions are easily misused in a manner which enables malicious usersto arbitrarily change a running program's functionality througha buffer overflow attack.Because.Fn sprintfand.Fn vsprintfassume an infinitely long string,callers must be careful not to overflow the actual space;this is often hard to assure.For safety, programmers should use the.Fn snprintfinterface instead.For example:.Bd -literalvoidfoo(const char *arbitrary_string, const char *and_another){ char onstack[8];
#ifdef BAD /* * This first sprintf is bad behavior. Do not use sprintf! */ sprintf(onstack, "%s, %s", arbitrary_string, and_another);#else /* * The following two lines demonstrate better use of * snprintf(). */ snprintf(onstack, sizeof(onstack), "%s, %s", arbitrary_string, and_another);#endif}.Ed.PpThe.Fn printfand.Fn sprintffamily of functions are also easily misused in a mannerallowing malicious users to arbitrarily change a running program'sfunctionality by either causing the programto print potentially sensitive data.Dq "left on the stack" ,or causing it to generate a memory fault or bus errorby dereferencing an invalid pointer..Pp.Cm %ncan be used to write arbitrary data to potentially carefully-selectedaddresses.Programmers are therefore strongly advised to never pass untrusted stringsas the.Fa formatargument, as an attacker can put format specifiers in the stringto mangle your stack,leading to a possible security hole.This holds true even if the string was built using a function like.Fn snprintf ,as the resulting string may still contain user-supplied conversion specifiersfor later interpolation by.Fn printf ..PpAlways use the proper secure idiom:.Pp.Dl "snprintf(buffer, sizeof(buffer), \*q%s\*q, string);".Sh COMPATIBILITYThe conversion formats.Cm \&%D , \&%O ,and.Cm %Uare not standard andare provided only for backward compatibility.The effect of padding the.Cm %pformat with zeros (either by the.Cm 0flag or by specifying a precision), and the benign effect (i.e., none)of the.Cm #flag on.Cm %nand.Cm %pconversions, as well as othernonsensical combinations such as.Cm %Ld ,are not standard; such combinationsshould be avoided..Sh ERRORSIn addition to the errors documented for the.Xr write 2system call, the.Fn printffamily of functions may fail if:.Bl -tag -width Er.It Bq Er EILSEQAn invalid wide character code was encountered..It Bq Er ENOMEMInsufficient storage space is available..El.Sh SEE ALSO.Xr printf 1 ,.Xr printf_l 3 ,.Xr fmtcheck 3 ,.Xr scanf 3 ,.Xr setlocale 3 ,.Xr stdarg 3 ,.Xr wprintf 3.Sh STANDARDSSubject to the caveats noted in the.Sx BUGSsection below, the.Fn fprintf ,.Fn printf ,.Fn sprintf ,.Fn vprintf ,.Fn vfprintf ,and.Fn vsprintffunctionsconform to.St -ansiCand.St -isoC-99 .With the same reservation, the.Fn snprintfand.Fn vsnprintffunctions conform to.St -isoC-99 ,while.Fn dprintfand.Fn vdprintfconform to.St -p1003.1-2008 ..Sh HISTORYThe functions.Fn asprintfand.Fn vasprintffirst appeared in the.Tn GNU Clibrary.These were implemented by.An Peter Wemm Aq peter@FreeBSD.orgin.Fx 2.2 ,but were later replaced with a different implementationfrom.An Todd C. Miller Aq Todd.Miller@courtesan.comfor.Ox 2.3 .The.Fn dprintfand.Fn vdprintffunctions were added in.Fx 8.0 ..Sh BUGSThe.Nmfamily of functions do not correctly handle multibyte characters in the.Fa formatargument.