diff mbox series

[v3,2/2] man: printf: in 'X, X is a byte under dash

Message ID 05324b17e76eef2401dbc3ee7d64366134a42d1d.1671063918.git.nabijaczleweli@nabijaczleweli.xyz (mailing list archive)
State Accepted
Delegated to: Herbert Xu
Headers show
Series [v3,1/2] man: printf: reword to avoid confusion v/v Ar argument[s]/arguments | expand

Commit Message

Ahelenia Ziemiańska Dec. 15, 2022, 12:25 a.m. UTC
Multiple issues:
  * the encoding is not always ASCII
  * what ASCII code is assigned to я
  * dash isn't internationalised
    (this is nonconformant but out of scope),
    and uses the next /byte/; in a UTF-8 locale:
      $ printf %d\\n \'ą
      196
      $ printf %d\\n \'я
      196
    this is in contrast to POSIX (and bash), which says:
      > If the leading character is a single-quote or double-quote,
      > the value shall be the numeric value in the underlying codeset
      > of the character following the single-quote or double-quote.
    (i.e. mbrtowc(&val, argv[n], ...))
---
 src/dash.1 | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Tom Schwindl Dec. 16, 2022, 7:16 p.m. UTC | #1
On Thu Dec 15, 2022 at 1:25 AM CET, наб wrote:
> Multiple issues:
>   * the encoding is not always ASCII
>   * what ASCII code is assigned to я
>   * dash isn't internationalised
>     (this is nonconformant but out of scope),
>     and uses the next /byte/; in a UTF-8 locale:
>       $ printf %d\\n \'ą
>       196
>       $ printf %d\\n \'я
>       196
>     this is in contrast to POSIX (and bash), which says:
>       > If the leading character is a single-quote or double-quote,
>       > the value shall be the numeric value in the underlying codeset
>       > of the character following the single-quote or double-quote.
>     (i.e. mbrtowc(&val, argv[n], ...))
> ---
>  src/dash.1 | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/src/dash.1 b/src/dash.1
> index 310f34e..38cf020 100644
> --- a/src/dash.1
> +++ b/src/dash.1
> @@ -1552,9 +1552,7 @@ otherwise it is evaluated as a C constant, with the following additions:
>  .It
>  A leading plus or minus sign is allowed.
>  .It
> -If the leading character is a single or double quote, the value is the
> -.Tn ASCII
> -code of the next character.
> +If the leading character is a single or double quote, the value of the next byte.

s/of/is/

sounds better to me.

--
Best Regards,
Tom Schwindl
diff mbox series

Patch

diff --git a/src/dash.1 b/src/dash.1
index 310f34e..38cf020 100644
--- a/src/dash.1
+++ b/src/dash.1
@@ -1552,9 +1552,7 @@  otherwise it is evaluated as a C constant, with the following additions:
 .It
 A leading plus or minus sign is allowed.
 .It
-If the leading character is a single or double quote, the value is the
-.Tn ASCII
-code of the next character.
+If the leading character is a single or double quote, the value of the next byte.
 .El
 .Pp
 The format string is reused as often as necessary until all