Use vsprintf if vasprintf is not available.
This commit is contained in:
parent
6dd03e81a2
commit
e8fe6105bf
|
@ -343,7 +343,7 @@ esac
|
||||||
AC_CHECK_HEADERS(libgen.h sys/timeb.h posix/time.h sys/select.h nlist.h)
|
AC_CHECK_HEADERS(libgen.h sys/timeb.h posix/time.h sys/select.h nlist.h)
|
||||||
AC_CHECK_HEADERS(sys/un.h)
|
AC_CHECK_HEADERS(sys/un.h)
|
||||||
AC_CHECK_HEADERS(crypt.h)
|
AC_CHECK_HEADERS(crypt.h)
|
||||||
AC_CHECK_FUNCS(gettimeofday ftime nlist select setitimer sigaction)
|
AC_CHECK_FUNCS(gettimeofday ftime nlist select setitimer sigaction vasprintf)
|
||||||
SCSH_SOCKLEN_T
|
SCSH_SOCKLEN_T
|
||||||
AC_CHECK_FUNC(dlopen, AC_DEFINE(HAVE_DLOPEN),
|
AC_CHECK_FUNC(dlopen, AC_DEFINE(HAVE_DLOPEN),
|
||||||
AC_CHECK_FUNC(nlist, [LIBOBJS="$LIBOBJS c/fake/libdl1.o"],
|
AC_CHECK_FUNC(nlist, [LIBOBJS="$LIBOBJS c/fake/libdl1.o"],
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "scheme48.h"
|
#include "scheme48.h"
|
||||||
#include "libscsh.h"
|
#include "libscsh.h"
|
||||||
|
#include "sysdep.h"
|
||||||
|
|
||||||
s48_value s48_command_binding;
|
s48_value s48_command_binding;
|
||||||
s48_value s48_to_string_binding;
|
s48_value s48_to_string_binding;
|
||||||
|
@ -22,16 +23,24 @@ s48_value s48_vcommand (char* fmt, va_list ap)
|
||||||
char* command;
|
char* command;
|
||||||
s48_value ret;
|
s48_value ret;
|
||||||
|
|
||||||
if (vasprintf(&command, fmt, ap) == -1){
|
#ifdef HAVE_VASPRINTF
|
||||||
fprintf(stderr, "error in vasprintf\n");
|
if (vasprintf(&command, fmt, ap) == -1){
|
||||||
exit(1);
|
fprintf(stderr, "error in vasprintf\n");
|
||||||
}
|
exit(1);
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
command = (char *)calloc (1000, sizeof (char));
|
||||||
|
if (vsprintf(command, fmt, ap) == -1){
|
||||||
|
fprintf(stderr, "error in vsprintf\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
fprintf (stderr,"The command is: %s\n", command);
|
fprintf (stderr,"The command is: %s\n", command);
|
||||||
S48_SHARED_BINDING_CHECK (s48_command_binding);
|
S48_SHARED_BINDING_CHECK (s48_command_binding);
|
||||||
|
|
||||||
ret = s48_call_scheme (S48_SHARED_BINDING_REF (s48_command_binding),
|
ret = s48_call_scheme (S48_SHARED_BINDING_REF (s48_command_binding),
|
||||||
1,
|
1,
|
||||||
s48_enter_string (command));
|
s48_enter_string (command));
|
||||||
|
|
||||||
free (command);
|
free (command);
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
|
|
Loading…
Reference in New Issue