History log of /freebsd-current/lib/libc/stdio/printf.3
Revision Date Author Comments
# dc36d6f9 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

lib: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# bce0bef3 07-Sep-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

libc: Implement N2680.

This adds specific width length modifiers in the form of wN and wfN (where N is 8, 16, 32, or 64) which allow printing intN_t and int_fastN_t without resorting to casts or PRI macros.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D41725


# 76edfabb 28-Aug-2023 Dag-Erling Smørgrav <des@FreeBSD.org>

libc: Document support for binary integers.

Reviewed by: debdrup, emaste
Differential Revision: https://reviews.freebsd.org/D41522


# b2c76c41 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line nroff pattern

Remove /^\.\\"\s*\$FreeBSD\$$\n/


# e95725fe 22-May-2018 Konstantin Belousov <kib@FreeBSD.org>

Implement printf(3) family %m format string extension.

Reviewed by: ed, dim (code only)
Sponsored by: Mellanox Technologies
MFC after: 1 week


# 604f1c41 17-Apr-2018 Edward Tomasz Napierala <trasz@FreeBSD.org>

Don't put multiple names on a single .Nm line. This fixes apropos(1)
output, from this:

strnlen, strlen, strlen,(3) - find length of string │·······

... to this:

strlen, strnlen(3) - find length of string

PR: 223525
MFC after: 2 weeks


# fbbd9655 28-Feb-2017 Warner Losh <imp@FreeBSD.org>

Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by: Jan Schaumann <jschauma@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96


# dd47921e 29-Jul-2016 Baptiste Daroussin <bapt@FreeBSD.org>

Remove _WITH_GETLINE and _WITH_DPRINTF guards

When adding getline(3) and dprintf(3) into libc, those guards were added
to prevent breaking too many ports.

7 years later the ports tree have been fixed, it is time to remove this
FreeBSDism

While here remove the extra parenthesis surrounding dprintf(3)


# 8fbf3d50 23-Jun-2014 Baptiste Daroussin <bapt@FreeBSD.org>

use .Mt to mark up email addresses consistently (part4)

PR: 191174
Submitted by: Franco Fichtner <franco at lastsummer.de>


# a012e048 07-Nov-2012 Greg Lehey <grog@FreeBSD.org>

Clarify that the ' flag is an apostrophe.

MFC after: 2 weeks


# 31fe39ed 21-Apr-2012 David Schultz <das@FreeBSD.org>

- Fix the claim that the output is always null-terminated. This isn't
true if the size is zero.
- Fix a claim that sprintf() is the same as snprintf() with an
infinite size. It's equivalent to snprintf() with a size of
INT_MAX + 1.
- Document the return values in the return values section.
- Document the possible errno value of EOVERFLOW.

MFC after: 2 weeks


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# 5512804b 11-Sep-2010 Rebecca Cran <brucec@FreeBSD.org>

Revert changes of 'assure' to 'ensure' made in r211936.

Approved by: rrs (mentor)


# e7f8dd75 28-Aug-2010 Rebecca Cran <brucec@FreeBSD.org>

Fix incorrect usage of 'assure' and 'insure'.

Approved by: rrs (mentor)


# 0afc94c1 12-May-2010 Ulrich Spörlein <uqs@FreeBSD.org>

mdoc: move CAVEATS, BUGS and SECURITY CONSIDERATIONS sections to the
bottom of the manpages and order them consistently.

GNU groff doesn't care about the ordering, and doesn't even mention
CAVEATS and SECURITY CONSIDERATIONS as common sections and where to put
them.

Found by: mdocml lint run
Reviewed by: ru


# 488704b2 11-May-2010 Ulrich Spörlein <uqs@FreeBSD.org>

mdoc: use macro for +- that is understood by mdocml

Reviewed by: brueffer


# 6a18a772 05-Apr-2010 David E. O'Brien <obrien@FreeBSD.org>

I feel this wording of the history is more clear.
ANSIfy vasprintf() while I'm here.


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# e363756c 15-Feb-2010 Ruslan Ermilov <ru@FreeBSD.org>

