Post a Comment On: /dev/dump

"New implementation of printf"

3 Comments -

1 – 3 of 3
Blogger Chris said...

Mr. Gdamore, option parsing in printf is mandated by the UNIX standard. The Austin Group has issued in interpretation of the standard that the printf tool must, while having no options yet, do option parsing.
Ingoing options like in your example is not allowed and VSC6 will fail with your code.

October 14, 2010 at 2:45 AM

Blogger Garrett D'Amore said...

Do you have a pointer that interpretation?

Perhaps this is a situation where /usr/xpg4/bin/printf should have it.

The problem is that there are scripts that may require it. I'm more concerned with compatibility with legacy scripts than I am with a hypothetical standard here.

October 14, 2010 at 8:14 AM

Blogger Garrett D'Amore said...

So I've posted a new
webrev. This one adds a few extra lines, to accomodate "--", per a POSIX requirement:

Standard utilities that do not accept options, but that do accept operands, shall recognize "--" as a first argument to be discarded.

Notably legacy closed printf also handles -- the same way.

October 14, 2010 at 9:00 AM