bsd-snprintf [was: openssh-2.1.1p1 on Irix6.2 report]

Ben Lindstrom mouring at pconline.com
Thu Jun 29 02:17:43 EST 2000



On Wed, 28 Jun 2000, Sven Mascheck wrote:

> Ben Lindstrom wrote:
> 
> > NeXT 3.3 and OpenStep 4.2 dislike the bsd-snprintf.c ..I have two throw
> > togethers that work.  But they are not portable.  I've not looked at the
> > LPRNG snprintf.c  Which supposable is highly portable.  The current
> > version depents on setjmp() which is not part of the NeXT OS.  (And looks
> > like would be a mess to implement.)
> 
> Yes, the bsd-snprintf uses signal handling for buffer overrun
> in vsnprintf().
> 
> Damien Miller once mentioned the snprintf.c from XFree86.
> This derives from an original by Patrick Powell.
> This original lacks floating point support, btw.
> 
> You may be interested in another modified version of this
> original, too. It's from the mutt package:
> 
> Improved floating point support, i think the XFree one lacks this.
> It deals with systems having only one of the two functions.
> It comes with a selftest (switched on via define).
> There is neither signal handling nor mprotect required.
> No changes have been necessary for a long time now.
> 
mprotect() is a minor issue on NeXT.  Mach/4.3BSD supports it, but in
NeXT they never brough it out to the libc.  So a carefully crafted
system call was all that was needed.

> It compiled "out of the box" on Solaris2.5 and OSF1/V4.0b.
> But i have no NeXT.
> 
> It may at least inspire you, like the XFree one.
> Have a glance at <URL:http://www.uni-ulm.de/~s_smasch/snprintf.c>
> 
I'll take it look at it tonight or tomorrow.. Along with whatever the
latest snapshot is.  If that works right on most platforms it would
save me from writing two very nasty POSIX functions which would require
assembly code for four different NeXT hardware flavors (sparc, hppa,
intel, m68k).

> However, i have no clue if there are even better versions available.
> 
The version I'm currently using is like the one in the OpenBSD source
tree.  So anything more portable would make a few people on this list
tolerating my hacks happy in regards to NeXT compatibility.

Ben Lindstrom






More information about the openssh-unix-dev mailing list