Commit 3da753a3f7023389c492e8ad1ce61ced613db3a3
1 parent
c29be795
Exists in
master
and in
2 other branches
Fixing windows build.
Showing
4 changed files
with
36 additions
and
25 deletions
Show diff stats
configure.ac
@@ -539,6 +539,7 @@ AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG,,[do we have syslog.h?])) | @@ -539,6 +539,7 @@ AC_CHECK_HEADER(syslog.h, AC_DEFINE(HAVE_SYSLOG,,[do we have syslog.h?])) | ||
539 | AC_CHECK_FUNCS(getaddrinfo, AC_DEFINE(HAVE_GETADDRINFO) ) | 539 | AC_CHECK_FUNCS(getaddrinfo, AC_DEFINE(HAVE_GETADDRINFO) ) |
540 | AC_CHECK_FUNC(vasprintf, AC_DEFINE(HAVE_VASPRINTF) ) | 540 | AC_CHECK_FUNC(vasprintf, AC_DEFINE(HAVE_VASPRINTF) ) |
541 | AC_CHECK_FUNC(strtok_r, AC_DEFINE(HAVE_STRTOK_R) ) | 541 | AC_CHECK_FUNC(strtok_r, AC_DEFINE(HAVE_STRTOK_R) ) |
542 | +AC_CHECK_FUNC(localtime_r, AC_DEFINE(HAVE_LOCALTIME_R) ) | ||
542 | 543 | ||
543 | AC_ARG_WITH([inet-ntop], [AS_HELP_STRING([--with-inet-ntop], [Assume that inet_nto() is available])], [ app_cv_inet_ntop="$withval" ],[ app_cv_inet_ntop="auto" ]) | 544 | AC_ARG_WITH([inet-ntop], [AS_HELP_STRING([--with-inet-ntop], [Assume that inet_nto() is available])], [ app_cv_inet_ntop="$withval" ],[ app_cv_inet_ntop="auto" ]) |
544 | 545 |
src/core/rpq.c
@@ -273,9 +273,7 @@ void do_qr_rpqnames(H3270 *hSession) | @@ -273,9 +273,7 @@ void do_qr_rpqnames(H3270 *hSession) | ||
273 | rpq_dump_warnings(hSession); | 273 | rpq_dump_warnings(hSession); |
274 | } | 274 | } |
275 | 275 | ||
276 | -/** | ||
277 | - * @brief Utility function used by the RPQNAMES query reply. | ||
278 | - */ | 276 | +/// @brief Utility function used by the RPQNAMES query reply. |
279 | static Boolean select_rpq_terms(H3270 *hSession) | 277 | static Boolean select_rpq_terms(H3270 *hSession) |
280 | { | 278 | { |
281 | int i,j,k,len; | 279 | int i,j,k,len; |
@@ -438,6 +436,8 @@ static int get_rpq_timezone(H3270 *hSession) | @@ -438,6 +436,8 @@ static int get_rpq_timezone(H3270 *hSession) | ||
438 | } | 436 | } |
439 | 437 | ||
440 | 438 | ||
439 | +#ifdef HAVE_LOCALTIME_R | ||
440 | + | ||
441 | localtime_r(&here,&here_tm); | 441 | localtime_r(&here,&here_tm); |
442 | 442 | ||
443 | if(gmtime_r(&here,&utc_tm) == NULL) | 443 | if(gmtime_r(&here,&utc_tm) == NULL) |
@@ -446,23 +446,27 @@ static int get_rpq_timezone(H3270 *hSession) | @@ -446,23 +446,27 @@ static int get_rpq_timezone(H3270 *hSession) | ||
446 | return 2; | 446 | return 2; |
447 | } | 447 | } |
448 | 448 | ||
449 | - /* | 449 | +#else |
450 | + | ||
450 | memcpy(&here_tm, localtime(&here), sizeof(struct tm)); | 451 | memcpy(&here_tm, localtime(&here), sizeof(struct tm)); |
452 | + struct tm * _tm = gmtime(&here); | ||
451 | 453 | ||
452 | - if ((utc_tm = gmtime(&here)) == NULL) | 454 | + if(_tm == NULL) |
453 | { | 455 | { |
454 | rpq_warning(hSession, _("RPQ: Unable to determine workstation UTC time")); | 456 | rpq_warning(hSession, _("RPQ: Unable to determine workstation UTC time")); |
455 | return 2; | 457 | return 2; |
456 | } | 458 | } |
457 | - */ | ||
458 | 459 | ||
459 | - /* | ||
460 | - * Do not take Daylight Saving Time into account. | ||
461 | - * We just want the "raw" time difference. | ||
462 | - */ | 460 | + memcpy(&utc_tm,_tm,sizeof(struct tm)); |
461 | + | ||
462 | +#endif // HAVE_LOCALTIME_R | ||
463 | + | ||
464 | + // Do not take Daylight Saving Time into account. | ||
465 | + // We just want the "raw" time difference. | ||
463 | here_tm.tm_isdst = 0; | 466 | here_tm.tm_isdst = 0; |
464 | utc_tm.tm_isdst = 0; | 467 | utc_tm.tm_isdst = 0; |
465 | delta = difftime(mktime(&here_tm), mktime(&utc_tm)) / 60L; | 468 | delta = difftime(mktime(&here_tm), mktime(&utc_tm)) / 60L; |
469 | + | ||
466 | } | 470 | } |
467 | 471 | ||
468 | // sanity check: difference cannot exceed +/- 12 hours | 472 | // sanity check: difference cannot exceed +/- 12 hours |
@@ -480,20 +484,20 @@ static int get_rpq_timezone(H3270 *hSession) | @@ -480,20 +484,20 @@ static int get_rpq_timezone(H3270 *hSession) | ||
480 | */ | 484 | */ |
481 | static int get_rpq_user(H3270 *hSession, unsigned char buf[], const int buflen) | 485 | static int get_rpq_user(H3270 *hSession, unsigned char buf[], const int buflen) |
482 | { | 486 | { |
483 | - /* | ||
484 | - * Text may be specified in one of two ways, but not both. | ||
485 | - * An environment variable provides the user interface: | ||
486 | - * - X3270RPQ: Keyword USER= | ||
487 | - * | ||
488 | - * NOTE: If the string begins with 0x then no ASCII/EBCDIC | ||
489 | - * translation is done. The hex characters will be sent as true hex | ||
490 | - * data. E.g., X3270RPQ="user=0x ab 12 EF" will result in 3 bytes | ||
491 | - * sent as 0xAB12EF. White space is optional in hex data format. | ||
492 | - * When hex format is required, the 0x prefix must be the first two | ||
493 | - * characters of the string. E.g., X3270RPQ="user= 0X AB" will | ||
494 | - * result in 6 bytes sent as 0x40F0E740C1C2 because the text is | ||
495 | - * accepted "as is" then translated from ASCII to EBCDIC. | ||
496 | - */ | 487 | + // |
488 | + // Text may be specified in one of two ways, but not both. | ||
489 | + // An environment variable provides the user interface: | ||
490 | + // - X3270RPQ: Keyword USER= | ||
491 | + // | ||
492 | + // NOTE: If the string begins with 0x then no ASCII/EBCDIC | ||
493 | + // translation is done. The hex characters will be sent as true hex | ||
494 | + // data. E.g., X3270RPQ="user=0x ab 12 EF" will result in 3 bytes | ||
495 | + // sent as 0xAB12EF. White space is optional in hex data format. | ||
496 | + // When hex format is required, the 0x prefix must be the first two | ||
497 | + // characters of the string. E.g., X3270RPQ="user= 0X AB" will | ||
498 | + // result in 6 bytes sent as 0x40F0E740C1C2 because the text is | ||
499 | + // accepted "as is" then translated from ASCII to EBCDIC. | ||
500 | + // | ||
497 | const char *rpqtext = CN; | 501 | const char *rpqtext = CN; |
498 | int x; | 502 | int x; |
499 | struct rpq_keyword *kw; | 503 | struct rpq_keyword *kw; |
src/core/telnet.c
@@ -2154,9 +2154,14 @@ void trace_netdata(H3270 *hSession, char direction, unsigned const char *buf, in | @@ -2154,9 +2154,14 @@ void trace_netdata(H3270 *hSession, char direction, unsigned const char *buf, in | ||
2154 | 2154 | ||
2155 | { | 2155 | { |
2156 | time_t ltime; | 2156 | time_t ltime; |
2157 | - struct tm tm; | ||
2158 | time(<ime); | 2157 | time(<ime); |
2158 | + | ||
2159 | +#ifdef HAVE_LOCALTIME_R | ||
2160 | + struct tm tm; | ||
2159 | strftime(l1, 81, "%x %X", localtime_r(<ime,&tm)); | 2161 | strftime(l1, 81, "%x %X", localtime_r(<ime,&tm)); |
2162 | +#else | ||
2163 | + strftime(l1, 81, "%x %X", localtime(<ime)); | ||
2164 | +#endif // HAVE_LOCALTIME_R | ||
2160 | } | 2165 | } |
2161 | 2166 | ||
2162 | lib3270_write_nettrace(hSession,"%c %s %s data len=%d\n\n",direction,l1,direction == '>' ? "SEND" : "RECV", len); | 2167 | lib3270_write_nettrace(hSession,"%c %s %s data len=%d\n\n",direction,l1,direction == '>' ? "SEND" : "RECV", len); |
src/include/config.h.in