Follow-up:
Assaf Gordon wrote, On 02/11/2013 12:27 PM:
> Strange failure with numfmt on an eccentric system (Mac OS X 10.6.8): some
> errors are not reported correctly.
>
> [ ... ]
>
> In the source code, it seems to be related to this part, in
> parse_format_string(), line 972:
> 970 i += strspn (fmt + i, " ");
> 971 errno = 0;
> 972 pad = strtol (fmt + i, &endptr, 10);
> 973 if (errno != 0)
> 974 error (EXIT_FAILURE, 0,
> 975 _("invalid format %s (width overflow)"), quote (fmt));
> 976
>
> On this system (Mac OS X):
> fmt = 'hello%'
> i = 6
> fmt+i = ''
>
> And 'strtol' returns errno=EINVAL (22) instead of 0 - causing the incorrect
> error message.
>
This is likely the reason, 'man strtol' has this to say (on this computer):
===
ERRORS
[EINVAL] The value of base is not supported or no conversion
could be performed (the last feature is not portable
across all platforms).
===
Would it be better to explicitly check for this case, or replace with xstrtol ?
-gordon