summaryrefslogtreecommitdiffstats
path: root/usr.bin/printf
Commit message (Collapse)AuthorAgeFilesLines
* Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installedngie2016-05-041-17/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | after r298107 Summary of changes: - Replace all instances of FILES/TESTS with ${PACKAGE}FILES. This ensures that namespacing is kept with FILES appropriately, and that this shouldn't need to be repeated if the namespace changes -- only the definition of PACKAGE needs to be changed - Allow PACKAGE to be overridden by callers instead of forcing it to always be `tests`. In the event we get to the point where things can be split up enough in the base system, it would make more sense to group the tests with the blocks they're a part of, e.g. byacc with byacc-tests, etc - Remove PACKAGE definitions where possible, i.e. where FILES wasn't used previously. - Remove unnecessary TESTSPACKAGE definitions; this has been elided into bsd.tests.mk - Remove unnecessary BINDIRs used previously with ${PACKAGE}FILES; ${PACKAGE}FILESDIR is now automatically defined in bsd.test.mk. - Fix installation of files under data/ subdirectories in lib/libc/tests/hash and lib/libc/tests/net/getaddrinfo - Remove unnecessary .include <bsd.own.mk>s (some opportunistic cleanup) Document the proposed changes in share/examples/tests/tests/... via examples so it's clear that ${PACKAGES}FILES is the suggested way forward in terms of replacing FILES. share/mk/bsd.README didn't seem like the appropriate method of communicating that info. MFC after: never probably X-MFC with: r298107 PR: 209114 Relnotes: yes Tested with: buildworld, installworld, checkworld; buildworld, packageworld Sponsored by: EMC / Isilon Storage Division
* MFHgjb2016-03-101-0/+11
|\ | | | | | | Sponsored by: The FreeBSD Foundation
| * DIRDEPS_BUILD: Connect MK_TESTS.bdrewery2016-03-091-0/+11
| | | | | | | | Sponsored by: EMC / Isilon Storage Division
* | First pass to fix the 'tests' packages.gjb2016-02-021-0/+4
|/ | | | Sponsored by: The FreeBSD Foundation
* Refactor the test/ Makefiles after recent changes to bsd.test.mk (r289158) andngie2015-10-121-2/+0
| | | | | | | | | | | | netbsd-tests.test.mk (r289151) - Eliminate explicit OBJTOP/SRCTOP setting - Convert all ad hoc NetBSD test integration over to netbsd-tests.test.mk - Remove unnecessary TESTSDIR setting - Use SRCTOP where possible for clarity MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Divison
* Add META_MODE support.sjg2015-06-131-0/+18
|\ | | | | | | | | | | | | | | | | | | | | Off by default, build behaves normally. WITH_META_MODE we get auto objdir creation, the ability to start build from anywhere in the tree. Still need to add real targets under targets/ to build packages. Differential Revision: D2796 Reviewed by: brooks imp
| * dirdeps.mk now sets DEP_RELDIRsjg2015-06-081-2/+0
| |
| * Merge sync of headsjg2015-05-271-1/+0
| |\ | |/ |/|
| * Merge head from 7/28sjg2014-08-195-12/+36
| |\
| * | Updated dependenciessjg2014-05-161-1/+0
| | |
| * | Updated dependenciessjg2014-05-101-0/+2
| | |
| * | Merge from headsjg2014-05-082-36/+103
| |\ \
| * \ \ Merge headsjg2014-04-2818-3/+112
| |\ \ \
| * | | | Updated dependenciessjg2013-03-111-0/+1
| | | | |
| * | | | Updated dependenciessjg2013-02-161-2/+0
| | | | |
| * | | | Sync with HEAD.obrien2013-02-081-1/+1
| |\ \ \ \
| | \ \ \ \
| | \ \ \ \
| *-. \ \ \ \ Sync from headsjg2012-11-041-4/+10
| |\ \ \ \ \ \
| * | | | | | | Sync FreeBSD's bmake branch with Juniper's internal bmake branch.marcel2012-08-221-0/+19
| | |/ / / / / | |/| | | | | | | | | | | | | | | | | | | Requested by: Simon Gerraty <sjg@juniper.net>
* | | | | | | sh: Fix compiler warnings related to duplicate or missing declarations.jilles2015-03-011-1/+0
| |_|_|_|_|/ |/| | | | |
* | | | | | printf: Install tests/regress.missingpos1.out, fixing tests.jilles2014-06-011-0/+1
| | | | | |
* | | | | | Fix m2 regression test.pfg2014-05-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is not really a good test as the behaviour for /c is unspecified. For the record, ksh93 returns: $ printf "abc\n\cdef" abc ef$ Discussed with: Garret D'Amore (Illumos)
* | | | | | Update number of tests.pfg2014-05-291-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Suggested by: jmmv
* | | | | | Minor style knit.pfg2014-05-291-2/+1
| | | | | |
* | | | | | printf(1): add tests for warn about incomplete uses n$pfg2014-05-262-0/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Submitted by: jilles MFC after: 2 weeks
* | | | | | printf(1): warn about incomplete uses n$pfg2014-05-261-2/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reviewed by: jilles Obtained from: Illumos MFC after: 2 weeks
* | | | | | printf: Fix missing arguments for %u/%o/%x/%X after r265592.jilles2014-05-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | | printf: fix regression after illumos merges.pfg2014-05-111-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | | | prinf: replace use of alloca with variable length array.pfg2014-05-101-3/+1
| |_|_|_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use of alloca(3) is discouraged in FreeBSD. Using a VLA is simple and should be more portable. Requested by: jilles
* | | | | Fix the incorrect handling of %b and \c in printf(1)pfg2014-05-081-13/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is required for POSIX compliance. Obtained from: Garrett D'Amore (Illumos) MFC after: 4 days
* | | | | Add width and precision specifiers to printf(1) %n$.pfg2014-05-071-25/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | | Use src.opts.mk in preference to bsd.own.mk except where we need stuffimp2014-05-061-1/+1
| |_|_|/ |/| | | | | | | | | | | from the latter.
* | | | Add parameterized position handling to printf(1).pfg2014-04-212-1/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* | | | Minor style(9) cleanupspfg2014-04-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | #define should be followed by a tab. MFC after: 3 days
* | | | Migrate most of tools/regression/usr.bin/ to the new tests layout.jmmv2014-03-1616-0/+71
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I'm starting with the easy cases. The leftovers need to be looked at a bit more closely. Note that this change _does_ modify the code of the old tests. This is required in order to allow the code to locate the data files in the source directory instead of the current directory, because Kyua automatically changes the latter to a temporary directory. Also note that at least one test is known to be broken here. Actually, the test is not really broken: it's marked as a TODO but unfortunately Kyua's TAP parser currently does not understand that. Will have to be fixed separately.
* | | POSIX requires that non-existent or null arguments be treated as if aeadler2012-12-181-1/+1
| |/ |/| | | | | | | | | | | | | | | | | | | | | | | zero argument were supplied. Add a regression test to catch this case as well. PR: bin/174521 Submitted by: Daniel Shahaf <danielsh@elego.de> (pr) Submitted by: Mark Johnston <markjdb@gmail.com> (initial patch) Reviewed by: jilles Approved by: cperciva (implicit) MFC after: 3 weeks
* | sh: Prefer internal nextopt() to libc getopt().jilles2012-09-151-4/+10
|/ | | | | | | | | 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.
* Remove trailing whitespace per mdoc lint warningeadler2012-03-291-1/+1
| | | | | | | Disussed with: gavin No objection from: doc Approved by: joel MFC after: 3 days
* Style cleanups for printf.pfg2012-01-121-18/+18
| | | | | | | PR: bin/152934 Approved by: jhb (mentor) Obtained from: Illumos MFC after: 2 weeks
* printf(1): Document that %c and precision for %b/%s use bytes, not chars.jilles2011-05-281-6/+17
| | | | | | | This means these features do not work as expected with multibyte characters. This perhaps less than ideal behaviour matches printf(3) and is specified by POSIX.
* printf: Allow multibyte characters for '<char> form, avoid negative codes.jilles2011-05-282-7/+20
| | | | | | | | | | | | | 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.
* printf(1): Move non-bugs from the BUGS section to a new section CAVEATS.jilles2011-04-251-10/+10
|
* printf(1): Mention effect of '#' modifier on other conversions.jilles2011-04-251-5/+5
|
* printf: Note that this is used both as a normal program and a shell builtin.jilles2011-03-011-0/+4
|
* printf: Do not use sh memory functions in sh builtin.jilles2010-12-291-13/+0
| | | | | | 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.
* sh: Make warnings in the printf builtin non-fatal, like in the program.jilles2010-12-201-17/+13
| | | | | | | | 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.
* Revert r216423 per request from Jilles.delphij2010-12-141-10/+10
| | | | | | | The new behavior prevents us from being able to bail out explicitly on unknown options that we have not implemented. BASH for instance have introduced a '-v' for printf(1) builtin and it seems to be bad to pretend that we supported it and have a script break silently.
* When printf is being used as a sh(1) builtin, it can not calldelphij2010-12-141-3/+1
| | | | | | | exit(3) as pointed out by jilles@ so revert to using return(), also change the return value back to 1 as requested by bde@. This is logically a revert of revision 216422.
* We work on ctype's and not only on numbers so set LC_ALL instead ofdelphij2010-12-141-1/+1
| | | | | | | | LC_NUMERIC. PR: bin/152934 Submitted by: Pedro F. Giffuni <giffunip tutopia.com> Obtained from: Illumos
* IEEE Std 1003.1-2008, Section 1.4, Utility Description Defaults saysdelphij2010-12-141-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | that when the options section is listed as "None", utility shall recognize "--" as a first argument to be discarded. This implementation is largely based on OpenBSD implementation but we do slightly differently: a) We skip argv[0] as the first step; b) We test whether the next argument is "--" and ignore it. With this change one will get: %printf usage: printf format [arguments ...] %printf -v -v%printf -- -v -v% %printf -- usage: printf format [arguments ...] Which matches the behavior observed on a Debian system but different from the Illumos change.
* Make use of EX_USAGE for usage().delphij2010-12-141-2/+4
|
OpenPOWER on IntegriCloud