History log of /freebsd-14.2/usr.bin/printf/printf.c (Results 1 – 25 of 74)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: release/13.4.0-p5, release/13.5.0-p1, release/14.2.0-p3, release/13.5.0, release/14.2.0-p2, release/14.1.0-p8, release/13.4.0-p4, release/14.1.0-p7, release/14.2.0-p1, release/13.4.0-p3, release/14.2.0, release/13.4.0, release/14.1.0, release/13.3.0, release/14.0.0
# 260bab9f 25-Sep-2023 John Baldwin <[email protected]>

Purge more stray embedded $FreeBSD$ strings

These do not use __FBSDID but instead use bare char arrays.

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

(cherry p

Purge more stray embedded $FreeBSD$ strings

These do not use __FBSDID but instead use bare char arrays.

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

(cherry picked from commit eba230afba4932f02a1ca44efc797cf7499a5cb0)

show more ...


Revision tags: release/13.2.0, release/12.4.0, release/13.1.0, release/12.3.0, release/13.0.0, release/12.2.0, release/11.4.0, release/12.1.0, release/11.3.0, release/12.0.0
# 051c7fdd 11-Aug-2018 Jilles Tjoelker <[email protected]>

printf: Fix \c in %b in printf builtin exiting the shell after r337458

SVN r337458 erroneously partially reverted r265885.

This is immediately visible when running the Kyua/ATF tests for
usr.bin/pr

printf: Fix \c in %b in printf builtin exiting the shell after r337458

SVN r337458 erroneously partially reverted r265885.

This is immediately visible when running the Kyua/ATF tests for
usr.bin/printf, which actually test sh's printf builtin.

PR: 229641

show more ...


# 702da352 08-Aug-2018 Pedro F. Giffuni <[email protected]>

Fix printf(1) ignores width and precision in %b format.

The precision with the conversion specifier b is specified by POSIX: see
point 7 in the reference documentation.

This corrects previous wrong

Fix printf(1) ignores width and precision in %b format.

The precision with the conversion specifier b is specified by POSIX: see
point 7 in the reference documentation.

This corrects previous wrong log in r337440.

Reference: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/printf.html

PR: 229641
Reported by: Rudolf Cejka
Submitted by: Garrett D'Amore (illumos)
MFC after: 1 week

show more ...


# 94e46015 08-Aug-2018 Pedro F. Giffuni <[email protected]>

Revert r337440: the log message is wrong.


# e21ce9d7 07-Aug-2018 Pedro F. Giffuni <[email protected]>

Fix printf(1) ignores width and precision in %b format.

The precision with behavior is "unspecified" by POSIX (as of 2018), but
most implementations seem to have taken it to be treated the same as f

Fix printf(1) ignores width and precision in %b format.

The precision with behavior is "unspecified" by POSIX (as of 2018), but
most implementations seem to have taken it to be treated the same as for
"s"; applied after the unescaping.
Adopt the same treatment on our printf.

PR: 229641
Submitted by: Garrett D'Amore (illumos)

show more ...


Revision tags: release/11.2.0
# 8a16b7a1 20-Nov-2017 Pedro F. Giffuni <[email protected]>

General further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier f

General further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.

show more ...


Revision tags: release/10.4.0, release/11.1.0
# 342b089b 29-Apr-2017 Jilles Tjoelker <[email protected]>

printf: Output formatted data directly, instead of via asprintf.

Long ago, sh used to have its own optimized and restricted string formatting
implementation, which the printf builtin had to bypass v

printf: Output formatted data directly, instead of via asprintf.

Long ago, sh used to have its own optimized and restricted string formatting
implementation, which the printf builtin had to bypass via asprintf() to a
temporary buffer. Since sh has used libc's string formatting implementation
for a long time, remove the workaround.

Add a check to keep printf %c '' working the same way (output nothing);
POSIX allows both outputting nothing and outputting a NUL byte.

Also, this change avoids silently discarding format directives for whose
output asprintf() cannot allocate memory.

show more ...


# fbbd9655 28-Feb-2017 Warner Losh <[email protected]>

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

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 <[email protected]>
Pull Request: https://github.com/freebsd/freebsd/pull/96

show more ...


Revision tags: release/11.0.1, release/11.0.0, release/10.3.0, release/10.2.0
# 22ea47ec 01-Mar-2015 Jilles Tjoelker <[email protected]>

sh: Fix compiler warnings related to duplicate or missing declarations.


Revision tags: release/10.1.0, release/9.3.0
# ea1a630a 29-May-2014 Pedro F. Giffuni <[email protected]>

Minor style knit.


# 4aa17924 26-May-2014 Pedro F. Giffuni <[email protected]>

printf(1): warn about incomplete uses n$

Reviewed by: jilles
Obtained from: Illumos
MFC after: 2 weeks


# 4e4d9802 13-May-2014 Jilles Tjoelker <[email protected]>

printf: Fix missing arguments for %u/%o/%x/%X after r265592.

If a numeric argument is missing, zero should be assumed, for signed as well
as unsigned conversions.

This fixes the 'zero' regression t

printf: Fix missing arguments for %u/%o/%x/%X after r265592.

If a numeric argument is missing, zero should be assumed, for signed as well
as unsigned conversions.

This fixes the 'zero' regression tests.

r265592 erroneously reverted r244407.

show more ...


# 30238f49 11-May-2014 Pedro F. Giffuni <[email protected]>

printf: fix regression after illumos merges.

The "bltin/bltin.h" wrappers do not support exit() and attempting
to call it will exit sh completely.

Note that errx() is acceptable but will always ret

printf: fix regression after illumos merges.

The "bltin/bltin.h" wrappers do not support exit() and attempting
to call it will exit sh completely.

Note that errx() is acceptable but will always return with status 2.

Reported by: jilles (and the testing framework)
Fix by: jilles
Pointyhat: pfg

show more ...


# 76f66be6 10-May-2014 Pedro F. Giffuni <[email protected]>

prinf: replace use of alloca with variable length array.

Use of alloca(3) is discouraged in FreeBSD. Using a VLA
is simple and should be more portable.

Requested by: jilles


# 437bce62 08-May-2014 Pedro F. Giffuni <[email protected]>

Fix the incorrect handling of %b and \c in printf(1)

This is required for POSIX compliance.

Obtained from: Garrett D'Amore (Illumos)
MFC after: 4 days


# f8a6c905 07-May-2014 Pedro F. Giffuni <[email protected]>

Add width and precision specifiers to printf(1) %n$.

This actually completes r264743 so that width and precision
specifiers work properly with %n$. These keeps consistency
with ksh93 and zsh.

Requ

Add width and precision specifiers to printf(1) %n$.

This actually completes r264743 so that width and precision
specifiers work properly with %n$. These keeps consistency
with ksh93 and zsh.

Requested by: jilles
Obtained from: Garrett D'Amore (Illumos)
MFC after: 4 days

show more ...


# b0620803 21-Apr-2014 Pedro F. Giffuni <[email protected]>

Add parameterized position handling to printf(1).

Add a new %n$ option to change the order of the parameters as
done in the ksh93 builtin printf (among others).

For example:
%printf '%2$1d %1$s\n'

Add parameterized position handling to printf(1).

Add a new %n$ option to change the order of the parameters as
done in the ksh93 builtin printf (among others).

For example:
%printf '%2$1d %1$s\n' one 2 three 4
2 one
4 three

The feature was written by Garret D'Amore under a
BSD license for Nexenta/illumos.

Reference:
http://garrett.damore.org/2010/10/new-implementation-of-printf.html

PR: bin/152934
Obtained from: Illumos
MFC after: 2 weeks

show more ...


# f77d6662 17-Apr-2014 Pedro F. Giffuni <[email protected]>

Minor style(9) cleanups

#define should be followed by a tab.

MFC after: 3 days


Revision tags: release/10.0.0, release/9.2.0, release/8.4.0
# 2f01c791 18-Dec-2012 Eitan Adler <[email protected]>

POSIX requires that non-existent or null arguments be treated as if a
zero argument were supplied.

Add a regression test to catch this case as well.

PR: bin/174521
Submitted by: Daniel Shahaf <dan

POSIX requires that non-existent or null arguments be treated as if a
zero argument were supplied.

Add a regression test to catch this case as well.

PR: bin/174521
Submitted by: Daniel Shahaf <[email protected]> (pr)
Submitted by: Mark Johnston <[email protected]> (initial patch)
Reviewed by: jilles
Approved by: cperciva (implicit)
MFC after: 3 weeks

show more ...


Revision tags: release/9.1.0
# 7cbda738 15-Sep-2012 Jilles Tjoelker <[email protected]>

sh: Prefer internal nextopt() to libc getopt().

This reduces code duplication and code size.

/usr/bin/printf is not affected.

Side effect: different error messages when certain builtins are passed

sh: Prefer internal nextopt() to libc getopt().

This reduces code duplication and code size.

/usr/bin/printf is not affected.

Side effect: different error messages when certain builtins are passed
invalid options.

show more ...


Revision tags: release/8.3.0_cvs, release/8.3.0
# ab71f271 12-Jan-2012 Pedro F. Giffuni <[email protected]>

Style cleanups for printf.

PR: bin/152934
Approved by: jhb (mentor)
Obtained from: Illumos
MFC after: 2 weeks


Revision tags: release/9.0.0
# 98102dab 28-May-2011 Jilles Tjoelker <[email protected]>

printf: Allow multibyte characters for '<char> form, avoid negative codes.

Examples:
LC_ALL=en_US.UTF-8 printf '%d\n' $(printf \'\\303\\244)
LC_ALL=en_US.ISO8859-1 printf '%d\n' $(printf \'\\344

printf: Allow multibyte characters for '<char> form, avoid negative codes.

Examples:
LC_ALL=en_US.UTF-8 printf '%d\n' $(printf \'\\303\\244)
LC_ALL=en_US.ISO8859-1 printf '%d\n' $(printf \'\\344)
Both of these should print 228.

Like some other shells, incomplete or invalid multibyte characters yield the
value of the first byte without a warning.

Note that there is no general way to go back from the character code to the
character.

show more ...


# 77fae5c1 01-Mar-2011 Jilles Tjoelker <[email protected]>

printf: Note that this is used both as a normal program and a shell builtin.


Revision tags: release/7.4.0_cvs, release/8.2.0_cvs, release/7.4.0, release/8.2.0
# add265c6 29-Dec-2010 Jilles Tjoelker <[email protected]>

printf: Do not use sh memory functions in sh builtin.

These functions throw exceptions if they fail, possibly causing memory
leaks. The normal out-of-memory handling suffices. The INTOFF around almo

printf: Do not use sh memory functions in sh builtin.

These functions throw exceptions if they fail, possibly causing memory
leaks. The normal out-of-memory handling suffices. The INTOFF around almost
all of printf prevents memory leaks due to SIGINT.

show more ...


# 6a6760db 20-Dec-2010 Jilles Tjoelker <[email protected]>

sh: Make warnings in the printf builtin non-fatal, like in the program.

The #define for warnx now behaves much like the libc function (except that
it uses sh command name and output).

Also, it now

sh: Make warnings in the printf builtin non-fatal, like in the program.

The #define for warnx now behaves much like the libc function (except that
it uses sh command name and output).

Also, it now uses C99 __VA_ARGS__ so there is no need for three different
macros for 0, 1 or 2 parameters.

show more ...


123