Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Jan 2001 09:32:12 -0800 (PST)
From:      Matt Dillon <dillon@earth.backplane.com>
To:        Julian Elischer <julian@elischer.org>
Cc:        Poul-Henning Kamp <phk@critter.freebsd.dk>, "Justin T. Gibbs" <gibbs@scsiguy.com>, Dag-Erling Smorgrav <des@ofug.org>, freebsd-arch@FreeBSD.ORG
Subject:   Re: Proposed chage to sbuf semantics.
Message-ID:  <200101111732.f0BHWC671100@earth.backplane.com>
References:  <8607.979224359@critter> <3A5DCD67.66539A@elischer.org>

next in thread | previous in thread | raw e-mail | index | archive | help
    You guys are all crazy.  I would just write an snappendf() function,
    similar to snprintf(), and use a static buffer.  

    snappendf(buf, bufsize, ctl, ...);

    Have the function return the index of where the \0 would normally go
    had the buffer been big enough.  So the last snappendf():

    r = snappendf(...)
    if (r >= bufsize)
	... data was truncated ...

    The routine is about 5 lines of code.

						-Matt


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-arch" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200101111732.f0BHWC671100>