On Friday, March 31, 2006 09:27:01 AM -0500 Jim Rees <[EMAIL PROTECTED]> wrote:

I still don't see why the code is so complicated.  Can you think of any
reason not to use a single scanf like I did for the 8601 method?

I think they're trying to be careful about rejecting invalid input.
Without the second sscanf, it would accept input like "2/22/2006,12:30"
but ignore the "12:30" part.

'c' is a local string of length two so I don't see how you could get
scribbling.

Because the format string includes a %d for seconds with no corresponding input argument, so sscanf will try to store an integer at 'c'. A string of length two is not big enough to receive an integer on most platforms.


  This lacks sufficient validation; specifically, it doesn't include a
dummy   field to tell if there was extra garbage at the end of the input.

I didn't think that was necessary, but until it parses timezone info it's
probably better to check for unexpected input.

Noting what I said above, I think it's rather important to check for unexpected input, rather than doing something different from what the user (or program) that invoked us intended.

-- Jeff
_______________________________________________
OpenAFS-devel mailing list
[email protected]
https://lists.openafs.org/mailman/listinfo/openafs-devel

Reply via email to