1
0
mirror of https://github.com/moparisthebest/curl synced 2024-12-22 08:08:50 -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, \ AC_DEFINE(DISABLED_THREADSAFE, 1, \
Set to explicitly specify we don't want to use thread-safe functions) Set to explicitly specify we don't want to use thread-safe functions)
else else
dnl check for number of arguments to gethostbyname_r. it might take
dnl check for a few thread-safe functions dnl either 3, 5, or 6 arguments.
AC_CHECK_FUNCS(gethostbyname_r,[
AC_CHECK_FUNCS( gethostbyname_r \ AC_MSG_CHECKING(if gethostbyname_r takes 3 arguments)
gethostbyaddr_r \ AC_TRY_RUN([
localtime_r \ #include <string.h>
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(
[
#include <sys/types.h> #include <sys/types.h>
#include <netdb.h>], #include <netdb.h>
[
int
main () {
struct hostent h; struct hostent h;
struct hostent_data hdata; struct hostent_data hdata;
char *name; char *name = "localhost";
int rc; int rc;
rc = gethostbyname_r(name, &h, &hdata);], memset(&h, 0, sizeof(struct hostent));
ac_cv_gethostbyname_args=3) memset(&hdata, 0, sizeof(struct hostent_data));
fi rc = gethostbyname_r(name, &h, &hdata);
if test -z "$ac_cv_gethostbyname_args"; then exit (rc != 0 ? 1 : 0); }],[
AC_TRY_COMPILE( 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 <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 *hp;
struct hostent h; struct hostent h;
char *name; char *name = "localhost";
char buffer[10]; char buffer[8192];
int h_errno; int h_errno;
hp = gethostbyname_r(name, &h, buffer, 10, &h_errno);], hp = gethostbyname_r(name, &h, buffer, 8192, &h_errno);
ac_cv_gethostbyname_args=5) exit (hp == NULL ? 1 : 0); }],[
fi AC_MSG_RESULT(yes)
if test -z "$ac_cv_gethostbyname_args"; then AC_DEFINE(HAVE_GETHOSTBYNAME_R_5)
AC_TRY_COMPILE( 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 <sys/types.h>
#include <netdb.h>], #include <netdb.h>
[
int
main () {
struct hostent h; struct hostent h;
struct hostent *hp; struct hostent *hp;
char *name; char *name = "localhost";
char buf[10]; char buf[10];
int rc; int rc;
int h_errno; int h_errno;
rc = gethostbyname_r(name, &h, buf, 10, &hp, &h_errno); rc = gethostbyname_r(name, &h, buf, 10, &hp, &h_errno);
], exit (rc != 0 ? 1 : 0); }],[
ac_cv_gethostbyname_args=6) AC_MSG_RESULT(yes)
fi AC_DEFINE(HAVE_GETHOSTBYNAME_R_6)
if test -z "$ac_cv_gethostbyname_args"; then ac_cv_gethostbyname_args=6],[
AC_MSG_RESULT(no) AC_MSG_RESULT(no)
have_missing_r_funcs="$have_missing_r_funcs gethostbyname_r" 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 check for number of arguments to gethostbyaddr_r. it might take
dnl Time to make a check for gethostbyaddr_r dnl either 5, 7, or 8 arguments.
dnl If it exists, it may use one of three different interfaces AC_CHECK_FUNCS(gethostbyaddr_r,[
dnl ********************************************************************** AC_MSG_CHECKING(if gethostbyaddr_r takes 5 arguments)
AC_MSG_CHECKING(for gethostbyaddr_r) AC_TRY_COMPILE([
if test -z "$ac_cv_gethostbyaddr_args"; then
AC_TRY_COMPILE(
[
#include <sys/types.h> #include <sys/types.h>
#include <netdb.h>], #include <netdb.h>],[
[ char * address;
char * address; int length;
int length; int type;
int type; struct hostent h;
struct hostent h; struct hostent_data hdata;
struct hostent_data hdata; int rc;
int rc; rc = gethostbyaddr_r(address, length, type, &h, &hdata);],[
rc = gethostbyaddr_r(address, length, type, &h, &hdata); AC_MSG_RESULT(yes)
], AC_DEFINE(HAVE_GETHOSTBYADDR_R_5)
ac_cv_gethostbyaddr_args=5) ac_cv_gethostbyaddr_args=5],[
AC_MSG_RESULT(no)
fi AC_MSG_CHECKING(if gethostbyaddr_r with -D_REENTRANT takes 5 arguments)
if test -z "$ac_cv_gethostbyaddr_args"; then AC_TRY_COMPILE([
AC_TRY_COMPILE( #define _REENTRANT
[
#include <sys/types.h> #include <sys/types.h>
#include <netdb.h>], #include <netdb.h>],[
[ char * address;
char * address; int length;
int length; int type;
int type; struct hostent h;
struct hostent h; struct hostent_data hdata;
char buffer[10]; int rc;
int buflen; rc = gethostbyaddr_r(address, length, type, &h, &hdata);],[
int h_errnop; AC_MSG_RESULT(yes)
struct hostent * hp; AC_DEFINE(HAVE_GETHOSTBYADDR_R_5)
AC_DEFINE(NEED_REENTRANT)
hp = gethostbyaddr_r(address, length, type, &h, ac_cv_gethostbyaddr_args=5],[
buffer, buflen, &h_errnop); AC_MSG_RESULT(no)
], AC_MSG_CHECKING(if gethostbyaddr_r takes 7 arguments)
ac_cv_gethostbyaddr_args=7) AC_TRY_COMPILE([
fi
if test -z "$ac_cv_gethostbyaddr_args"; then
AC_TRY_COMPILE(
[
#include <sys/types.h> #include <sys/types.h>
#include <netdb.h>], #include <netdb.h>],[
[ char * address;
char * address; int length;
int length; int type;
int type; struct hostent h;
struct hostent h; char buffer[10];
char buffer[10]; int buflen;
int buflen; int h_errnop;
int h_errnop; struct hostent * hp;
struct hostent * hp;
int rc;
rc = gethostbyaddr_r(address, length, type, &h, hp = gethostbyaddr_r(address, length, type, &h,
buffer, buflen, &hp, &h_errnop); buffer, buflen, &h_errnop);],[
], AC_MSG_RESULT(yes)
ac_cv_gethostbyaddr_args=8) AC_DEFINE(HAVE_GETHOSTBYADDR_R_7)
fi ac_cv_gethostbyaddr_args=7],[
if test -z "$ac_cv_gethostbyaddr_args"; then AC_MSG_RESULT(no)
AC_MSG_RESULT(no) AC_MSG_CHECKING(if gethostbyaddr_r takes 8 arguments)
have_missing_r_funcs="$have_missing_r_funcs gethostbyaddr_r" AC_TRY_COMPILE([
else #include <sys/types.h>
if test "$ac_cv_gethostbyaddr_args" = 5; then #include <netdb.h>],[
AC_DEFINE(HAVE_GETHOSTBYADDR_R_5) char * address;
elif test "$ac_cv_gethostbyaddr_args" = 7; then int length;
AC_DEFINE(HAVE_GETHOSTBYADDR_R_7) int type;
elif test "$ac_cv_gethostbyaddr_args" = 8; then struct hostent h;
AC_DEFINE(HAVE_GETHOSTBYADDR_R_8) char buffer[10];
fi int buflen;
AC_MSG_RESULT([yes, and it takes $ac_cv_gethostbyaddr_args arguments]) int h_errnop;
fi 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 fi
dnl ********************************************************************** dnl **********************************************************************
dnl Back to "normal" configuring dnl Back to "normal" configuring
dnl ********************************************************************** dnl **********************************************************************
@ -332,6 +368,7 @@ AC_CHECK_HEADERS( \
arpa/inet.h \ arpa/inet.h \
net/if.h \ net/if.h \
netinet/in.h \ netinet/in.h \
netinet/if_ether.h \
netdb.h \ netdb.h \
sys/select.h \ sys/select.h \
sys/socket.h \ sys/socket.h \

View File

@ -60,13 +60,17 @@
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> #include <sys/socket.h>
#endif #endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h> #include <netinet/in.h>
#endif
#include <sys/time.h> #include <sys/time.h>
#include <sys/resource.h> #include <sys/resource.h>
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifdef HAVE_NETDB_H
#include <netdb.h> #include <netdb.h>
#endif
#ifdef HAVE_ARPA_INET_H #ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h> #include <arpa/inet.h>
#endif #endif

View File

@ -60,22 +60,22 @@
#include <sys/socket.h> #include <sys/socket.h>
#endif #endif
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h> #include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H #ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h> #include <arpa/inet.h>
#endif #endif
#include <sys/utsname.h> #include <sys/utsname.h>
#ifdef HAVE_NETDB_H
#include <netdb.h> #include <netdb.h>
#endif #endif
#endif
#if defined(WIN32) && defined(__GNUC__) || defined(__MINGW32__) #if defined(WIN32) && defined(__GNUC__) || defined(__MINGW32__)
#include <errno.h> #include <errno.h>
#endif #endif
#ifdef HAVE_INET_NTOA_R
#include "inet_ntoa_r.h"
#endif
#include <curl/curl.h> #include <curl/curl.h>
#include "urldata.h" #include "urldata.h"
#include "sendf.h" #include "sendf.h"

View File

@ -32,15 +32,18 @@
** This code is in the public domain and has no copyright. ** 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 #ifdef HAVE_CONFIG_H
# include "config.h" # include "config.h"
# ifdef HAVE_ALLOCA_H # ifdef HAVE_ALLOCA_H
# include <alloca.h> # include <alloca.h>
# endif # 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 # ifdef HAVE_TIME_H
# include <time.h> # include <time.h>
# endif # endif
@ -219,7 +222,7 @@ static int yyRelSeconds;
static int yyRelYear; static int yyRelYear;
#line 202 "getdate.y" #line 205 "getdate.y"
typedef union { typedef union {
int Number; int Number;
enum _MERIDIAN Meridian; enum _MERIDIAN Meridian;
@ -302,11 +305,11 @@ static const short yyrhs[] = { -1,
#if YYDEBUG != 0 #if YYDEBUG != 0
static const short yyrline[] = { 0, static const short yyrline[] = { 0,
218, 219, 222, 225, 228, 231, 234, 237, 240, 246, 221, 222, 225, 228, 231, 234, 237, 240, 243, 249,
252, 261, 267, 279, 282, 285, 291, 295, 299, 305, 255, 264, 270, 282, 285, 288, 294, 298, 302, 308,
309, 327, 333, 339, 343, 348, 352, 359, 367, 370, 312, 330, 336, 342, 346, 351, 355, 362, 370, 373,
373, 376, 379, 382, 385, 388, 391, 394, 397, 400, 376, 379, 382, 385, 388, 391, 394, 397, 400, 403,
403, 406, 409, 412, 415, 418, 421, 426, 459, 463 406, 409, 412, 415, 418, 421, 424, 429, 462, 466
}; };
#endif #endif
@ -387,7 +390,7 @@ static const short yycheck[] = { 0,
56 56
}; };
/* -*-C-*- Note some compilers choke on comments on `#line' lines. */ /* -*-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. */ /* This file comes from bison-1.28. */
/* Skeleton output parser for bison, /* Skeleton output parser for bison,
@ -601,7 +604,7 @@ __yy_memcpy (char *to, char *from, unsigned int count)
#endif #endif
#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 /* The user can define YYPARSE_PARAM as the name of an argument to be passed
into yyparse. The argument should have type void *. into yyparse. The argument should have type void *.
@ -930,37 +933,37 @@ yyreduce:
switch (yyn) { switch (yyn) {
case 3: case 3:
#line 222 "getdate.y" #line 225 "getdate.y"
{ {
yyHaveTime++; yyHaveTime++;
; ;
break;} break;}
case 4: case 4:
#line 225 "getdate.y" #line 228 "getdate.y"
{ {
yyHaveZone++; yyHaveZone++;
; ;
break;} break;}
case 5: case 5:
#line 228 "getdate.y" #line 231 "getdate.y"
{ {
yyHaveDate++; yyHaveDate++;
; ;
break;} break;}
case 6: case 6:
#line 231 "getdate.y" #line 234 "getdate.y"
{ {
yyHaveDay++; yyHaveDay++;
; ;
break;} break;}
case 7: case 7:
#line 234 "getdate.y" #line 237 "getdate.y"
{ {
yyHaveRel++; yyHaveRel++;
; ;
break;} break;}
case 9: case 9:
#line 240 "getdate.y" #line 243 "getdate.y"
{ {
yyHour = yyvsp[-1].Number; yyHour = yyvsp[-1].Number;
yyMinutes = 0; yyMinutes = 0;
@ -969,7 +972,7 @@ case 9:
; ;
break;} break;}
case 10: case 10:
#line 246 "getdate.y" #line 249 "getdate.y"
{ {
yyHour = yyvsp[-3].Number; yyHour = yyvsp[-3].Number;
yyMinutes = yyvsp[-1].Number; yyMinutes = yyvsp[-1].Number;
@ -978,7 +981,7 @@ case 10:
; ;
break;} break;}
case 11: case 11:
#line 252 "getdate.y" #line 255 "getdate.y"
{ {
yyHour = yyvsp[-3].Number; yyHour = yyvsp[-3].Number;
yyMinutes = yyvsp[-1].Number; yyMinutes = yyvsp[-1].Number;
@ -990,7 +993,7 @@ case 11:
; ;
break;} break;}
case 12: case 12:
#line 261 "getdate.y" #line 264 "getdate.y"
{ {
yyHour = yyvsp[-5].Number; yyHour = yyvsp[-5].Number;
yyMinutes = yyvsp[-3].Number; yyMinutes = yyvsp[-3].Number;
@ -999,7 +1002,7 @@ case 12:
; ;
break;} break;}
case 13: case 13:
#line 267 "getdate.y" #line 270 "getdate.y"
{ {
yyHour = yyvsp[-5].Number; yyHour = yyvsp[-5].Number;
yyMinutes = yyvsp[-3].Number; yyMinutes = yyvsp[-3].Number;
@ -1012,53 +1015,53 @@ case 13:
; ;
break;} break;}
case 14: case 14:
#line 279 "getdate.y" #line 282 "getdate.y"
{ {
yyTimezone = yyvsp[0].Number; yyTimezone = yyvsp[0].Number;
; ;
break;} break;}
case 15: case 15:
#line 282 "getdate.y" #line 285 "getdate.y"
{ {
yyTimezone = yyvsp[0].Number - 60; yyTimezone = yyvsp[0].Number - 60;
; ;
break;} break;}
case 16: case 16:
#line 286 "getdate.y" #line 289 "getdate.y"
{ {
yyTimezone = yyvsp[-1].Number - 60; yyTimezone = yyvsp[-1].Number - 60;
; ;
break;} break;}
case 17: case 17:
#line 291 "getdate.y" #line 294 "getdate.y"
{ {
yyDayOrdinal = 1; yyDayOrdinal = 1;
yyDayNumber = yyvsp[0].Number; yyDayNumber = yyvsp[0].Number;
; ;
break;} break;}
case 18: case 18:
#line 295 "getdate.y" #line 298 "getdate.y"
{ {
yyDayOrdinal = 1; yyDayOrdinal = 1;
yyDayNumber = yyvsp[-1].Number; yyDayNumber = yyvsp[-1].Number;
; ;
break;} break;}
case 19: case 19:
#line 299 "getdate.y" #line 302 "getdate.y"
{ {
yyDayOrdinal = yyvsp[-1].Number; yyDayOrdinal = yyvsp[-1].Number;
yyDayNumber = yyvsp[0].Number; yyDayNumber = yyvsp[0].Number;
; ;
break;} break;}
case 20: case 20:
#line 305 "getdate.y" #line 308 "getdate.y"
{ {
yyMonth = yyvsp[-2].Number; yyMonth = yyvsp[-2].Number;
yyDay = yyvsp[0].Number; yyDay = yyvsp[0].Number;
; ;
break;} break;}
case 21: case 21:
#line 309 "getdate.y" #line 312 "getdate.y"
{ {
/* Interpret as YYYY/MM/DD if $1 >= 1000, otherwise as MM/DD/YY. /* 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 The goal in recognizing YYYY/MM/DD is solely to support legacy
@ -1079,7 +1082,7 @@ case 21:
; ;
break;} break;}
case 22: case 22:
#line 327 "getdate.y" #line 330 "getdate.y"
{ {
/* ISO 8601 format. yyyy-mm-dd. */ /* ISO 8601 format. yyyy-mm-dd. */
yyYear = yyvsp[-2].Number; yyYear = yyvsp[-2].Number;
@ -1088,7 +1091,7 @@ case 22:
; ;
break;} break;}
case 23: case 23:
#line 333 "getdate.y" #line 336 "getdate.y"
{ {
/* e.g. 17-JUN-1992. */ /* e.g. 17-JUN-1992. */
yyDay = yyvsp[-2].Number; yyDay = yyvsp[-2].Number;
@ -1097,14 +1100,14 @@ case 23:
; ;
break;} break;}
case 24: case 24:
#line 339 "getdate.y" #line 342 "getdate.y"
{ {
yyMonth = yyvsp[-1].Number; yyMonth = yyvsp[-1].Number;
yyDay = yyvsp[0].Number; yyDay = yyvsp[0].Number;
; ;
break;} break;}
case 25: case 25:
#line 343 "getdate.y" #line 346 "getdate.y"
{ {
yyMonth = yyvsp[-3].Number; yyMonth = yyvsp[-3].Number;
yyDay = yyvsp[-2].Number; yyDay = yyvsp[-2].Number;
@ -1112,14 +1115,14 @@ case 25:
; ;
break;} break;}
case 26: case 26:
#line 348 "getdate.y" #line 351 "getdate.y"
{ {
yyMonth = yyvsp[0].Number; yyMonth = yyvsp[0].Number;
yyDay = yyvsp[-1].Number; yyDay = yyvsp[-1].Number;
; ;
break;} break;}
case 27: case 27:
#line 352 "getdate.y" #line 355 "getdate.y"
{ {
yyMonth = yyvsp[-1].Number; yyMonth = yyvsp[-1].Number;
yyDay = yyvsp[-2].Number; yyDay = yyvsp[-2].Number;
@ -1127,7 +1130,7 @@ case 27:
; ;
break;} break;}
case 28: case 28:
#line 359 "getdate.y" #line 362 "getdate.y"
{ {
yyRelSeconds = -yyRelSeconds; yyRelSeconds = -yyRelSeconds;
yyRelMinutes = -yyRelMinutes; yyRelMinutes = -yyRelMinutes;
@ -1138,115 +1141,115 @@ case 28:
; ;
break;} break;}
case 30: case 30:
#line 370 "getdate.y"
{
yyRelYear += yyvsp[-1].Number * yyvsp[0].Number;
;
break;}
case 31:
#line 373 "getdate.y" #line 373 "getdate.y"
{ {
yyRelYear += yyvsp[-1].Number * yyvsp[0].Number; yyRelYear += yyvsp[-1].Number * yyvsp[0].Number;
; ;
break;} break;}
case 32: case 31:
#line 376 "getdate.y" #line 376 "getdate.y"
{
yyRelYear += yyvsp[-1].Number * yyvsp[0].Number;
;
break;}
case 32:
#line 379 "getdate.y"
{ {
yyRelYear += yyvsp[0].Number; yyRelYear += yyvsp[0].Number;
; ;
break;} break;}
case 33: case 33:
#line 379 "getdate.y"
{
yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number;
;
break;}
case 34:
#line 382 "getdate.y" #line 382 "getdate.y"
{ {
yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number; yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number;
; ;
break;} break;}
case 35: case 34:
#line 385 "getdate.y" #line 385 "getdate.y"
{
yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number;
;
break;}
case 35:
#line 388 "getdate.y"
{ {
yyRelMonth += yyvsp[0].Number; yyRelMonth += yyvsp[0].Number;
; ;
break;} break;}
case 36: case 36:
#line 388 "getdate.y"
{
yyRelDay += yyvsp[-1].Number * yyvsp[0].Number;
;
break;}
case 37:
#line 391 "getdate.y" #line 391 "getdate.y"
{ {
yyRelDay += yyvsp[-1].Number * yyvsp[0].Number; yyRelDay += yyvsp[-1].Number * yyvsp[0].Number;
; ;
break;} break;}
case 38: case 37:
#line 394 "getdate.y" #line 394 "getdate.y"
{
yyRelDay += yyvsp[-1].Number * yyvsp[0].Number;
;
break;}
case 38:
#line 397 "getdate.y"
{ {
yyRelDay += yyvsp[0].Number; yyRelDay += yyvsp[0].Number;
; ;
break;} break;}
case 39: case 39:
#line 397 "getdate.y"
{
yyRelHour += yyvsp[-1].Number * yyvsp[0].Number;
;
break;}
case 40:
#line 400 "getdate.y" #line 400 "getdate.y"
{ {
yyRelHour += yyvsp[-1].Number * yyvsp[0].Number; yyRelHour += yyvsp[-1].Number * yyvsp[0].Number;
; ;
break;} break;}
case 41: case 40:
#line 403 "getdate.y" #line 403 "getdate.y"
{
yyRelHour += yyvsp[-1].Number * yyvsp[0].Number;
;
break;}
case 41:
#line 406 "getdate.y"
{ {
yyRelHour += yyvsp[0].Number; yyRelHour += yyvsp[0].Number;
; ;
break;} break;}
case 42: case 42:
#line 406 "getdate.y"
{
yyRelMinutes += yyvsp[-1].Number * yyvsp[0].Number;
;
break;}
case 43:
#line 409 "getdate.y" #line 409 "getdate.y"
{ {
yyRelMinutes += yyvsp[-1].Number * yyvsp[0].Number; yyRelMinutes += yyvsp[-1].Number * yyvsp[0].Number;
; ;
break;} break;}
case 44: case 43:
#line 412 "getdate.y" #line 412 "getdate.y"
{
yyRelMinutes += yyvsp[-1].Number * yyvsp[0].Number;
;
break;}
case 44:
#line 415 "getdate.y"
{ {
yyRelMinutes += yyvsp[0].Number; yyRelMinutes += yyvsp[0].Number;
; ;
break;} break;}
case 45: case 45:
#line 415 "getdate.y"
{
yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number;
;
break;}
case 46:
#line 418 "getdate.y" #line 418 "getdate.y"
{ {
yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number; yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number;
; ;
break;} break;}
case 47: case 46:
#line 421 "getdate.y" #line 421 "getdate.y"
{
yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number;
;
break;}
case 47:
#line 424 "getdate.y"
{ {
yyRelSeconds += yyvsp[0].Number; yyRelSeconds += yyvsp[0].Number;
; ;
break;} break;}
case 48: case 48:
#line 427 "getdate.y" #line 430 "getdate.y"
{ {
if (yyHaveTime && yyHaveDate && !yyHaveRel) if (yyHaveTime && yyHaveDate && !yyHaveRel)
yyYear = yyvsp[0].Number; yyYear = yyvsp[0].Number;
@ -1279,20 +1282,20 @@ case 48:
; ;
break;} break;}
case 49: case 49:
#line 460 "getdate.y" #line 463 "getdate.y"
{ {
yyval.Meridian = MER24; yyval.Meridian = MER24;
; ;
break;} break;}
case 50: case 50:
#line 464 "getdate.y" #line 467 "getdate.y"
{ {
yyval.Meridian = yyvsp[0].Meridian; yyval.Meridian = yyvsp[0].Meridian;
; ;
break;} break;}
} }
/* the action file gets copied in in place of this dollarsign */ /* 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; yyvsp -= yylen;
yyssp -= yylen; yyssp -= yylen;
@ -1512,7 +1515,7 @@ yyerrhandle:
} }
return 1; return 1;
} }
#line 469 "getdate.y" #line 472 "getdate.y"
/* Include this file down here because bison inserts code above which /* Include this file down here because bison inserts code above which

View File

@ -40,9 +40,12 @@
#include <string.h> #include <string.h>
#include <malloc.h> #include <malloc.h>
#include <errno.h>
#include "setup.h" #include "setup.h"
#define _REENTRANT
#if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__) #if defined(WIN32) && !defined(__GNUC__) || defined(__MINGW32__)
#include <winsock.h> #include <winsock.h>
#else #else
@ -52,8 +55,12 @@
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> #include <sys/socket.h>
#endif #endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h> #include <netinet/in.h>
#endif
#ifdef HAVE_NETDB_H
#include <netdb.h> #include <netdb.h>
#endif
#ifdef HAVE_ARPA_INET_H #ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h> #include <arpa/inet.h>
#endif #endif
@ -62,9 +69,7 @@
#include "urldata.h" #include "urldata.h"
#include "sendf.h" #include "sendf.h"
#define _REENTRANT #ifndef HAVE_INET_NTOA_R_DECL
#ifdef HAVE_INET_NTOA_R
#include "inet_ntoa_r.h" #include "inet_ntoa_r.h"
#endif #endif
@ -103,6 +108,7 @@ struct hostent *GetHost(struct UrlData *data,
{ {
struct hostent *h = NULL; struct hostent *h = NULL;
unsigned long in; unsigned long in;
int ret;
if ( (in=inet_addr(hostname)) != INADDR_NONE ) { if ( (in=inet_addr(hostname)) != INADDR_NONE ) {
struct in_addr *addrentry; 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 /* 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 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 *)buf,
(struct hostent_data *)(buf + sizeof(struct hostent))); (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 */ h_errnop= errno; /* we don't deal with this, but set it anyway */
if(NULL == h) if(ret)
#endif #endif
{ {
infof(data, "gethostbyname_r(2) failed for %s\n", hostname); 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 #define _REENTRANT /* Necessary to use in Solaris, since the silly guys at Sun
made the localtime_r() prototype dependent on it (or made the localtime_r() prototype dependent on it (or
_POSIX_C_SOURCE or _POSIX_PTHREAD_SEMANTICS). */ _POSIX_C_SOURCE or _POSIX_PTHREAD_SEMANTICS). */
#endif
/* -- WIN32 approved -- */ /* -- WIN32 approved -- */
#include <stdio.h> #include <stdio.h>
@ -63,7 +65,9 @@
#ifdef HAVE_SYS_SOCKET_H #ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> #include <sys/socket.h>
#endif #endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h> #include <netinet/in.h>
#endif
#include <sys/time.h> #include <sys/time.h>
#ifdef HAVE_TIME_H #ifdef HAVE_TIME_H

View File

@ -50,12 +50,19 @@
#if ! defined(WIN32) && ! defined(__BEOS__) #if ! defined(WIN32) && ! defined(__BEOS__)
#ifdef NEED_REENTRANT
#define _REENTRANT
#endif
#ifdef HAVE_SYS_SOCKET_H
#include <sys/socket.h> #include <sys/socket.h>
#endif
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h> #include <netinet/in.h>
#endif
#ifdef HAVE_ARPA_INET_H #ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h> #include <arpa/inet.h>
#endif #endif
#include <netinet/in.h>
#ifdef HAVE_SYS_TIME_H #ifdef HAVE_SYS_TIME_H
/* This must be before net/if.h for AIX 3.2 to enjoy life */ /* This must be before net/if.h for AIX 3.2 to enjoy life */
@ -75,7 +82,7 @@
#include <sys/sockio.h> #include <sys/sockio.h>
#endif #endif
#ifdef HAVE_INET_NTOA_R #ifndef HAVE_INET_NTOA_R_DECL
#include "inet_ntoa_r.h" #include "inet_ntoa_r.h"
#endif #endif