From owner-cvs-all Fri Jan 5 3: 9:20 2001 From owner-cvs-all@FreeBSD.ORG Fri Jan 5 03:09:15 2001 Return-Path: Delivered-To: cvs-all@freebsd.org Received: from Awfulhak.org (awfulhak.demon.co.uk [194.222.196.252]) by hub.freebsd.org (Postfix) with ESMTP id F1D9237B400; Fri, 5 Jan 2001 03:09:13 -0800 (PST) Received: from hak.lan.Awfulhak.org (root@hak.lan.Awfulhak.org [172.16.0.12]) by Awfulhak.org (8.11.1/8.11.1) with ESMTP id f05B0FW70177; Fri, 5 Jan 2001 11:01:45 GMT (envelope-from brian@lan.Awfulhak.org) Received: from hak.lan.Awfulhak.org (brian@localhost [127.0.0.1]) by hak.lan.Awfulhak.org (8.11.1/8.11.1) with ESMTP id f05B6d144717; Fri, 5 Jan 2001 11:06:39 GMT (envelope-from brian@hak.lan.Awfulhak.org) Message-Id: <200101051106.f05B6d144717@hak.lan.Awfulhak.org> X-Mailer: exmh version 2.2 06/23/2000 with nmh-1.0.4 To: Warner Losh Cc: Will Andrews , Brian Somers , Chris Faulhaber , Will Andrews , cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org, brian@Awfulhak.org Subject: Re: cvs commit: src/usr.bin/apply apply.c In-Reply-To: Message from Warner Losh of "Thu, 04 Jan 2001 19:26:55 MST." <200101050226.f052Qt149151@harmony.village.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 05 Jan 2001 11:06:39 +0000 From: Brian Somers Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > 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 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