Ultrix patches for bind 8.2.2-P3

Mark_Andrews at iengines.com Mark_Andrews at iengines.com
Tue Nov 16 07:25:29 UTC 1999


> Mark_Andrews at iengines.com wrote:
> 
> > > Here's the problem I was talking about where sprintf() is declared
> > > wrongly (from <stdio.h>):
> > > 
> > > 	#ifdef __STDC__
> > > 	/* function prototype */
> > > 	extern int      sprintf( char *__s, const char *__format, ... );
> > > 	#else
> > > 	#if defined(__SYSTEM_FIVE) || defined(__POSIX)
> > > 	extern int sprintf();
> > > 	#else
> > > 	extern char     *sprintf();
> > > 	#endif /* __SYSTEM_FIVE || __POSIX */
> > > 	#endif /* __STDC__ */
> > > 
> > > Using "-std1" defined __STDC__, but doesn't affect what libraries
> > > are linked in!  I think a better way to solve this would be to leave
> > > SPRINTF_CHAR in "port_after.h", but also have "#define sprintf
> > > my_sprintf" in there and put something in the Ultrix noop.c that DTRT.
> > > Does this sound any better?
> > > 
> > > Simon.
> > 
> > 	If that ends up being the only way.
> > 
> > 	#include <stdarg.h>
> > 	#include <stdio.h>
> > 
> > 	char *
> > 	my_sprintf(char *s, const char *format, ...) {
> > 		va_list ap;
> > 
> > 		va_start(ap, format);
> > 		vsprintf(s, format, ap);
> > 		va_end(va_list ap);
> > 		return(s);
> > 	}
> 
> Gee, I couldn't see the forest for the trees (or is that the other way
> around?)...  vsprintf() always returns an int - would it be better to
> have my_sprintf() return that and save a call to strlen() every time?
> 
> Also, do we have to worry about namespace polution in libbind?  Should
> that be my_sprintf() or _my_sprintf() ?
> 
> Simon.

	I wouldn't trust vsprintf to always return a int given sprintf's
	mess.

	__isc_sprintf() might be better.

	Mark
--
Mark Andrews, Internet Engines Inc. / Internet Software Consortium
1 Seymour St., Dundas Valley, NSW 2117, Australia
PHONE: +61 2 9871 4742                 INTERNET: Mark_Andrews at iengines.com


More information about the bind-workers mailing list