1828728 Members
2391 Online
109985 Solutions
New Discussion

C library for vsnprintf

 
SOLVED
Go to solution
John712_1
Regular Advisor

C library for vsnprintf

Hi there,

I'm trying to compile povray on a c3000 under hpux 11.11. but it reports that the C library is too old and does not support vsnprintf(..) function. Does anybody know if there is a C library available which support vsnprintf function?
thanks in advance.

YZ
5 REPLIES 5
Mustafa Gulercan
Respected Contributor

Re: C library for vsnprintf

hi john,
here is the link for c library;
http://www.mibsoftware.com/userkt/inn/dev/inn2.0-beta/inn/include/clibrary.h

regards;
mustafa
Arunvijai_4
Honored Contributor

Re: C library for vsnprintf

Hi John,

Are you trying to compile with Ansi-C or bundled compiler ? Probably, you can try with GCC.

http://h21007.www2.hp.com/dspp/tech/tech_TechSoftwareDetailPage_IDX/1,1703,547,00.html

-Arun
"A ship in the harbor is safe, but that is not what ships are built for"
John712_1
Regular Advisor

Re: C library for vsnprintf

Below is the piece of code in the configure file which, I think, is
related to the vsnprintf-check.
As I am totally new to unix things, could anybody give me some clue that
how can I modify it please.
Thanks in advance.
------------------------------------------
#AC_FUNC_STRFTIME
#AC_FUNC_VPRINTF

# vsnprintf (C99)
if test x"$enable_vsnprintf_check" != x"no"; then
echo "$as_me:$LINENO: checking for vsnprintf">&5
echo $ECHO_N "checking for vsnprintf... $ECHO_C">&6
if test "${ac_cv_func_vsnprintf+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C">&6
else
cat>conftest.$ac_ext <<_ACEOF
#line $LINENO "configure"
/* confdefs.h. */
_ACEOF
cat confdefs.h>>conftest.$ac_ext
cat>>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char vsnprintf (); below.
Prefer to if __STDC__ is defined, since
exists even on freestanding compilers. */
#ifdef __STDC__
# include
#else
# include
#endif
/* Override any gcc2 internal prototype to avoid an error. */
#ifdef __cplusplus
extern "C"
{
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
char vsnprintf ();
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_vsnprintf) || defined (__stub___vsnprintf)
choke me
#else
char (*f) () = vsnprintf;
#endif
#ifdef __cplusplus
}
#endif

int
main ()
{
return f != vsnprintf;
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"")>&5
(eval $ac_link) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status">&5
(exit $ac_status); } &&
{ ac_try='test -s conftest$ac_exeext'
{ (eval echo "$as_me:$LINENO: \"$ac_try\"")>&5
(eval $ac_try) 2>&5
ac_status=$?
echo "$as_me:$LINENO: \$? = $ac_status">&5
(exit $ac_status); }; }; then
ac_cv_func_vsnprintf=yes
else
echo "$as_me: failed program was:">&5
sed 's/^/| /' conftest.$ac_ext>&5

ac_cv_func_vsnprintf=no
fi
rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext
fi
echo "$as_me:$LINENO: result: $ac_cv_func_vsnprintf">&5
echo "${ECHO_T}$ac_cv_func_vsnprintf">&6
if test $ac_cv_func_vsnprintf = yes; then
:
else
{ { echo "$as_me:$LINENO: error:
*** This system does not provide the C99 vsnprintf() function which
*** is required to compile $PACKAGE_NAME. You should consider updating
*** your C library as it is too old. Alternatively you might install
*** a specific library implementing the (v)snprintf family of functions.
*** Searching the web should give you appropriate pointers.
***
*** In case you want to try compiling $PACKAGE_NAME while your system
lacks
*** this function (meaning that compilation *will* fail unless you
provide
*** a replacement function), try the --disable-vsnprintf-check option.
">&5
echo "$as_me: error:
*** This system does not provide the C99 vsnprintf() function which
*** is required to compile $PACKAGE_NAME. You should consider updating
*** your C library as it is too old. Alternatively you might install
*** a specific library implementing the (v)snprintf family of functions.
*** Searching the web should give you appropriate pointers.
***
*** In case you want to try compiling $PACKAGE_NAME while your system
lacks
*** this function (meaning that compilation *will* fail unless you
provide
*** a replacement function), try the --disable-vsnprintf-check option.
">&2;}
{ (exit 1); exit 1; }; }

---------------------------------------------------
Gregory Fruth
Esteemed Contributor
Solution

Re: C library for vsnprintf

Back at 10.20, vsnprintf was in included
in libc but for some reason there wasn't a
prototype for it in stdio.h. Perhaps you're
in a similar situation. Get up to date on
libc and/or C DevKit patches.

Failing that, do a 'nm /usr/lib/libc.sl' to
see if vsnprintf is already in your libc.
If so, and you're just missing the prototype,
then either disable the autoconf check for
vsnprintf (I dunno how to do that) or simply
provide the prototype yourself:

extern int vsnprintf(char *, __size_t, const char *, __va_list);

If vsnprintf is not in your libc and there
aren't any patches for it, you could write
a pass-through version of vsnprintf which
just calls vsprintf. However you'd lose
the buffer safety properties of vsnprintf.
John712_1
Regular Advisor

Re: C library for vsnprintf

Thanks, Gregory and Mustafa and Arun. I will give a try.

YZ