%U was macroized in mdoc(7), escape.


# 02a7ccf7 07-Dec-2009 Christian Brueffer <brueffer@FreeBSD.org>

MFC: r200019

Fix the dprintf() prototype.


# da618643 02-Dec-2009 Christian Brueffer <brueffer@FreeBSD.org>

Fix the dprintf() prototype.

PR: 141087
Submitted by: Jeremy Huddleston <jeremyhu@apple.com>
MFC after: 3 days


# ad760e6f 03-Mar-2009 David Schultz <das@FreeBSD.org>

Add dprintf() and vdprintf() from POSIX.1-2008. Like getline(),
dprintf() is a simple wrapper around another function, so we may as
well implement it. But also like getline(), we can't prototype it by
default right now because it would break too many ports.


# aa83f5ff 27-Jan-2009 David Schultz <das@FreeBSD.org>

Update the manpage to reflect r145172.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# e058c00c 11-Apr-2008 David Schultz <das@FreeBSD.org>

Updates for changes in the way printf() handles hex floating point
numbers.


# c879ae35 08-Jan-2007 Warner Losh <imp@FreeBSD.org>

Per Regents of the University of Calfornia letter, remove advertising
clause.

# If I've done so improperly on a file, please let me know.


# 6595b51a 05-Sep-2005 Tim J. Robbins <tjr@FreeBSD.org>

Remove references to nonexistent "FreeBSD Security Architecture" document.


# df103a15 16-Oct-2004 Stefan Farfeleder <stefanf@FreeBSD.org>

Document that the length modifier l is ignored for floating point
conversion specifiers (a, A, e, E, f, F, g and G).


# 33992dc0 30-Jun-2004 Ruslan Ermilov <ru@FreeBSD.org>

Markup, grammar, and spelling fixes.


# e18c6616 19-Jan-2004 David Schultz <das@FreeBSD.org>

Bring the *printf(3) documentation up to date with the code:

- Update and improve the documentation for %[aA]
o Like %[eE], %[aA] may round the result if a precision is specified.
o Grammar police: Fix a split infinitive.
o The FreeBSD implementation does better than the minimum required
by C99 (literal translation of the mantissa). The digit before
the hexadecimal-point is never 0 unless the number itself is 0.
o Clarify that the exponent field represents a decimal exponent of 2.
o Discuss the fact that multiple valid representations are possible.
o Remove the entry in the BUGS section claiming that %[aA] is not
implemented.

- Remove the entry in the BUGS section claiming that the ' flag for
printing thousands separators is unimplemented for floating-point.

- Remove the entry in the BUGS section claiming that the L modifier
reduces the precision to "double" before conversion.


# e2b090f3 05-Jan-2003 Tim J. Robbins <tjr@FreeBSD.org>

Note that the printf(3) and scanf(3) family of functions don't deal with
multibyte characters in the format string correctly.


# 4aca04ee 20-Dec-2002 Tim J. Robbins <tjr@FreeBSD.org>

Document the fact that the printf() family of functions return negative
values (EOF in our case) on error, and some of the possible errno values
in an Errors section.

PR: 39257


# 1fae73b1 17-Dec-2002 Ruslan Ermilov <ru@FreeBSD.org>

mdoc(7) police: "The .Fn function".


# ae828962 04-Dec-2002 Ruslan Ermilov <ru@FreeBSD.org>

Consistently mark std(in|out|err) with .Dv, because that's how they
are marked up in stdio(3), and because they are defined expressions
of type "FILE *".

Approved by: re


# 9619813d 19-Oct-2002 Tim J. Robbins <tjr@FreeBSD.org>

Cross-reference fmtcheck(3).


# 118bb75e 19-Oct-2002 Tim J. Robbins <tjr@FreeBSD.org>

Indent code example with one tab, not two, for consistency with the rest.


# 38b5abad 24-Sep-2002 Tim J. Robbins <tjr@FreeBSD.org>

Add cross-references between wide character and single-byte character
versions of printf() and scanf().


