1
0
mirror of https://github.com/bgp/bgpq4.git synced 2024-05-11 05:55:05 +00:00

ok, solaris not works (as expected, though..)

This commit is contained in:
snar
2007-04-04 15:16:26 +00:00
parent 75c66b471c
commit dc952ca664
5 changed files with 173 additions and 6 deletions

View File

@ -2,10 +2,10 @@ CC=@CC@
CFLAGS=@CFLAGS@ @DEFS@ -g -Wall -I. -O0
LDADD=@LDFLAGS@ @LIBS@
OBJECTS=bgpq3.o sx_report.o bgpq_expander.o sx_slentry.o bgpq3_printer.o
OBJECTS+=sx_prefix.o
SRCS=bgpq3.c sx_report.c bgpq_expander.c sx_slentry.c bgpq3_printer.c
SRCS+=sx_prefix.c
OBJECTS=bgpq3.o sx_report.o bgpq_expander.o sx_slentry.o bgpq3_printer.o \
sx_prefix.o
SRCS=bgpq3.c sx_report.c bgpq_expander.c sx_slentry.c bgpq3_printer.c \
sx_prefix.c
all: bgpq3

View File

@ -150,11 +150,14 @@ bgpq_expand_ripe(FILE* f, int (*callback)(char*, void*), void* udata,
va_end(ap);
SX_DEBUG(debug_expander,"expander(ripe): sending '%s'\n", request);
fseek(f,0,SEEK_END);
fwrite(request,1,strlen(request),f);
fflush(f);
sawNL=0;
fseek(f,0,SEEK_END);
while(fgets(request,sizeof(request),f)) {
fseek(f,0,SEEK_END);
if(request[0]=='\n') {
if(b->family==AF_INET && otype && !strcmp(otype,"route")) {
SX_DEBUG(debug_expander,"expander(ripe): got route: %s\n",
@ -183,7 +186,7 @@ bgpq_expand_ripe(FILE* f, int (*callback)(char*, void*), void* udata,
*c=0;
otype=strdup(request);
c++;
while((isspace(*c))) c++;
while((isspace((int)*c))) c++;
object=strdup(c);
c=strchr(object,'\n');
if(c) *c=0;
@ -219,6 +222,7 @@ bgpq_expand_radb(FILE* f, int (*callback)(char*, void*), void* udata,
SX_DEBUG(debug_expander,"expander: sending '%s'\n", request);
ret=fwrite(request,1,strlen(request),f);
fseek(f,0,SEEK_END);
if(ret!=strlen(request)) {
sx_report(SX_FATAL,"Partial write to radb, only %i bytes written: %s\n",
ret,strerror(errno));
@ -235,7 +239,7 @@ bgpq_expand_radb(FILE* f, int (*callback)(char*, void*), void* udata,
exit(1);
};
SX_DEBUG(debug_expander>2,"expander: initially got %i bytes, '%s'\n",
ret,request);
strlen(request),request);
if(request[0]=='A') {
char* eon, *c;
long togot=strtoul(request+1,&eon,10);
@ -255,6 +259,8 @@ bgpq_expand_radb(FILE* f, int (*callback)(char*, void*), void* udata,
};
exit(1);
};
SX_DEBUG(debug_expander>2,"expander: final reply of %i bytes, '%s'\n",
strlen(recvbuffer),recvbuffer);
for(c=recvbuffer; c<recvbuffer+togot;) {
size_t spn=strcspn(c," \n");
@ -338,6 +344,7 @@ bgpq_expand(struct bgpq_expander* b)
exit(1);
};
fseek(f,0,SEEK_END);
if((ret=fwrite("!!\n",1,3,f))!=3) {
sx_report(SX_ERROR,"Partial fwrite to radb: %i bytes, %s\n",
ret, strerror(errno));
@ -347,6 +354,7 @@ bgpq_expand(struct bgpq_expander* b)
if(b->sources && b->sources[0]!=0) {
char sources[128];
snprintf(sources,sizeof(sources),"!s%s\n", b->sources);
fseek(f,0,SEEK_END);
fwrite(sources,strlen(sources),1,f);
};

View File

@ -1,5 +1,11 @@
/* config.h.in. Generated from configure.in by autoheader. */
/* Define to 1 if you have the `nsl' library (-lnsl). */
#undef HAVE_LIBNSL
/* Define to 1 if you have the `socket' library (-lsocket). */
#undef HAVE_LIBSOCKET
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT

150
configure vendored
View File

@ -2175,6 +2175,156 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
echo "$as_me:$LINENO: checking for socket in -lsocket" >&5
echo $ECHO_N "checking for socket in -lsocket... $ECHO_C" >&6
if test "${ac_cv_lib_socket_socket+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lsocket $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* 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 socket ();
int
main ()
{
socket ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (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); }; } &&
{ 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_lib_socket_socket=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_socket_socket=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_socket_socket" >&5
echo "${ECHO_T}$ac_cv_lib_socket_socket" >&6
if test $ac_cv_lib_socket_socket = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBSOCKET 1
_ACEOF
LIBS="-lsocket $LIBS"
fi
echo "$as_me:$LINENO: checking for getaddrinfo in -lnsl" >&5
echo $ECHO_N "checking for getaddrinfo in -lnsl... $ECHO_C" >&6
if test "${ac_cv_lib_nsl_getaddrinfo+set}" = set; then
echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lnsl $LIBS"
cat >conftest.$ac_ext <<_ACEOF
/* confdefs.h. */
_ACEOF
cat confdefs.h >>conftest.$ac_ext
cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* 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 getaddrinfo ();
int
main ()
{
getaddrinfo ();
;
return 0;
}
_ACEOF
rm -f conftest.$ac_objext conftest$ac_exeext
if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>conftest.er1
ac_status=$?
grep -v '^ *+' conftest.er1 >conftest.err
rm -f conftest.er1
cat conftest.err >&5
echo "$as_me:$LINENO: \$? = $ac_status" >&5
(exit $ac_status); } &&
{ ac_try='test -z "$ac_c_werror_flag"
|| test ! -s conftest.err'
{ (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); }; } &&
{ 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_lib_nsl_getaddrinfo=yes
else
echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
ac_cv_lib_nsl_getaddrinfo=no
fi
rm -f conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
echo "$as_me:$LINENO: result: $ac_cv_lib_nsl_getaddrinfo" >&5
echo "${ECHO_T}$ac_cv_lib_nsl_getaddrinfo" >&6
if test $ac_cv_lib_nsl_getaddrinfo = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LIBNSL 1
_ACEOF
LIBS="-lnsl $LIBS"
fi
ac_config_files="$ac_config_files Makefile"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure

View File

@ -2,5 +2,8 @@ AC_INIT(bgpq3.c)
AC_CONFIG_HEADER(config.h)
AC_PROG_CC
AC_CHECK_LIB(socket,socket)
AC_CHECK_LIB(nsl,getaddrinfo)
AC_OUTPUT(Makefile)