Date: Fri, 05 Jan 2001 11:06:39 +0000 From: Brian Somers <brian@Awfulhak.org> To: Warner Losh <imp@bsdimp.com> Cc: Will Andrews <will@physics.purdue.edu>, Brian Somers <brian@Awfulhak.org>, Chris Faulhaber <jedgar@fxp.org>, Will Andrews <will@FreeBSD.org>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org, brian@Awfulhak.org Subject: Re: cvs commit: src/usr.bin/apply apply.c Message-ID: <200101051106.f05B6d144717@hak.lan.Awfulhak.org> In-Reply-To: Message from Warner Losh <imp@bsdimp.com> of "Thu, 04 Jan 2001 19:26:55 MST." <200101050226.f052Qt149151@harmony.village.org>
next in thread | previous in thread | raw e-mail | index | archive | help
> In message <20010104211257.V86630@argon.firepipe.net> Will Andrews writes: > : > s[n]printf() is poorly documented in this area. > : > : I agree. > > These functions return the number of characters printed (not including > the trailing `\0' used to end output to strings). > ... > Snprintf() and vsnprintf() will write at most size-1 of the characters > printed into the output string (the size'th character then gets the ter- > minating `\0'); if the return value is greater than or equal to the size > argument, the string was too short and some of the printed characters > were discarded. > > It seems to fairly clearly imply that it will return the number of > characters that would have been copied to the string, if it was long > enough.... The part after the ';' implies this. I'm not sure how it > could be clearer. My problem with the above is the first paragraph. It's a lie (snprintf does not return the number of characters printed). If the reader gets bored before getting to the second bit they'll go away with the wrong impression. The reason I mentioned that the documentation is bad was that when I read the start of this thread I noticed the problem and read the man page to ensure I was actually right before posting a follow-up. The man page just made me doubt myself because of the above contradiction. > Warner -- Brian <brian@Awfulhak.org> <brian@[uk.]FreeBSD.org> <http://www.Awfulhak.org> <brian@[uk.]OpenBSD.org> Don't _EVER_ lose your sense of humour ! To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200101051106.f05B6d144717>