# b9aac308 18-Sep-2002 Tim J. Robbins <tjr@FreeBSD.org>

Implement the %ls and %lc conversions for printing wide character strings
and wide characters. These were already documented in the manual page,
with an entry mentioning that they were not implemented yet. The XSI
%S and %C synoyms have not been added.


# 58d38e25 06-Sep-2002 Tim J. Robbins <tjr@FreeBSD.org>

Style: One space between "restrict" qualifier and "*".


# f8418db7 15-Aug-2002 Robert Drehmel <robert@FreeBSD.org>

- For compliance with IEEE Std 1003.1-2001, add the 'restrict'
qualifier to function prototypes and definitions where
appropriate using the '__restrict' macro.
- Update the manual page.


# 71a00a44 15-Aug-2002 Robert Drehmel <robert@FreeBSD.org>

- Introduce the 'restrict' qualifier to function prototypes and
definitions to comply with IEEE Std 1003.1-2001.
- Update the manual pages.


# 2b239dd1 11-Aug-2002 Jens Schweikhardt <schweikh@FreeBSD.org>

Fix typos; each file has at least one s/seperat/separat/
(I skipped those in contrib/, gnu/ and crypto/)
While I was at it, fixed a lot more found by ispell that I
could identify with certainty to be errors. All of these
were in comments or text, not in actual code.

Suggested by: bde
MFC after: 3 days


# a8272f71 09-Aug-2002 Ruslan Ermilov <ru@FreeBSD.org>

mdoc(7) police: punctuation.


# c98a4bf3 15-Jul-2002 Garrett Wollman <wollman@FreeBSD.org>

Don't claim to fully implement C99 in the STANDARDS section and then disclaim
compliance in the BUGS section immediately below.


# 1b5c321d 18-Jun-2002 Chris Costello <chris@FreeBSD.org>

Fix style and wording bugs introduced in my last commit.

Sponsored by: DARPA, NAI Labs


# 5f9c048c 15-Jun-2002 Chris Costello <chris@FreeBSD.org>

o Move more information from BUGS into SECURITY CONSIDERATIONS and
condense the redundant bits.
o Provide an example for using snprintf over sprintf. This may be
supplemented with an asprintf() example soon.

Sponsored by: DARPA, NAI Labs


# 7bc78691 13-Jun-2002 Chris Costello <chris@FreeBSD.org>

Include information on the dangers of passing a user-supplied string as
a format string. This will later on be changed to a reference to the
FreeBSD Security Architecture after it has been committed.

PR: docs/39320
Sposnored by: DARPA, NAI Labs


# ce9df6ee 09-Jan-2002 Ruslan Ermilov <ru@FreeBSD.org>

mdoc(7) police:

Stop abusing the .%J macro for where the .Pa macro should have been used.


# e125c135 06-Jan-2002 Chris Costello <chris@FreeBSD.org>

Add new "SECURITY CONSIDERATIONS" sections.

Obtained from: TrustedBSD Project
Sponsored by: DARPA, NAI Labs


# 2554caf2 12-Dec-2001 Ruslan Ermilov <ru@FreeBSD.org>

mdoc(7) police: Minor formatting nits and optimizations to rev. 1.34.


# 828829cd 06-Dec-2001 Bill Fenner <fenner@FreeBSD.org>

Remove blank line.


# 7735bb0f 29-Nov-2001 Bill Fenner <fenner@FreeBSD.org>

Implement several of the c99 updates to printf(3):
- New length modifiers: hh, j, t, z.
- New flag: '. Note that %'f is not yet implemented.
- Use "inf"/"nan" for efg formats, "INF"/"NAN" for EFG formats.
- Implemented %q in terms of %ll; if "quad_t" is not "long long"
%q will break.

Still to do:
- %C, %S, %lc, %ls (wide character support)
- %'f (thousands in integer portion of %f)
- %a/%A (exact hex representation of floating-point numbers)

Garrett Wollman wrote the first version of the vfprintf.c update;
Mike Barcroft wrote the first version of the printf.3 changes.


