Hi Scott, Thanks for the comment! The atoi() wasn't really the right function to use. I have changed that to atol() instead. Since truncstart is declared as zic_t it can only store values between ZIC_MIN and ZIC_MAX and atol() will also return within that range. So I have removed the bounds test. BR, Christopher Wong ________________________________________ From: Scott Nelson <sbnelson@thermeon.com> Sent: Friday, March 8, 2019 15:07 To: Christopher Wong Cc: Paul Eggert; Time Zone Mailing List Subject: Re: [tz] [PROPOSED] zic option for including data from a certain year onward
On Mar 8, 2019, at 3:38 AM, Christopher Wong <christopher.wong@axis.com> wrote:
+ case 'k': + if (truncstart == ZIC_MIN) { + truncstart = atoi(optarg); + if (truncstart > ZIC_MAX) + truncstart = ZIC_MAX; + } + else { + fprintf(stderr, +_("%s: More than one -k option specified\n"), + progname); + return EXIT_FAILURE; + } + break;
I don’t see a lower bounds test for the -k argument; is that intentional? Scott Nelson Systems Analyst/Programmer | Thermeon Ltd | Company No 11538126