Hi Pádraig,
Pádraig Brady <[email protected]> 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