dash.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: наб <nabijaczleweli@nabijaczleweli.xyz>
To: dash@vger.kernel.org
Subject: [PATCH 2/2] man: printf: in 'X, X is a byte under dash
Date: Sun, 14 Aug 2022 02:20:02 +0200	[thread overview]
Message-ID: <d4a95c9b5772db68b6ae7a00f2f2c3d0535ca1ca.1660436383.git.nabijaczleweli@nabijaczleweli.xyz> (raw)
In-Reply-To: <ba1440bf05e22d3cae38521a25cb3ca90b30680d.1660436383.git.nabijaczleweli@nabijaczleweli.xyz>

[-- Attachment #1: Type: text/plain, Size: 1312 bytes --]

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], ...))

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
---
 src/dash.1 | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/dash.1 b/src/dash.1
index bd5c311..19d4d3b 100644
--- a/src/dash.1
+++ b/src/dash.1
@@ -1556,9 +1556,7 @@ otherwise it is evaluated as a C constant, with the following extensions:
 .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 to satisfy the
-- 
2.30.2

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  reply	other threads:[~2022-08-14  0:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-14  0:19 [PATCH 1/2] man: printf: all Ar arguments are processed identically наб
2022-08-14  0:20 ` наб [this message]
2022-08-14  1:11 ` Harald van Dijk
2022-08-14 14:19   ` [PATCH v2 1/2] man: printf: reword to avoid confusion v/v Ar argument[s]/arguments наб
2022-08-14 14:19   ` [PATCH v2 2/2] man: printf: in 'X, X is a byte under dash наб

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d4a95c9b5772db68b6ae7a00f2f2c3d0535ca1ca.1660436383.git.nabijaczleweli@nabijaczleweli.xyz \
    --to=nabijaczleweli@nabijaczleweli.xyz \
    --cc=dash@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).