# 32eef9ae 01-Oct-2001 Ruslan Ermilov <ru@FreeBSD.org>

mdoc(7) police: Use the new .In macro for #include statements.


# 4988599f 04-Jul-2001 Ruslan Ermilov <ru@FreeBSD.org>

mdoc(7) police: fixed/simplified formatting.


# 32b21f09 13-Jun-2001 Jens Schweikhardt <schweikh@FreeBSD.org>

Add description for the 'll' modifier for long long. In essence a copy
from the 'l' description with s/long/long long/g.

PR: 27017
Submitted by: Guy Harris <guy@alum.mit.edu>
MFC after: 2 weeks


# 656f411d 05-Jun-2001 Warner Losh <imp@FreeBSD.org>

Back out my changes describing how snprintf nul terminates. It
was from the iso standard. Keep the sentence that says it is always
NUL terminated to make sure that people understand that.

Requested by: bde


# 890d5b43 04-Jun-2001 Warner Losh <imp@FreeBSD.org>

Minor improvements:
o Explain snprintf's return value better.
o Document snprintf, et al, were defined in C-99
o Warn against %n.


# 1259dd85 30-May-2001 Gregory Neil Shapiro <gshapiro@FreeBSD.org>

Correct the documentation for snprintf() and vsprintf() which actually
return the number of characters that would have been in the new string.

Obtained from: OpenBSD
MFC after: 3 days


# 2de21960 25-May-2001 Eric Melville <eric@FreeBSD.org>

Add warnings about trusting user-supplied data.

Reviewed by: ru
Approved by: murray
Obtained from: OpenBSD


# 2d105f16 18-Apr-2001 Ruslan Ermilov <ru@FreeBSD.org>

mdoc(7) police: fix markup.


# 588a200c 26-Feb-2001 Ruslan Ermilov <ru@FreeBSD.org>

.St -ansiC -> .St -isoC


# 429d919c 10-Feb-2001 Ruslan Ermilov <ru@FreeBSD.org>

mdoc(7) police: mark LC_NUMERIC with .Dv.


# 1c97c577 09-Feb-2001 Andrey A. Chernov <ache@FreeBSD.org>

Note that decimal point taken from locale (SUSv2)


# d0353b83 01-Feb-2001 Ruslan Ermilov <ru@FreeBSD.org>

mdoc(7) police: split punctuation characters + misc fixes.


# 7e7a6ec0 31-Dec-2000 Ben Smithurst <ben@FreeBSD.org>

Make it a bit clearer that asprintf doesn't actually "return" a pointer in
the normal sense of the word, but does it through one of its arguments which
is a pointer to a pointer.

PR: 23717
Submitted by: phk


# 42635956 29-Dec-2000 Ruslan Ermilov <ru@FreeBSD.org>

Prepare for mdoc(7)NG.


# 726b61ab 10-Nov-2000 Ruslan Ermilov <ru@FreeBSD.org>

Avoid use of direct troff requests in mdoc(7) manual pages.


# 25bb73e0 21-Apr-2000 Alexey Zelkin <phantom@FreeBSD.org>

Introduce ".Lb" macro to libc manpages.

More libraries manpages updates following.


# 4e86fcac 02-Mar-2000 Sheldon Hearn <sheldonh@FreeBSD.org>

Remove more single-space hard sentence breaks.


# c6ff3a1b 02-Mar-2000 Sheldon Hearn <sheldonh@FreeBSD.org>

Remove single-space hard sentence breaks. These degrade the quality
of the typeset output, tend to make diffs harder to read and provide
bad examples for new-comers to mdoc.


# 466c0416 16-Jan-2000 Kris Kennaway <kris@FreeBSD.org>

We no longer care about the VAX and Tahoe compilers :-)


# 7f3dea24 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# 749a3362 08-Aug-1999 Bruce Evans <bde@FreeBSD.org>

Fixed missing "G" in the list item for the main description of %g and
%G formats.


# 6a8e2895 25-Jul-1999 Tim Vanderhoek <hoek@FreeBSD.org>

