Add parameterized position handling to printf(1).
authorpfg <pfg@FreeBSD.org>
Mon, 21 Apr 2014 22:47:18 +0000 (22:47 +0000)
committerpfg <pfg@FreeBSD.org>
Mon, 21 Apr 2014 22:47:18 +0000 (22:47 +0000)
commit540cea4ebc7db0a742da16bad4078a2fdfc50695
treefff855d4510018bbb09fc9de05fda6039dad40e5
parent534840ba27f335f1e9ce6b8fb70f43a9f0cd3a0c
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
usr.bin/printf/printf.1
usr.bin/printf/printf.c