1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-21 23:58:49 -05:00

Albert Chin-A-Young's fixes

This commit is contained in:
Daniel Stenberg 2000-08-23 07:23:42 +00:00
parent 8d2c24265d
commit d4731b7050
7 changed files with 297 additions and 232 deletions

View File

@ -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 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(
[
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>],
[
#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_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 = "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>
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
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 **********************************************************************
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(
[
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;
#include <netdb.h>],[
char * address;
int length;
int type;
struct hostent h;
char buffer[10];
int buflen;
int h_errnop;
struct hostent * hp;
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
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;
fi
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 \

View File

@ -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

View File

@ -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"

View File

@ -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"
{
yyRelYear += yyvsp[-1].Number * yyvsp[0].Number;
;
break;}
case 31:
#line 373 "getdate.y"
{
yyRelYear += yyvsp[-1].Number * yyvsp[0].Number;
;
break;}
case 32:
case 31:
#line 376 "getdate.y"
{
yyRelYear += yyvsp[-1].Number * yyvsp[0].Number;
;
break;}
case 32:
#line 379 "getdate.y"
{
yyRelYear += yyvsp[0].Number;
;
break;}
case 33:
#line 379 "getdate.y"
{
yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number;
;
break;}
case 34:
#line 382 "getdate.y"
{
yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number;
;
break;}
case 35:
case 34:
#line 385 "getdate.y"
{
yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number;
;
break;}
case 35:
#line 388 "getdate.y"
{
yyRelMonth += yyvsp[0].Number;
;
break;}
case 36:
#line 388 "getdate.y"
{
yyRelDay += yyvsp[-1].Number * yyvsp[0].Number;
;
break;}
case 37:
#line 391 "getdate.y"
{
yyRelDay += yyvsp[-1].Number * yyvsp[0].Number;
;
break;}
case 38:
case 37:
#line 394 "getdate.y"
{
yyRelDay += yyvsp[-1].Number * yyvsp[0].Number;
;
break;}
case 38:
#line 397 "getdate.y"
{
yyRelDay += yyvsp[0].Number;
;
break;}
case 39:
#line 397 "getdate.y"
{
yyRelHour += yyvsp[-1].Number * yyvsp[0].Number;
;
break;}
case 40:
#line 400 "getdate.y"
{
yyRelHour += yyvsp[-1].Number * yyvsp[0].Number;
;
break;}
case 41:
case 40:
#line 403 "getdate.y"
{
yyRelHour += yyvsp[-1].Number * yyvsp[0].Number;
;
break;}
case 41:
#line 406 "getdate.y"
{
yyRelHour += yyvsp[0].Number;
;
break;}
case 42:
#line 406 "getdate.y"
{
yyRelMinutes += yyvsp[-1].Number * yyvsp[0].Number;
;
break;}
case 43:
#line 409 "getdate.y"
{
yyRelMinutes += yyvsp[-1].Number * yyvsp[0].Number;
;
break;}
case 44:
case 43:
#line 412 "getdate.y"
{
yyRelMinutes += yyvsp[-1].Number * yyvsp[0].Number;
;
break;}
case 44:
#line 415 "getdate.y"
{
yyRelMinutes += yyvsp[0].Number;
;
break;}
case 45:
#line 415 "getdate.y"
{
yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number;
;
break;}
case 46:
#line 418 "getdate.y"
{
yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number;
;
break;}
case 47:
case 46:
#line 421 "getdate.y"
{
yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number;
;
break;}
case 47:
#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

View File

@ -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);

View File

@ -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

View File

@ -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