asprintf() does use realloc() internally, but saying so in the manpage can be
misinterpreted to mean that the pointer passed to asprintf() must be suitable
for passing to realloc() as-is (ie. either a NULL pointer or a valid pointer).


# fbc400a6 12-Jul-1999 Nik Clayton <nik@FreeBSD.org>

Add $Id$, to make it simpler for members of the translation teams to
track.

The $Id$ line is normally at the bottom of the main comment block in the
man page, separated from the rest of the manpage by an empty comment,
like so;

.\" $Id$
.\"

If the immediately preceding comment is a @(#) format ID marker than the
the $Id$ will line up underneath it with no intervening blank lines.
Otherwise, an additional blank line is inserted.

Approved by: bde


# 64a965e7 07-Jul-1998 Peter Wemm <peter@FreeBSD.org>

Replace my original asprintf() and vasprintf() hacks with something
more cleanly integrated with stdio. This should be faster and cleaner
since it doesn't memcpy() the data into a seperate buffer. This lets
stdio allocate and manage the buffer and then hand it over to the user.

Obtained from: Todd Miller <Todd.Miller@courtesan.com> via OpenBSD


# 9c727d2c 05-Jun-1998 Joseph Koshy <jkoshy@FreeBSD.org>

Spelling corrections.

PR: 6868
Submitted by: Josh Gilliam <josh@quick.net>


# 09589ca8 18-Mar-1997 Bruce Evans <bde@FreeBSD.org>

FIxed arg types (mostly missing consts) in synopsis.


# efb7e53d 14-Jan-1997 Jordan K. Hubbard <jkh@FreeBSD.org>

The following patch to lib/libc/stdio implements positional arguments in
a manner consistent with other implementations. Its done in a way that
adds only a tiny amount of overhead when positional arguments are not used.
I also have a test program to go with this, but don't know where it belongs
in the tree.

Submitted-By: Bill Fenner <fenner@FreeBSD.ORG>


# a2d402aa 21-Aug-1996 Mike Pritchard <mpp@FreeBSD.org>

Update some more man pages to use the .Fx macro.


# d230d427 09-Jun-1996 Joerg Wunsch <joerg@FreeBSD.org>

Reword the sentence about the required space for the result string.

Closes PR # 1303.-


# 15aa00d5 27-May-1996 Peter Wemm <peter@FreeBSD.org>

Add an implementation of the gnu-ish asprintf() and vasprintf(). They are
not based on gpl'ed code, just prototype and usage. I'm not 100% certain
they behave the same while the system is in trouble (eg: malloc() failing)
but in those circumstances all bets would be off anyway.

These routines work like sprintf() and vsprintf(), except that instead of
using a fixed buffer, they allocate memory and return it to the user
and it's the user's responsibility to free() it. They have allocate as
much memory as they need (and can get), so the size of strings it can deal
with is limited only by the amount of memory it can malloc() on your
behalf.

There are a few gpl'ed programs starting to use this interface, and it's
becoming more common with the scares about security risks with sprintf().
I dont like the look of the code that the various programs (including
cvs, gdb, libg++, etc) provide if configure can't find it on the system.

It should be possible to modify the stdio core code to provide this
interface more efficiently, I was more worried about having something
that worked and was secure. :-) (I noticed that there was once intended
to be a smprintf() routine when our stdio was written for 4.4BSD, but it
looks pretty stillborn, and it's intended interface is not clear). Since
Linux and gnu libc have this interface, it seemed silly to bring yet
another one onto the scene.


# 20631f47 09-Apr-1996 Mike Pritchard <mpp@FreeBSD.org>

Correct a minor typo. Fixes part of PR#1000.

Submitted by: Dave Glowacki <dglo@ssec.wisc.edu>


# dbe38b75 14-May-1995 David Greenman <dg@FreeBSD.org>

Fixed typo.


# 58f0484f 26-May-1994 Rodney W. Grimes <rgrimes@FreeBSD.org>

BSD 4.4 Lite Lib Sources