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 | 34 | DLL_FLAGS=@DLL_FLAGS@ |
35 | 35 | LDFLAGS=@LDFLAGS@ |
36 | 36 | |
37 | -LIBS=@LIBS@ @LIBSSL_LIBS@ @SOCKET_LIBS@ | |
37 | +LIBS=@LIBS@ @LIBSSL_LIBS@ @INTL_LIBS@ @SOCKET_LIBS@ | |
38 | 38 | |
39 | 39 | DEBUG_CFLAGS=-DDEBUG=1 -g |
40 | 40 | DEPENDS ?= *.h ../../src/include/*.h Makefile | ... | ... |
appres.h
... | ... | @@ -232,9 +232,4 @@ typedef struct { |
232 | 232 | |
233 | 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 | 235 | void toggle_rectselect(H3270 *session, struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt); | ... | ... |
globals.h
... | ... | @@ -53,6 +53,21 @@ |
53 | 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 | 71 | * OS-specific #defines. Except for the blocking-connect workarounds, these |
57 | 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 | 101 | |
102 | 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 | 110 | return -2; |
108 | 111 | } |
109 | 112 | |
... | ... | @@ -116,7 +119,7 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p) |
116 | 119 | *p->pport = ntohs(((struct sockaddr_in6 *)res->ai_addr)->sin6_port); |
117 | 120 | break; |
118 | 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 | 123 | freeaddrinfo(res); |
121 | 124 | return -1; |
122 | 125 | } |
... | ... | @@ -140,7 +143,7 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p) |
140 | 143 | { |
141 | 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 | 147 | return -1; |
145 | 148 | } |
146 | 149 | port = sp->s_port; |
... | ... | @@ -159,7 +162,7 @@ static int cresolve_host_and_port(H3270 *h, struct parms *p) |
159 | 162 | sin->sin_addr.s_addr = inet_addr(host); |
160 | 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 | 166 | return -2; |
164 | 167 | } |
165 | 168 | } | ... | ... |
... | ... | @@ -644,8 +644,7 @@ get_rpq_address(unsigned char *buf, const int maxlen) |
644 | 644 | /* Give back storage obtained by getaddrinfo */ |
645 | 645 | freeaddrinfo(res); |
646 | 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 | 649 | #else /*][*/ |
651 | 650 | /* | ... | ... |
telnet.c
... | ... | @@ -525,7 +525,7 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo |
525 | 525 | if (resolve_host_and_port(proxy_host, proxy_portname, |
526 | 526 | &proxy_port, &haddr.sa, &ha_len, errmsg, |
527 | 527 | sizeof(errmsg)) < 0) { |
528 | - popup_an_error(NULL,errmsg); | |
528 | + popup_an_error(session,errmsg); | |
529 | 529 | status_resolving(session,0); |
530 | 530 | return -1; |
531 | 531 | status_resolving(session,0); |
... | ... | @@ -536,7 +536,7 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo |
536 | 536 | &session->current_port, &haddr.sa, &ha_len, |
537 | 537 | errmsg, sizeof(errmsg)) < 0) { |
538 | 538 | popup_an_error(session,errmsg); |
539 | - status_resolving(&h3270,0); | |
539 | + status_resolving(session,0); | |
540 | 540 | return -1; |
541 | 541 | status_resolving(session,0); |
542 | 542 | } | ... | ... |