2021-09-11 00:04:20 +0200, Joerg Schilling via austin-group-l at The Open Group: > "Stephane Chazelas via austin-group-l at The Open Group" > <austin-group-l@opengroup.org> wrote: > > > For the record, see the interesting discussions on the zsh > > mailing list from when that feature was added there almost > > exactly 20 years ago: > > > > https://www.zsh.org/mla/workers/2001/msg02715.html > > >From the information I have, that feature (even though limited to string > arguments) was introduced for /usr/bin/printf around 1988 for SVR4 or SunOS > (I am not sure about the origin). This is from before POSIX did introduce > printf(1) and as a result, there is a difference from what POSIX requires > for printf(1). > > The important fact however is that it was intended for use with gettext(1). [...]
Looking at the svr4 source code from archive.org, printf(1) just did: strccpy(fmt, argv[1]); printf(fmt, argv[2], argv[3], argv[4], argv[5], argv[6], argv[7], argv[8], argv[9], argv[10], argv[11], argv[12], argv[13], argv[14], argv[15], argv[16], argv[17], argv[18], argv[19], argv[20]); So did not reuse and was a plain wrapper for printf(3) (which had %x$ already then so printf(1) would have as well). The re-using seems to be coming from 9th Edition Research UNIX which the POSIX printf spec claims to take inspiration from. -- Stephane