solaris 2.5.1 still no good

Ben Taylor bent at clark.net
Thu Jan 13 15:18:14 EST 2000


On Wed, 12 Jan 2000, Aris Mulyono wrote:

> Hello,
> 
> 
> I've got the same problem like this one.
> Can somebody send the snprintf.c or other ways around please?

This is a snippet of code an engineer at Sun sent me when they
were confused about some code which couldn't find snprintf under
2.5/2.5.1.

It looks like all we have to do for 2.5/2.5.1 support is define
#define snprintf __snprintf
#define vsnprintf __vsnprintf

I will check my 2.5.1 system tommorow and see what I can do 
about patching.  (Anyone got a snippet of Autoconf to 
test various versions of a particular Operating system)

Let me know if this fixes the 2.5/2.5.1 problem

Thanks

Ben

------



/* 
 * If compiled and linked on OS 5.5.1 or earlier works on 5.5 or later.
 * to compile on 5.6 or later and work on 5.5.1 or earlire,
 * reverse __snprintf and snprintf at indicated lines.
 * If compiled on 5.6 or later without reversing, it will work on 5.6 or
 * later but not 5.5.1 or earlier.
 * For OS 5.4 or earlier you need libc patch. If not it will core dump;
 */
 
int      snprintf(char *, size_t, const char *, ...);
#pragma weak snprintf

int      __snprintf(char *, size_t, const char *, ...);
#pragma weak __snprintf

/* to compile on 5.6 or later and work on 5.5 or earlier use __snprintf
here */
int  (*snprintf_p)(char *, size_t, const char *, ...) = snprintf;


#define snprintf snprintf_p

main() {
        char    buf[100];
        if (snprintf_p == NULL) {
/* to compile on 5.6 or later and work on 5.5 or earlier use snprintf here
*/
                snprintf_p =  __snprintf;
        }

> 
> Thanks,
> 
> <------- snipped from mail archive ---------------------------------->
> I just email'd, from my other account, the snprintf.c that we distribute
> in PostgreSQL...its been thoroughly tested on all the platforms that we
> support, with Solaris 2.5.1 being one of them...the bsd-snprintf.c that we
> included in OpenSSH, I believe, was the stock FreeBSD one, whereas this
> one is meant to be generic ...
> 
> I *believe* that we pulled/borrowed this from sendmail originally...
> 
> <------------------ end snip ---------------------------------------->
> 
> bsd-snprintf.c: In function `msetup':
> bsd-snprintf.c:86: warning: implicit declaration of function `getpagesize'
> bsd-snprintf.c:91: `x' undeclared (first use this function)
> bsd-snprintf.c:91: (Each undeclared identifier is reported only once
> bsd-snprintf.c:91: for each function it appears in.)
> bsd-snprintf.c:91: `y' undeclared (first use this function)
> bsd-snprintf.c:91: warning: left-hand operand of comma expression has no effect
> bsd-snprintf.c: In function `vsnprintf':
> bsd-snprintf.c:133: warning: variable `ret' might be clobbered by `longjmp' or
> `vfork'
> bsd-snprintf.c: At top level:
> bsd-snprintf.c:52: warning: `caught' defined but not used
> make: *** [bsd-snprintf.o] Error 1
> 
> -- 
>  Aris Mulyono
> 






More information about the openssh-unix-dev mailing list