Commit 7a18fcce1867085d8f8bd0a1a0b562ebf837741c
1 parent
a7e8ae9e
Exists in
master
and in
3 other branches
Iniciando implementacao de suporte iconv na biblioteca
Showing
6 changed files
with
28 additions
and
16 deletions
Show diff stats
Makefile.in
@@ -34,7 +34,7 @@ SSL_CFLAGS=@LIBSSL_CFLAGS@ | @@ -34,7 +34,7 @@ SSL_CFLAGS=@LIBSSL_CFLAGS@ | ||
34 | DLL_FLAGS=@DLL_FLAGS@ | 34 | DLL_FLAGS=@DLL_FLAGS@ |
35 | LDFLAGS=@LDFLAGS@ | 35 | LDFLAGS=@LDFLAGS@ |
36 | 36 | ||
37 | -LIBS=@LIBS@ @LIBSSL_LIBS@ @SOCKET_LIBS@ | 37 | +LIBS=@LIBS@ @LIBSSL_LIBS@ @INTL_LIBS@ @SOCKET_LIBS@ |
38 | 38 | ||
39 | DEBUG_CFLAGS=-DDEBUG=1 -g | 39 | DEBUG_CFLAGS=-DDEBUG=1 -g |
40 | DEPENDS ?= *.h ../../src/include/*.h Makefile | 40 | DEPENDS ?= *.h ../../src/include/*.h Makefile |
appres.h
@@ -232,9 +232,4 @@ typedef struct { | @@ -232,9 +232,4 @@ typedef struct { | ||
232 | 232 | ||
233 | extern AppRes appres; | 233 | extern AppRes appres; |
234 | 234 | ||
235 | -// FIXME (perry#2#): Check for right implementation | ||
236 | -#define _( x ) x | ||
237 | -#define N_( x ) x | ||
238 | -#define MSG_( c, s ) s | ||
239 | - | ||
240 | void toggle_rectselect(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt); | 235 | void toggle_rectselect(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt); |
globals.h
@@ -53,6 +53,21 @@ | @@ -53,6 +53,21 @@ | ||
53 | #endif /*]*/ | 53 | #endif /*]*/ |
54 | 54 | ||
55 | /* | 55 | /* |
56 | + * gettext stuff | ||
57 | + */ | ||
58 | +#ifdef HAVE_LIBINTL | ||
59 | + #include <libintl.h> | ||
60 | + #define _( x ) gettext(x) | ||
61 | + #define N_( x ) x | ||
62 | + #define MSG_( c, s ) gettext(s) | ||
63 | +#else | ||
64 | + #define _( x ) x | ||
65 | + #define N_( x ) x | ||
66 | + #define MSG_( c, s ) s | ||
67 | +#endif // HAVE_LIBINTL | ||
68 | + | ||
69 | + | ||
70 | +/* | ||
56 | * OS-specific #defines. Except for the blocking-connect workarounds, these | 71 | * OS-specific #defines. Except for the blocking-connect workarounds, these |
57 | * should be replaced with autoconf probes as soon as possible. | 72 | * should be replaced with autoconf probes as soon as possible. |
58 | */ | 73 | */ |
resolver.c
@@ -101,9 +101,12 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p) | @@ -101,9 +101,12 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p) | ||
101 | 101 | ||
102 | if (rc) | 102 | if (rc) |
103 | { | 103 | { |
104 | - // FIXME (perry#1#): Correct this: What's wrong with gai_strerror? | ||
105 | - // snprintf(errmsg, em_len, "%s/%s: %s", host, portname, gai_strerror(rc)); | ||
106 | - snprintf(p->errmsg, p->em_len, "%s/%s: %d", p->host, p->portname, rc); | 104 | +#ifdef WIN32 |
105 | + #warning gai_strerror on windows is returning message in local_charset, need to set it to utf-8! | ||
106 | + snprintf(p->errmsg, p->em_len, _( "Error %d resolving %s" ) , rc, p->host); | ||
107 | +#else | ||
108 | + snprintf(p->errmsg, p->em_len, _( "Error resolving %s: %s" ), p->host, gai_strerror(rc)); | ||
109 | +#endif // WIN32 | ||
107 | return -2; | 110 | return -2; |
108 | } | 111 | } |
109 | 112 | ||
@@ -116,7 +119,7 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p) | @@ -116,7 +119,7 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p) | ||
116 | *p->pport = ntohs(((struct sockaddr_in6 *)res->ai_addr)->sin6_port); | 119 | *p->pport = ntohs(((struct sockaddr_in6 *)res->ai_addr)->sin6_port); |
117 | break; | 120 | break; |
118 | default: | 121 | default: |
119 | - snprintf(p->errmsg, p->em_len, "%s: unknown family %d", p->host,res->ai_family); | 122 | + snprintf(p->errmsg, p->em_len, _( "%s: unknown family %d" ), p->host,res->ai_family); |
120 | freeaddrinfo(res); | 123 | freeaddrinfo(res); |
121 | return -1; | 124 | return -1; |
122 | } | 125 | } |
@@ -140,7 +143,7 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p) | @@ -140,7 +143,7 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p) | ||
140 | { | 143 | { |
141 | if (!(sp = getservbyname(portname, "tcp"))) | 144 | if (!(sp = getservbyname(portname, "tcp"))) |
142 | { | 145 | { |
143 | - snprintf(errmsg, em_len,_( "Unknown port number or service: %s" ),portname); | 146 | + snprintf(p->errmsg, p->em_len,_( "Unknown port number or service: %s" ),portname); |
144 | return -1; | 147 | return -1; |
145 | } | 148 | } |
146 | port = sp->s_port; | 149 | port = sp->s_port; |
@@ -159,7 +162,7 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p) | @@ -159,7 +162,7 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p) | ||
159 | sin->sin_addr.s_addr = inet_addr(host); | 162 | sin->sin_addr.s_addr = inet_addr(host); |
160 | if (sin->sin_addr.s_addr == (unsigned long)-1) | 163 | if (sin->sin_addr.s_addr == (unsigned long)-1) |
161 | { | 164 | { |
162 | - snprintf(errmsg, em_len, _( "Unknown host:\n%s" ), host); | 165 | + snprintf(p->errmsg, p->em_len, _( "Unknown host:\n%s" ), host); |
163 | return -2; | 166 | return -2; |
164 | } | 167 | } |
165 | } | 168 | } |
@@ -644,8 +644,7 @@ get_rpq_address(unsigned char *buf, const int maxlen) | @@ -644,8 +644,7 @@ get_rpq_address(unsigned char *buf, const int maxlen) | ||
644 | /* Give back storage obtained by getaddrinfo */ | 644 | /* Give back storage obtained by getaddrinfo */ |
645 | freeaddrinfo(res); | 645 | freeaddrinfo(res); |
646 | } else { | 646 | } else { |
647 | - rpq_warning("RPQ: can't resolve '%s': %s", | ||
648 | - rpqtext, gai_strerror(ga_err)); | 647 | + rpq_warning("RPQ: can't resolve '%s': %s",rpqtext, gai_strerror(ga_err)); |
649 | } | 648 | } |
650 | #else /*][*/ | 649 | #else /*][*/ |
651 | /* | 650 | /* |
telnet.c
@@ -525,7 +525,7 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo | @@ -525,7 +525,7 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo | ||
525 | if (resolve_host_and_port(proxy_host, proxy_portname, | 525 | if (resolve_host_and_port(proxy_host, proxy_portname, |
526 | &proxy_port, &haddr.sa, &ha_len, errmsg, | 526 | &proxy_port, &haddr.sa, &ha_len, errmsg, |
527 | sizeof(errmsg)) < 0) { | 527 | sizeof(errmsg)) < 0) { |
528 | - popup_an_error(NULL,errmsg); | 528 | + popup_an_error(session,errmsg); |
529 | status_resolving(session,0); | 529 | status_resolving(session,0); |
530 | return -1; | 530 | return -1; |
531 | status_resolving(session,0); | 531 | status_resolving(session,0); |
@@ -536,7 +536,7 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo | @@ -536,7 +536,7 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo | ||
536 | &session->current_port, &haddr.sa, &ha_len, | 536 | &session->current_port, &haddr.sa, &ha_len, |
537 | errmsg, sizeof(errmsg)) < 0) { | 537 | errmsg, sizeof(errmsg)) < 0) { |
538 | popup_an_error(session,errmsg); | 538 | popup_an_error(session,errmsg); |
539 | - status_resolving(&h3270,0); | 539 | + status_resolving(session,0); |
540 | return -1; | 540 | return -1; |
541 | status_resolving(session,0); | 541 | status_resolving(session,0); |
542 | } | 542 | } |