From: jdoubleu <hi@jdoubleu.de>
To: newlib@sourceware.org
Subject: Re: [PATCH 2/2] newlib/libc/time/tzset_r.c(_tzset_unlocked_r): POSIX angle bracket <> support
Date: Mon, 21 Mar 2022 17:07:38 +0100 [thread overview]
Message-ID: <82f48cb4-c456-b745-6c07-0955316755fc@jdoubleu.de> (raw)
In-Reply-To: <20220225163959.48753-3-Brian.Inglis@SystematicSW.ab.ca>
Hi,
On 2/25/2022 5:39 PM, Brian Inglis wrote:
>
> define POSIX specified minimum TZ abbr size 3 TZNAME_MIN
> use limits.h TZNAME_MAX, _POSIX_TZNAME_MAX, unistd.h sysconf(_SC_TZNAME_MAX)
> issue error if no symbols defined (document fallback value in case required)
> allow POSIX angle bracket < > quoted signed alphanumeric tz abbr e.g. <MESZ+0330>
> allow POSIX unquoted alphabetic tz abbr e.g. MESZ
> apply same changes for DST tz abbr
> ---
> newlib/libc/time/tzset_r.c | 74 ++++++++++++++++++++++++++++++++------
> 1 file changed, 64 insertions(+), 10 deletions(-)
>
> + /* quit if no items, too few or too many chars, or no close quote '>' */
> + if (sscanf (tzenv, "%10[-+0-9A-Za-z]%n", __tzname_std, &n) <= 0
> + || n < TZNAME_MIN || TZNAME_MAX < n || '>' != tzenv[n])
> + return;
Is it safe to use the minus (-) as first char in the sscanf format set:
"%10[-+0-9A-Za-z]%n"?
Newlib's sscanf docs states
(https://sourceware.org/newlib/libc.html#sscanf):
> There is also a range facility which you can use as a shortcut. %[0-9] matches all decimal digits. The hyphen must not be the first or last character in the set.
Cheers
---
🙎🏻♂️ jdoubleu
next prev parent reply other threads:[~2022-03-21 16:07 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-25 16:39 [PATCH 0/2] add tzset POSIX tz abbr angle bracket <> support in TZ env var Brian Inglis
2022-02-25 16:39 ` [PATCH 1/2] newlib/libc/time/tzset.c: add POSIX angle bracket <> doc Brian Inglis
2022-02-25 16:39 ` [PATCH 2/2] newlib/libc/time/tzset_r.c(_tzset_unlocked_r): POSIX angle bracket <> support Brian Inglis
2022-02-28 12:04 ` Corinna Vinschen
2022-02-28 18:55 ` Brian Inglis
2022-02-28 19:26 ` Brian Inglis
2022-03-01 11:03 ` Corinna Vinschen
2022-03-21 16:07 ` jdoubleu [this message]
2022-03-22 17:35 ` Brian Inglis
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=82f48cb4-c456-b745-6c07-0955316755fc@jdoubleu.de \
--to=hi@jdoubleu.de \
--cc=newlib@sourceware.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 read-only IMAP folder(s) and NNTP newsgroup(s).