diff options
author | Daniel Stenberg <daniel@haxx.se> | 2000-08-23 07:23:42 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2000-08-23 07:23:42 +0000 |
commit | d4731b70505d308064e85bfa1ea1f88904442af2 (patch) | |
tree | af88b993286e656d7b15062a704963142062ccc8 | |
parent | 8d2c24265d6d8ed74e3d2dc646cb1c3d20f290f3 (diff) |
Albert Chin-A-Young's fixes
-rw-r--r-- | configure.in | 313 | ||||
-rw-r--r-- | lib/file.c | 4 | ||||
-rw-r--r-- | lib/ftp.c | 8 | ||||
-rw-r--r-- | lib/getdate.c | 123 | ||||
-rw-r--r-- | lib/hostip.c | 22 | ||||
-rw-r--r-- | lib/http.c | 4 | ||||
-rw-r--r-- | lib/if2ip.c | 11 |
7 files changed, 275 insertions, 210 deletions
diff --git a/configure.in b/configure.in index 58701d335..8942c99be 100644 --- a/configure.in +++ b/configure.in @@ -161,164 +161,200 @@ then AC_DEFINE(DISABLED_THREADSAFE, 1, \ Set to explicitly specify we don't want to use thread-safe functions) else + dnl check for number of arguments to gethostbyname_r. it might take + dnl either 3, 5, or 6 arguments. + AC_CHECK_FUNCS(gethostbyname_r,[ + AC_MSG_CHECKING(if gethostbyname_r takes 3 arguments) + AC_TRY_RUN([ +#include <string.h> +#include <sys/types.h> +#include <netdb.h> -dnl check for a few thread-safe functions - - AC_CHECK_FUNCS( gethostbyname_r \ - gethostbyaddr_r \ - localtime_r \ - inet_ntoa_r - ) - - if test "$ac_cv_func_gethostbyname_r" = "yes"; then - - dnl ********************************************************************** - dnl Time to make a check for gethostbyname_r - dnl If it exists, it may use one of three different interfaces - dnl ********************************************************************** - - AC_MSG_CHECKING(for gethostbyname_r) - if test -z "$ac_cv_gethostbyname_args"; then - AC_TRY_COMPILE( - [ +int +main () { +struct hostent h; +struct hostent_data hdata; +char *name = "localhost"; +int rc; +memset(&h, 0, sizeof(struct hostent)); +memset(&hdata, 0, sizeof(struct hostent_data)); +rc = gethostbyname_r(name, &h, &hdata); +exit (rc != 0 ? 1 : 0); }],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_GETHOSTBYNAME_R_3) + ac_cv_gethostbyname_args=3],[ + AC_MSG_RESULT(no) + AC_MSG_CHECKING(if gethostbyname_r with -D_REENTRANT takes 3 arguments) + AC_TRY_RUN([ +#define _REENTRANT + +#include <string.h> #include <sys/types.h> -#include <netdb.h>], - [ +#include <netdb.h> + +int +main () { struct hostent h; struct hostent_data hdata; -char *name; -int rc; -rc = gethostbyname_r(name, &h, &hdata);], - ac_cv_gethostbyname_args=3) - fi - if test -z "$ac_cv_gethostbyname_args"; then - AC_TRY_COMPILE( - [ +char *name = "localhost"; +int rc; +memset(&h, 0, sizeof(struct hostent)); +memset(&hdata, 0, sizeof(struct hostent_data)); +rc = gethostbyname_r(name, &h, &hdata); +exit (rc != 0 ? 1 : 0); }],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_GETHOSTBYNAME_R_3) + AC_DEFINE(NEED_REENTRANT) + ac_cv_gethostbyname_args=3],[ + AC_MSG_RESULT(no) + AC_MSG_CHECKING(if gethostbyname_r takes 5 arguments) + AC_TRY_RUN([ #include <sys/types.h> -#include <netdb.h>], - [ +#include <netdb.h> + +int +main () { struct hostent *hp; struct hostent h; -char *name; -char buffer[10]; -int h_errno; -hp = gethostbyname_r(name, &h, buffer, 10, &h_errno);], - ac_cv_gethostbyname_args=5) - fi - if test -z "$ac_cv_gethostbyname_args"; then - AC_TRY_COMPILE( - [ +char *name = "localhost"; +char buffer[8192]; +int h_errno; +hp = gethostbyname_r(name, &h, buffer, 8192, &h_errno); +exit (hp == NULL ? 1 : 0); }],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_GETHOSTBYNAME_R_5) + ac_cv_gethostbyname_args=5],[ + AC_MSG_RESULT(no) + AC_MSG_CHECKING(if gethostbyname_r takes 6 arguments) + AC_TRY_RUN([ #include <sys/types.h> -#include <netdb.h>], - [ +#include <netdb.h> + +int +main () { struct hostent h; struct hostent *hp; -char *name; +char *name = "localhost"; char buf[10]; int rc; int h_errno; - rc = gethostbyname_r(name, &h, buf, 10, &hp, &h_errno); - ], - ac_cv_gethostbyname_args=6) - fi - if test -z "$ac_cv_gethostbyname_args"; then - AC_MSG_RESULT(no) - have_missing_r_funcs="$have_missing_r_funcs gethostbyname_r" - else - if test "$ac_cv_gethostbyname_args" = 3; then - AC_DEFINE(HAVE_GETHOSTBYNAME_R_3) - elif test "$ac_cv_gethostbyname_args" = 5; then - AC_DEFINE(HAVE_GETHOSTBYNAME_R_5) - elif test "$ac_cv_gethostbyname_args" = 6; then - AC_DEFINE(HAVE_GETHOSTBYNAME_R_6) - fi - AC_MSG_RESULT([yes, and it takes $ac_cv_gethostbyname_args arguments]) - fi - -dnl ********************************************************************** -dnl Time to make a check for gethostbyaddr_r -dnl If it exists, it may use one of three different interfaces -dnl ********************************************************************** - AC_MSG_CHECKING(for gethostbyaddr_r) - if test -z "$ac_cv_gethostbyaddr_args"; then - AC_TRY_COMPILE( - [ +exit (rc != 0 ? 1 : 0); }],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_GETHOSTBYNAME_R_6) + ac_cv_gethostbyname_args=6],[ + AC_MSG_RESULT(no) + have_missing_r_funcs="$have_missing_r_funcs gethostbyname_r"])])])])]) + + dnl check for number of arguments to gethostbyaddr_r. it might take + dnl either 5, 7, or 8 arguments. + AC_CHECK_FUNCS(gethostbyaddr_r,[ + AC_MSG_CHECKING(if gethostbyaddr_r takes 5 arguments) + AC_TRY_COMPILE([ #include <sys/types.h> -#include <netdb.h>], - [ - char * address; - int length; - int type; - struct hostent h; - struct hostent_data hdata; - int rc; - rc = gethostbyaddr_r(address, length, type, &h, &hdata); - ], - ac_cv_gethostbyaddr_args=5) - - fi - if test -z "$ac_cv_gethostbyaddr_args"; then - AC_TRY_COMPILE( - [ +#include <netdb.h>],[ +char * address; +int length; +int type; +struct hostent h; +struct hostent_data hdata; +int rc; +rc = gethostbyaddr_r(address, length, type, &h, &hdata);],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_GETHOSTBYADDR_R_5) + ac_cv_gethostbyaddr_args=5],[ + AC_MSG_RESULT(no) + AC_MSG_CHECKING(if gethostbyaddr_r with -D_REENTRANT takes 5 arguments) + AC_TRY_COMPILE([ +#define _REENTRANT #include <sys/types.h> -#include <netdb.h>], - [ - char * address; - int length; - int type; - struct hostent h; - char buffer[10]; - int buflen; - int h_errnop; - struct hostent * hp; - - hp = gethostbyaddr_r(address, length, type, &h, - buffer, buflen, &h_errnop); - ], - ac_cv_gethostbyaddr_args=7) - fi - - if test -z "$ac_cv_gethostbyaddr_args"; then - AC_TRY_COMPILE( - [ +#include <netdb.h>],[ +char * address; +int length; +int type; +struct hostent h; +struct hostent_data hdata; +int rc; +rc = gethostbyaddr_r(address, length, type, &h, &hdata);],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_GETHOSTBYADDR_R_5) + AC_DEFINE(NEED_REENTRANT) + ac_cv_gethostbyaddr_args=5],[ + AC_MSG_RESULT(no) + AC_MSG_CHECKING(if gethostbyaddr_r takes 7 arguments) + AC_TRY_COMPILE([ #include <sys/types.h> -#include <netdb.h>], - [ - char * address; - int length; - int type; - struct hostent h; - char buffer[10]; - int buflen; - int h_errnop; - struct hostent * hp; - int rc; - - rc = gethostbyaddr_r(address, length, type, &h, - buffer, buflen, &hp, &h_errnop); - ], - ac_cv_gethostbyaddr_args=8) - fi - if test -z "$ac_cv_gethostbyaddr_args"; then - AC_MSG_RESULT(no) - have_missing_r_funcs="$have_missing_r_funcs gethostbyaddr_r" - else - if test "$ac_cv_gethostbyaddr_args" = 5; then - AC_DEFINE(HAVE_GETHOSTBYADDR_R_5) - elif test "$ac_cv_gethostbyaddr_args" = 7; then - AC_DEFINE(HAVE_GETHOSTBYADDR_R_7) - elif test "$ac_cv_gethostbyaddr_args" = 8; then - AC_DEFINE(HAVE_GETHOSTBYADDR_R_8) - fi - AC_MSG_RESULT([yes, and it takes $ac_cv_gethostbyaddr_args arguments]) - fi - - fi +#include <netdb.h>],[ +char * address; +int length; +int type; +struct hostent h; +char buffer[10]; +int buflen; +int h_errnop; +struct hostent * hp; + +hp = gethostbyaddr_r(address, length, type, &h, + buffer, buflen, &h_errnop);],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_GETHOSTBYADDR_R_7) + ac_cv_gethostbyaddr_args=7],[ + AC_MSG_RESULT(no) + AC_MSG_CHECKING(if gethostbyaddr_r takes 8 arguments) + AC_TRY_COMPILE([ +#include <sys/types.h> +#include <netdb.h>],[ +char * address; +int length; +int type; +struct hostent h; +char buffer[10]; +int buflen; +int h_errnop; +struct hostent * hp; +int rc; +rc = gethostbyaddr_r(address, length, type, &h, + buffer, buflen, &hp, &h_errnop);],[ + AC_MSG_RESULT(yes) + AC_DEFINE(HAVE_GETHOSTBYADDR_R_8) + ac_cv_gethostbyaddr_args=8],[ + AC_MSG_RESULT(no) + have_missing_r_funcs="$have_missing_r_funcs gethostbyaddr_r"])])])])]) + + dnl determine if function definition for inet_ntoa_r exists. + AC_CHECK_FUNCS(inet_ntoa_r,[ + AC_MSG_CHECKING(whether inet_ntoa_r is declared) + AC_EGREP_CPP(inet_ntoa_r,[ +#include <arpa/inet.h>],[ + AC_DEFINE(HAVE_INET_NTOA_R_DECL) + AC_MSG_RESULT(yes)],[ + AC_MSG_RESULT(no) + AC_MSG_CHECKING(whether inet_ntoa_r with -D_REENTRANT is declared) + AC_EGREP_CPP(inet_ntoa_r,[ +#define _REENTRANT +#include <arpa/inet.h>],[ + AC_DEFINE(HAVE_INET_NTOA_R_DECL) + AC_DEFINE(NEED_REENTRANT) + AC_MSG_RESULT(yes)], + AC_MSG_RESULT(no))])]) + + dnl check for a few thread-safe functions + AC_CHECK_FUNCS(localtime_r,[ + AC_MSG_CHECKING(whether localtime_r is declared) + AC_EGREP_CPP(localtime_r,[ +#include <time.h>],[ + AC_MSG_RESULT(yes)],[ + AC_MSG_RESULT(no) + AC_MSG_CHECKING(whether localtime_r with -D_REENTRANT is declared) + AC_EGREP_CPP(localtime_r,[ +#define _REENTRANT +#include <time.h>],[ + AC_DEFINE(NEED_REENTRANT) + AC_MSG_RESULT(yes)], + AC_MSG_RESULT(no))])]) fi - dnl ********************************************************************** dnl Back to "normal" configuring dnl ********************************************************************** @@ -332,6 +368,7 @@ AC_CHECK_HEADERS( \ arpa/inet.h \ net/if.h \ netinet/in.h \ + netinet/if_ether.h \ netdb.h \ sys/select.h \ sys/socket.h \ diff --git a/lib/file.c b/lib/file.c index 3b6aec63d..53e704f6b 100644 --- a/lib/file.c +++ b/lib/file.c @@ -60,13 +60,17 @@ #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif +#ifdef HAVE_NETINET_IN_H #include <netinet/in.h> +#endif #include <sys/time.h> #include <sys/resource.h> #ifdef HAVE_UNISTD_H #include <unistd.h> #endif +#ifdef HAVE_NETDB_H #include <netdb.h> +#endif #ifdef HAVE_ARPA_INET_H #include <arpa/inet.h> #endif @@ -60,22 +60,22 @@ #include <sys/socket.h> #endif #include <sys/types.h> +#ifdef HAVE_NETINET_IN_H #include <netinet/in.h> +#endif #ifdef HAVE_ARPA_INET_H #include <arpa/inet.h> #endif #include <sys/utsname.h> +#ifdef HAVE_NETDB_H #include <netdb.h> #endif +#endif #if defined(WIN32) && defined(__GNUC__) || defined(__MINGW32__) #include <errno.h> #endif -#ifdef HAVE_INET_NTOA_R -#include "inet_ntoa_r.h" -#endif - #include <curl/curl.h> #include "urldata.h" #include "sendf.h" diff --git a/lib/getdate.c b/lib/getdate.c index edebf4e06..5af73c434 100644 --- a/lib/getdate.c +++ b/lib/getdate.c @@ -32,15 +32,18 @@ ** This code is in the public domain and has no copyright. */ -#define _REENTRANT /* Necessary to use in Solaris, since the silly guys at Sun - made the localtime_r() prototype dependent on it (or - _POSIX_C_SOURCE or _POSIX_PTHREAD_SEMANTICS). */ - #ifdef HAVE_CONFIG_H # include "config.h" # ifdef HAVE_ALLOCA_H # include <alloca.h> # endif + +# ifdef NEED_REENTRANT +# define _REENTRANT /* Necessary to use in Solaris, since the silly guys at + Sun made the localtime_r() prototype dependent on it + (or _POSIX_C_SOURCE or _POSIX_PTHREAD_SEMANTICS) */ +# endif + # ifdef HAVE_TIME_H # include <time.h> # endif @@ -219,7 +222,7 @@ static int yyRelSeconds; static int yyRelYear; -#line 202 "getdate.y" +#line 205 "getdate.y" typedef union { int Number; enum _MERIDIAN Meridian; @@ -302,11 +305,11 @@ static const short yyrhs[] = { -1, #if YYDEBUG != 0 static const short yyrline[] = { 0, - 218, 219, 222, 225, 228, 231, 234, 237, 240, 246, - 252, 261, 267, 279, 282, 285, 291, 295, 299, 305, - 309, 327, 333, 339, 343, 348, 352, 359, 367, 370, - 373, 376, 379, 382, 385, 388, 391, 394, 397, 400, - 403, 406, 409, 412, 415, 418, 421, 426, 459, 463 + 221, 222, 225, 228, 231, 234, 237, 240, 243, 249, + 255, 264, 270, 282, 285, 288, 294, 298, 302, 308, + 312, 330, 336, 342, 346, 351, 355, 362, 370, 373, + 376, 379, 382, 385, 388, 391, 394, 397, 400, 403, + 406, 409, 412, 415, 418, 421, 424, 429, 462, 466 }; #endif @@ -387,7 +390,7 @@ static const short yycheck[] = { 0, 56 }; /* -*-C-*- Note some compilers choke on comments on `#line' lines. */ -#line 3 "/usr/local/share/bison.simple" +#line 3 "/opt/TWWfsw/bison/share/bison.simple" /* This file comes from bison-1.28. */ /* Skeleton output parser for bison, @@ -601,7 +604,7 @@ __yy_memcpy (char *to, char *from, unsigned int count) #endif #endif -#line 217 "/usr/local/share/bison.simple" +#line 217 "/opt/TWWfsw/bison/share/bison.simple" /* The user can define YYPARSE_PARAM as the name of an argument to be passed into yyparse. The argument should have type void *. @@ -930,37 +933,37 @@ yyreduce: switch (yyn) { case 3: -#line 222 "getdate.y" +#line 225 "getdate.y" { yyHaveTime++; ; break;} case 4: -#line 225 "getdate.y" +#line 228 "getdate.y" { yyHaveZone++; ; break;} case 5: -#line 228 "getdate.y" +#line 231 "getdate.y" { yyHaveDate++; ; break;} case 6: -#line 231 "getdate.y" +#line 234 "getdate.y" { yyHaveDay++; ; break;} case 7: -#line 234 "getdate.y" +#line 237 "getdate.y" { yyHaveRel++; ; break;} case 9: -#line 240 "getdate.y" +#line 243 "getdate.y" { yyHour = yyvsp[-1].Number; yyMinutes = 0; @@ -969,7 +972,7 @@ case 9: ; break;} case 10: -#line 246 "getdate.y" +#line 249 "getdate.y" { yyHour = yyvsp[-3].Number; yyMinutes = yyvsp[-1].Number; @@ -978,7 +981,7 @@ case 10: ; break;} case 11: -#line 252 "getdate.y" +#line 255 "getdate.y" { yyHour = yyvsp[-3].Number; yyMinutes = yyvsp[-1].Number; @@ -990,7 +993,7 @@ case 11: ; break;} case 12: -#line 261 "getdate.y" +#line 264 "getdate.y" { yyHour = yyvsp[-5].Number; yyMinutes = yyvsp[-3].Number; @@ -999,7 +1002,7 @@ case 12: ; break;} case 13: -#line 267 "getdate.y" +#line 270 "getdate.y" { yyHour = yyvsp[-5].Number; yyMinutes = yyvsp[-3].Number; @@ -1012,53 +1015,53 @@ case 13: ; break;} case 14: -#line 279 "getdate.y" +#line 282 "getdate.y" { yyTimezone = yyvsp[0].Number; ; break;} case 15: -#line 282 "getdate.y" +#line 285 "getdate.y" { yyTimezone = yyvsp[0].Number - 60; ; break;} case 16: -#line 286 "getdate.y" +#line 289 "getdate.y" { yyTimezone = yyvsp[-1].Number - 60; ; break;} case 17: -#line 291 "getdate.y" +#line 294 "getdate.y" { yyDayOrdinal = 1; yyDayNumber = yyvsp[0].Number; ; break;} case 18: -#line 295 "getdate.y" +#line 298 "getdate.y" { yyDayOrdinal = 1; yyDayNumber = yyvsp[-1].Number; ; break;} case 19: -#line 299 "getdate.y" +#line 302 "getdate.y" { yyDayOrdinal = yyvsp[-1].Number; yyDayNumber = yyvsp[0].Number; ; break;} case 20: -#line 305 "getdate.y" +#line 308 "getdate.y" { yyMonth = yyvsp[-2].Number; yyDay = yyvsp[0].Number; ; break;} case 21: -#line 309 "getdate.y" +#line 312 "getdate.y" { /* Interpret as YYYY/MM/DD if $1 >= 1000, otherwise as MM/DD/YY. The goal in recognizing YYYY/MM/DD is solely to support legacy @@ -1079,7 +1082,7 @@ case 21: ; break;} case 22: -#line 327 "getdate.y" +#line 330 "getdate.y" { /* ISO 8601 format. yyyy-mm-dd. */ yyYear = yyvsp[-2].Number; @@ -1088,7 +1091,7 @@ case 22: ; break;} case 23: -#line 333 "getdate.y" +#line 336 "getdate.y" { /* e.g. 17-JUN-1992. */ yyDay = yyvsp[-2].Number; @@ -1097,14 +1100,14 @@ case 23: ; break;} case 24: -#line 339 "getdate.y" +#line 342 "getdate.y" { yyMonth = yyvsp[-1].Number; yyDay = yyvsp[0].Number; ; break;} case 25: -#line 343 "getdate.y" +#line 346 "getdate.y" { yyMonth = yyvsp[-3].Number; yyDay = yyvsp[-2].Number; @@ -1112,14 +1115,14 @@ case 25: ; break;} case 26: -#line 348 "getdate.y" +#line 351 "getdate.y" { yyMonth = yyvsp[0].Number; yyDay = yyvsp[-1].Number; ; break;} case 27: -#line 352 "getdate.y" +#line 355 "getdate.y" { yyMonth = yyvsp[-1].Number; yyDay = yyvsp[-2].Number; @@ -1127,7 +1130,7 @@ case 27: ; break;} case 28: -#line 359 "getdate.y" +#line 362 "getdate.y" { yyRelSeconds = -yyRelSeconds; yyRelMinutes = -yyRelMinutes; @@ -1138,115 +1141,115 @@ case 28: ; break;} case 30: -#line 370 "getdate.y" +#line 373 "getdate.y" { yyRelYear += yyvsp[-1].Number * yyvsp[0].Number; ; break;} case 31: -#line 373 "getdate.y" +#line 376 "getdate.y" { yyRelYear += yyvsp[-1].Number * yyvsp[0].Number; ; break;} case 32: -#line 376 "getdate.y" +#line 379 "getdate.y" { yyRelYear += yyvsp[0].Number; ; break;} case 33: -#line 379 "getdate.y" +#line 382 "getdate.y" { yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number; ; break;} case 34: -#line 382 "getdate.y" +#line 385 "getdate.y" { yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number; ; break;} case 35: -#line 385 "getdate.y" +#line 388 "getdate.y" { yyRelMonth += yyvsp[0].Number; ; break;} case 36: -#line 388 "getdate.y" +#line 391 "getdate.y" { yyRelDay += yyvsp[-1].Number * yyvsp[0].Number; ; break;} case 37: -#line 391 "getdate.y" +#line 394 "getdate.y" { yyRelDay += yyvsp[-1].Number * yyvsp[0].Number; ; break;} case 38: -#line 394 "getdate.y" +#line 397 "getdate.y" { yyRelDay += yyvsp[0].Number; ; break;} case 39: -#line 397 "getdate.y" +#line 400 "getdate.y" { yyRelHour += yyvsp[-1].Number * yyvsp[0].Number; ; break;} case 40: -#line 400 "getdate.y" +#line 403 "getdate.y" { yyRelHour += yyvsp[-1].Number * yyvsp[0].Number; ; break;} case 41: -#line 403 "getdate.y" +#line 406 "getdate.y" { yyRelHour += yyvsp[0].Number; ; break;} case 42: -#line 406 "getdate.y" +#line 409 "getdate.y" { yyRelMinutes += yyvsp[-1].Number * yyvsp[0].Number; ; break;} case 43: -#line 409 "getdate.y" +#line 412 "getdate.y" { yyRelMinutes += yyvsp[-1].Number * yyvsp[0].Number; ; break;} case 44: -#line 412 "getdate.y" +#line 415 "getdate.y" { yyRelMinutes += yyvsp[0].Number; ; break;} case 45: -#line 415 "getdate.y" +#line 418 "getdate.y" { yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number; ; break;} case 46: -#line 418 "getdate.y" +#line 421 "getdate.y" { yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number; ; break;} case 47: -#line 421 "getdate.y" +#line 424 "getdate.y" { yyRelSeconds += yyvsp[0].Number; ; break;} case 48: -#line 427 "getdate.y" +#line 430 "getdate.y" { if (yyHaveTime && yyHaveDate && !yyHaveRel) yyYear = yyvsp[0].Number; @@ -1279,20 +1282,20 @@ case 48: ; break;} case 49: -#line 460 "getdate.y" +#line 463 "getdate.y" { yyval.Meridian = MER24; ; break;} case 50: -#line 464 "getdate.y" +#line 467 "getdate.y" { yyval.Meridian = yyvsp[0].Meridian; ; break;} } /* the action file gets copied in in place of this dollarsign */ -#line 543 "/usr/local/share/bison.simple" +#line 543 "/opt/TWWfsw/bison/share/bison.simple" yyvsp -= yylen; yyssp -= yylen; @@ -1512,7 +1515,7 @@ yyerrhandle: } return 1; } -#line 469 "getdate.y" +#line 472 "getdate.y" /* Include this file down here because bison inserts code above which diff --git a/lib/hostip.c b/lib/hostip.c index 3ae21cb1b..fe8a7743f 100644 --- a/lib/hostip.c +++ b/lib/hostip.c @@ -40,9 +40,12 @@ #include <string.h> #include <malloc.h> +#include <errno.h> #include "setup.h" +#define _REENTRANT + #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__) #include <winsock.h> #else @@ -52,8 +55,12 @@ #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif +#ifdef HAVE_NETINET_IN_H #include <netinet/in.h> +#endif +#ifdef HAVE_NETDB_H #include <netdb.h> +#endif #ifdef HAVE_ARPA_INET_H #include <arpa/inet.h> #endif @@ -62,9 +69,7 @@ #include "urldata.h" #include "sendf.h" -#define _REENTRANT - -#ifdef HAVE_INET_NTOA_R +#ifndef HAVE_INET_NTOA_R_DECL #include "inet_ntoa_r.h" #endif @@ -103,6 +108,7 @@ struct hostent *GetHost(struct UrlData *data, { struct hostent *h = NULL; unsigned long in; + int ret; if ( (in=inet_addr(hostname)) != INADDR_NONE ) { struct in_addr *addrentry; @@ -145,13 +151,17 @@ struct hostent *GetHost(struct UrlData *data, /* August 4th, 2000. I don't have any such system around so I write this blindly in hope it might work or that someone else will help me fix - this. */ + this. August 22nd, 2000: Albert Chin-A-Young brought an updated version + that should work! */ - h = gethostbyname_r(hostname, + ret = gethostbyname_r(hostname, (struct hostent *)buf, (struct hostent_data *)(buf + sizeof(struct hostent))); + + /* result expected in h */ + h = (struct hostent*)buf; h_errnop= errno; /* we don't deal with this, but set it anyway */ - if(NULL == h) + if(ret) #endif { infof(data, "gethostbyname_r(2) failed for %s\n", hostname); diff --git a/lib/http.c b/lib/http.c index fae22816f..0632f6084 100644 --- a/lib/http.c +++ b/lib/http.c @@ -38,9 +38,11 @@ * ------------------------------------------------------------ ****************************************************************************/ +#ifdef NEED_REENTRANT #define _REENTRANT /* Necessary to use in Solaris, since the silly guys at Sun made the localtime_r() prototype dependent on it (or _POSIX_C_SOURCE or _POSIX_PTHREAD_SEMANTICS). */ +#endif /* -- WIN32 approved -- */ #include <stdio.h> @@ -63,7 +65,9 @@ #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif +#ifdef HAVE_NETINET_IN_H #include <netinet/in.h> +#endif #include <sys/time.h> #ifdef HAVE_TIME_H diff --git a/lib/if2ip.c b/lib/if2ip.c index 420b6df2c..ede5cf08c 100644 --- a/lib/if2ip.c +++ b/lib/if2ip.c @@ -50,12 +50,19 @@ #if ! defined(WIN32) && ! defined(__BEOS__) +#ifdef NEED_REENTRANT +#define _REENTRANT +#endif + +#ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> +#endif +#ifdef HAVE_NETINET_IN_H #include <netinet/in.h> +#endif #ifdef HAVE_ARPA_INET_H #include <arpa/inet.h> #endif -#include <netinet/in.h> #ifdef HAVE_SYS_TIME_H /* This must be before net/if.h for AIX 3.2 to enjoy life */ @@ -75,7 +82,7 @@ #include <sys/sockio.h> #endif -#ifdef HAVE_INET_NTOA_R +#ifndef HAVE_INET_NTOA_R_DECL #include "inet_ntoa_r.h" #endif |