Ultrix patches for bind 8.2.2-P3
Simon Burge
simonb at telstra.com.au
Tue Nov 16 06:16:17 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.
More information about the bind-workers
mailing list