Skip to content

Commit

Permalink
sh.1: printf %d: fix precision/output base documentation
Browse files Browse the repository at this point in the history
@vinc17fr writes:
> For printf with %d, when a single dot is used without a
> precision, the precision is taken as 0. So the ksh93 specific
> case .. to provide a base without giving a precision (e.g. %..2d)
> is ambiguous: does this mean that the precision is missing (like
> without any dot, thus defaulting to 1) or does this mean that the
> precision is 0 (like with a single dot)? This should be
> documented in the man page (sh.1).
>
> A test shows that the precision is 1 in this case (which is much
> more useful for the user than 0):
>
>	$ printf ">%..2d<\n" 0
>	>0<

Resolves: #679
  • Loading branch information
McDutchie committed Sep 15, 2023
1 parent 8628b6b commit f69bc30
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/cmd/ksh93/sh.1
Original file line number Diff line number Diff line change
Expand Up @@ -7289,6 +7289,9 @@ In this case, the
flag character causes
.IB base #
to be prepended.
When an output base is specified without giving a precision (e.g.
.BR %..2d ),
the precision defaults to 1 instead of 0.
.TP
.B #
The
Expand Down

0 comments on commit f69bc30

Please sign in to comment.