GNU bug report logs -
#73068
printf: please implement POSIX:2024 argument reordering
Previous Next
Reported by: Bruno Haible <bruno <at> clisp.org>
Date: Fri, 6 Sep 2024 14:07:01 UTC
Severity: normal
Done: Pádraig Brady <P <at> draigBrady.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Hi Pádraig,
Pádraig Brady <P <at> draigBrady.com> writes:
> I'll apply the attached sometime tomorrow.
>
> Marking this as done.
Patch looks good, thanks.
One small comment, though.
> +#define GET_CURR_ARG(POS) \
> +do { \
> + char *arge; \
> + intmax_t arg = POS==3 ? 0 : strtoimax (f, &arge, 10); \
> + if (0 < arg && arg <= INT_MAX && *arge == '$') \
> + /* Process indexed %i$ format. */ \
> + /* Note '$' comes before any flags. */ \
Shouldn't you check errno here, like:
char *arge;
errno = 0;
intmax_t arg = POS==3 ? 0 : strtoimax (f, &arge, 10);
if (errno == 0 && 0 < arg && arg <= INT_MAX && *arge == '$')
[...]
I think that would handle all bad cases.
For example, I think "%$" might return 0 but set errno to EINVAL.
Collin
This bug report was last modified 252 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.