[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: c program : pb with Sparc ?



On Sat, Jan 22, 2000 at 05:58:04PM -0500, Branden Robinson wrote:
> On Sat, Jan 22, 2000 at 10:24:12AM +0100, Thierry Laronde wrote:
> > By the way, can someone tell me before I send a bug report to the upstream
> > author, if in an newer version of libc draft (I'm still on slink, and the 
> > version is 0.07) the definition of strftime() is corrected, because, if I 
> > understand correctly the text, the draft says that strftime() returns the 
> > number of chars written, even if there was not enough place in the buffer, 
> > and that's wrong : POSIX.1 defines that in this case the funcion returns 0, 
> > which is actually the case.
> 
> "The size parameter can be used to specify the maximum number of characters
> to be stored in the array s, including the terminating null character.  If
> the formatted time requires more then size characters, strftime returns
> zero and the content of the array s is indetermined[sic].  Otherwise the
> return value indicates the number of characters placed in the array s, not
> including the terminating null character."
> 
> [...]
> 
> "If s is a null pointer, strftime does not actually write anything, but
> instead returns the number of characters it would have written."
> 
> Does that answer your question?

Yes, thanks :) In 0.07, the wrong passage was the following :

"The SIZE parameter can be used to specify the maximum number of
characters to be stored in the array S, including the terminating
null character.  If the formatted time requires more than SIZE
characters, the excess characters are discarded.  The return value
from `strftime' is the number of characters placed in the array S,
not including the terminating null character.  If the value equals
SIZE, it means that the array S was too small; you should repeat
the call, providing a bigger array."

So, this is already corrected.

Best regards,
-- 
Thierry LARONDE
thierry.laronde@polynum.com
website : http://www.polynum.com


Reply to: