From owner-freebsd-current Thu Nov 19 16:59:44 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id QAA19382 for freebsd-current-outgoing; Thu, 19 Nov 1998 16:59:44 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from whistle.com (s205m131.whistle.com [207.76.205.131]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id QAA19374 for ; Thu, 19 Nov 1998 16:59:43 -0800 (PST) (envelope-from archie@whistle.com) Received: (from smap@localhost) by whistle.com (8.7.5/8.6.12) id QAA22544; Thu, 19 Nov 1998 16:58:04 -0800 (PST) Received: from bubba.whistle.com( 207.76.205.7) by whistle.com via smap (V2.0) id xma022537; Thu, 19 Nov 98 16:57:48 -0800 Received: (from archie@localhost) by bubba.whistle.com (8.8.7/8.6.12) id QAA29023; Thu, 19 Nov 1998 16:57:47 -0800 (PST) From: Archie Cobbs Message-Id: <199811200057.QAA29023@bubba.whistle.com> Subject: Re: snprintf() in the kernel In-Reply-To: <19981120093817.K467@freebie.lemis.com> from Greg Lehey at "Nov 20, 98 09:38:17 am" To: grog@lemis.com (Greg Lehey) Date: Thu, 19 Nov 1998 16:57:47 -0800 (PST) Cc: freebsd-current@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL38 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Greg Lehey writes: > > I count 131 files that use sprintf() and 28 that use strcat(), so > > this will touch a lot of files (but hopefully for the better). > > I'm very much in favour. The code I need to do bounds checking in > vinum is some of the ugliest I've seen. Cool.. I know the feeling. The only subtle gotcha with snprintf() is that it returns the number of characters that *would* have been printed, not the number that actually were printed. So you can't count on the return value being less than the buffer size. > > So.. does anyone have a huge problem with doing this before I jump in? > > [ Anyone willing to review for me? ] > > I'll take a look. Are you going to implement %qd while you're at it? One thing at a time.. :-) Thanks for the offers from you and Robert Nordier to review, you folks will hear from me soon.. -Archie ___________________________________________________________________________ Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message