A NOTE has been added to this issue. ====================================================================== https://austingroupbugs.net/view.php?id=1592 ====================================================================== Reported By: geoffclare Assigned To: ====================================================================== Project: Issue 8 drafts Issue ID: 1592 Category: Shell and Utilities Type: Enhancement Request Severity: Comment Priority: normal Status: New Name: Geoff Clare Organization: The Open Group User Reference: Section: printf Page Number: 3085 Line Number: 104307 Final Accepted Text: ====================================================================== Date Submitted: 2022-07-15 08:36 UTC Last Modified: 2022-07-18 11:17 UTC ====================================================================== Summary: Add %n$ support to the printf utility ======================================================================
---------------------------------------------------------------------- (0005891) geoffclare (manager) - 2022-07-18 11:17 https://austingroupbugs.net/view.php?id=1592#c5891 ---------------------------------------------------------------------- Re https://austingroupbugs.net/view.php?id=1592#c5890 The reason the behaviour is unspecified when there are arguments but no conversions is because some implementations write a warning message about the unused arguments. If it stops being unspecified they will have to change. A better work-around than %999$s is %1$.0s i.e. consume the argument(s) without them producing any contribution to the output. A similar trick also solves the "repeat the format" situation where a translator only wants to use two of three arguments - they can insert %3$.0s anywhere so that the third argument in each triple is consumed. You say "it is hard to imagine a sane case for the need for" format reuse with numbered arguments, but in the mailing list discussion someone (Stephane I think) said they often use it for reordering columns and would object to this feature being disallowed. The restrictions for the printf utility as proposed are already less stringent than the printf() function, where if you consume the Nth argument you <b>must</b> also consume all arguments from 1 to (N-1). Translators seem to have been able to cope with the printf() restrictions for many years, so they should be able to do so equally well for the printf utility. The only "extra" problem if printf is used with translated formats in a similar fashion to printf() is the arguments-but-no-conversions issue and as I said above there is a simple work-around for that (%1$.0s) Issue History Date Modified Username Field Change ====================================================================== 2022-07-15 08:36 geoffclare New Issue 2022-07-15 08:36 geoffclare Name => Geoff Clare 2022-07-15 08:36 geoffclare Organization => The Open Group 2022-07-15 08:36 geoffclare Section => printf 2022-07-15 08:36 geoffclare Page Number => 3085 2022-07-15 08:36 geoffclare Line Number => 104307 2022-07-15 08:39 geoffclare Desired Action Updated 2022-07-16 08:23 kre Note Added: 0005890 2022-07-16 08:47 kre Note Edited: 0005890 2022-07-16 08:53 kre Note Edited: 0005890 2022-07-16 08:57 kre Note Edited: 0005890 2022-07-18 11:17 geoffclare Note Added: 0005891 ======================================================================