Commit 044b6e2bbdb2d9f47da7947de16a89766502c317
1 parent
b0c728d3
Exists in
master
and in
5 other branches
Iniciando implementacao de suporte iconv na biblioteca
Showing
9 changed files
with
42 additions
and
24 deletions
Show diff stats
configure.ac
... | ... | @@ -111,6 +111,18 @@ esac |
111 | 111 | DBG_LDFLAGS="-L.bin/Debug/lib" |
112 | 112 | RLS_LDFLAGS="-L.bin/Release/lib -Wl,--strip-all" |
113 | 113 | |
114 | +#--[ Check gettext ]------------------------------------------------------------------------------------------------------------------------------------------ | |
115 | + | |
116 | +AC_PATH_TOOL([XGETTEXT], [xgettext], [no]) | |
117 | +AC_PATH_TOOL([MSGCAT], [msgcat], [no]) | |
118 | +AC_PATH_TOOL([MSGINIT], [msginit], [no]) | |
119 | +AC_PATH_TOOL([MSGFMT], [msgfmt], [no]) | |
120 | + | |
121 | +AC_CHECK_HEADER(libintl.h, AC_DEFINE(HAVE_LIBINTL)) | |
122 | +AC_CHECK_LIB(intl, gettext,[INTL_LIBS="-lintl"]) | |
123 | + | |
124 | +AC_SUBST(INTL_LIBS) | |
125 | + | |
114 | 126 | #--[ Check for ELF symbol visibility support ]---------------------------------------------------------------------------------------------------------------- |
115 | 127 | |
116 | 128 | # Try to compile PROGRAM, check for warnings | ... | ... |
src/gtk/v3270/iocallback.c
... | ... | @@ -47,10 +47,7 @@ |
47 | 47 | #include <malloc.h> |
48 | 48 | #endif |
49 | 49 | |
50 | -#ifdef G_THREADS_ENABLED | |
51 | - static int static_CallAndWait(int(*callback)(H3270 *session, void *), H3270 *session, void *parm); | |
52 | -#endif | |
53 | - | |
50 | +static int static_CallAndWait(int(*callback)(H3270 *session, void *), H3270 *session, void *parm); | |
54 | 51 | static unsigned long static_AddInput(int source, H3270 *session, void (*fn)(H3270 *session)); |
55 | 52 | static void static_RemoveSource(unsigned long id); |
56 | 53 | |
... | ... | @@ -242,8 +239,6 @@ static gboolean IO_closure(gpointer data) |
242 | 239 | return 0; |
243 | 240 | } |
244 | 241 | |
245 | -#ifdef G_THREADS_ENABLED | |
246 | - | |
247 | 242 | struct bgParameter |
248 | 243 | { |
249 | 244 | gboolean running; |
... | ... | @@ -285,8 +280,6 @@ static int static_CallAndWait(int(*callback)(H3270 *session, void *), H3270 *ses |
285 | 280 | return p.rc; |
286 | 281 | } |
287 | 282 | |
288 | -#endif | |
289 | - | |
290 | 283 | static int static_Sleep(int seconds) |
291 | 284 | { |
292 | 285 | time_t end = time(0) + seconds; | ... | ... |
src/include/lib3270/config.h.in
src/lib3270/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 | ... | ... |
src/lib3270/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); | ... | ... |
src/lib3270/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 | */ | ... | ... |
src/lib3270/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 | } | ... | ... |
src/lib3270/rpq.c
... | ... | @@ -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 | /* | ... | ... |
src/lib3270/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 | } | ... | ... |