Commit 179368743ab915f6d543354b420c38bef827e0ff

Authored by Perry Werneck
1 parent 4f6c107a

Moving to lib3270 own translations.

src/core/ft/ft.c
... ... @@ -124,8 +124,7 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state);
124 124 session->state = state;
125 125  
126 126 ft_message(session,message);
127   - session->cbk.state_changed(session->host,state,message,session->user_data);
128   -
  127 + session->cbk.state_changed(session->host,state,dgettext(GETTEXT_PACKAGE,message),session->user_data);
129 128  
130 129 }
131 130  
... ... @@ -429,7 +428,7 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state);
429 428 // Sending file
430 429 if(fseek(ft->local_file,0L,SEEK_END) < 0)
431 430 {
432   - ft_failed(ft,N_( "Can't get file size" ));
  431 + ft_failed(ft,_( "Can't get file size" ));
433 432 return errno ? errno : -1;
434 433 }
435 434  
... ... @@ -526,7 +525,7 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state);
526 525 if (!flen || flen < strlen(buffer) - 1)
527 526 {
528 527 lib3270_write_log(ft->host, "Unable to send command \"%s\" (flen=%d szBuffer=%d)",buffer,flen,strlen(buffer));
529   - ft_failed(ft,N_( "Unable to send file-transfer request" ));
  528 + ft_failed(ft,_( "Unable to send file-transfer request" ));
530 529 return errno = EINVAL;
531 530 }
532 531  
... ... @@ -535,9 +534,9 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state);
535 534 lib3270_emulate_input(ft->host, buffer, strlen(buffer), False);
536 535  
537 536 if(ft->flags & LIB3270_FT_OPTION_RECEIVE)
538   - ft_message(ft,N_( "Waiting for GET response" ));
  537 + ft_message(ft,_( "Waiting for GET response" ));
539 538 else
540   - ft_message(ft,N_( "Waiting for PUT response" ));
  539 + ft_message(ft,_( "Waiting for PUT response" ));
541 540  
542 541 return 0;
543 542  
... ... @@ -578,12 +577,12 @@ static double finish(H3270FT *ft)
578 577  
579 578 void ft_complete(H3270FT *ft, const char *errmsg)
580 579 {
581   - ft->cbk.complete(ft->host,ft->ft_length,finish(ft),errmsg ? errmsg : N_("Transfer complete"),ft->user_data);
  580 + ft->cbk.complete(ft->host,ft->ft_length,finish(ft),errmsg ? errmsg : _("Transfer complete"),ft->user_data);
582 581 }
583 582  
584 583 void ft_failed(H3270FT *ft, const char *errmsg)
585 584 {
586   - ft->cbk.failed(ft->host,ft->ft_length,finish(ft),errmsg ? errmsg : N_("Transfer failed"),ft->user_data);
  585 + ft->cbk.failed(ft->host,ft->ft_length,finish(ft),errmsg ? errmsg : _("Transfer failed"),ft->user_data);
587 586 }
588 587  
589 588 LIB3270_EXPORT int lib3270_ft_destroy(H3270 *hSession, const char *reason)
... ... @@ -674,7 +673,7 @@ void ft_aborting(H3270FT *h, const char *reason)
674 673 if (h->state == LIB3270_FT_STATE_RUNNING || h->state == LIB3270_FT_STATE_ABORT_WAIT)
675 674 {
676 675 set_ft_state(h,LIB3270_FT_STATE_ABORT_SENT);
677   - h->cbk.message(h->host,N_("Aborting..."),h->user_data);
  676 + h->cbk.message(h->host,_("Aborting..."),h->user_data);
678 677 h->cbk.aborting(h->host,reason,h->user_data);
679 678 }
680 679 }
... ...
src/core/ft/ft_cut.c
... ... @@ -368,7 +368,7 @@ static void cut_control_code(H3270 *hSession)
368 368 *bp-- = '\0';
369 369  
370 370 if (!*buf)
371   - strcpy(buf, N_( "Transfer cancelled by host" ) );
  371 + strcpy(buf, _( "Transfer cancelled by host" ) );
372 372 }
373 373 ft_failed(hSession->ft,buf);
374 374 lib3270_free(buf);
... ... @@ -376,7 +376,7 @@ static void cut_control_code(H3270 *hSession)
376 376  
377 377 default:
378 378 trace_ds(hSession,"unknown 0x%04x\n", code);
379   - cut_abort(hSession,SC_ABORT_XMIT, "%s", N_("Unknown FT control code from host"));
  379 + cut_abort(hSession,SC_ABORT_XMIT, "%s", _("Unknown FT control code from host"));
380 380 break;
381 381 }
382 382 }
... ... @@ -397,7 +397,7 @@ static void cut_data_request(H3270 *hSession)
397 397 trace_ds(hSession,"< FT DATA_REQUEST %u\n", from6(hSession, seq));
398 398 if (lib3270_get_ft_state(hSession) == LIB3270_FT_STATE_ABORT_WAIT)
399 399 {
400   - cut_abort(hSession,SC_ABORT_FILE,"%s", N_("Transfer cancelled by user") );
  400 + cut_abort(hSession,SC_ABORT_FILE,"%s", _("Transfer cancelled by user") );
401 401 return;
402 402 }
403 403  
... ...
src/core/linux/connect.c
... ... @@ -228,7 +228,7 @@ static void net_connected(H3270 *hSession, int GNUC_UNUSED(fd), LIB3270_IO_FLAG
228 228 int rc = errno;
229 229  
230 230 char buffer[4096];
231   - snprintf(buffer,4095,N_( "Can't %s network keep-alive" ), optval ? _( "enable" ) : _( "disable" ));
  231 + snprintf(buffer,4095,_( "Can't %s network keep-alive" ), optval ? _( "enable" ) : _( "disable" ));
232 232  
233 233 lib3270_popup_dialog( hSession,
234 234 LIB3270_NOTIFY_ERROR,
... ... @@ -249,7 +249,7 @@ static void net_connected(H3270 *hSession, int GNUC_UNUSED(fd), LIB3270_IO_FLAG
249 249 #if defined(OMTU)
250 250 else if (setsockopt(hSession->sock, SOL_SOCKET, SO_SNDBUF, (char *)&mtu,sizeof(mtu)) < 0)
251 251 {
252   - popup_a_sockerr(hSession, N_( "setsockopt(%s)" ), "SO_SNDBUF");
  252 + popup_a_sockerr(hSession, _( "setsockopt(%s)" ), "SO_SNDBUF");
253 253 SOCK_CLOSE(hSession);
254 254 }
255 255 #endif
... ...
src/core/telnet.c
... ... @@ -282,45 +282,6 @@ static const char *trsp_flag[2] = { &quot;POSITIVE-RESPONSE&quot;, &quot;NEGATIVE-RESPONSE&quot; };
282 282  
283 283 /*--[ Implement ]------------------------------------------------------------------------------------*/
284 284  
285   -/*
286   -#if defined(_WIN32)
287   -void sockstart(H3270 *session)
288   -{
289   - static int initted = 0;
290   - WORD wVersionRequested;
291   - WSADATA wsaData;
292   -
293   - if (initted)
294   - return;
295   -
296   - initted = 1;
297   -
298   - wVersionRequested = MAKEWORD(2, 2);
299   -
300   - if (WSAStartup(wVersionRequested, &wsaData) != 0)
301   - {
302   - lib3270_popup_dialog( session,
303   - LIB3270_NOTIFY_CRITICAL,
304   - N_( "Network startup error" ),
305   - N_( "WSAStartup failed" ),
306   - "%s", lib3270_win32_strerror(GetLastError()) );
307   -
308   - _exit(1);
309   - }
310   -
311   - if (LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 2)
312   - {
313   - lib3270_popup_dialog( session,
314   - LIB3270_NOTIFY_CRITICAL,
315   - N_( "Network startup error" ),
316   - N_( "Bad winsock version" ),
317   - N_( "Can't use winsock version %d.%d" ), LOBYTE(wsaData.wVersion), HIBYTE(wsaData.wVersion));
318   - _exit(1);
319   - }
320   -}
321   -#endif
322   -*/
323   -
324 285 static union {
325 286 struct sockaddr sa;
326 287 struct sockaddr_in sin;
... ... @@ -708,11 +669,11 @@ void net_input(H3270 *hSession, int GNUC_UNUSED(fd), LIB3270_IO_FLAG GNUC_UNUSED
708 669  
709 670 if (HALF_CONNECTED)
710 671 {
711   - popup_a_sockerr(hSession, N_( "%s" ),hSession->host.current);
  672 + popup_a_sockerr(hSession, "%s", hSession->host.current);
712 673 }
713 674 else if (socket_errno() != SE_ECONNRESET)
714 675 {
715   - popup_a_sockerr(hSession, N_( "Socket read error" ) );
  676 + popup_a_sockerr(hSession, _( "Socket read error" ) );
716 677 }
717 678  
718 679 host_disconnect(hSession,True);
... ... @@ -745,14 +706,11 @@ void net_input(H3270 *hSession, int GNUC_UNUSED(fd), LIB3270_IO_FLAG GNUC_UNUSED
745 706  
746 707 }
747 708  
748   -/*
749   - * set16
750   - * Put a 16-bit value in a buffer.
751   - * Returns the number of bytes required.
  709 +/**
  710 + * @brief Put a 16-bit value in a buffer.
  711 + * @return The number of bytes required.
752 712 */
753   -static int
754   -set16(char *buf, int n)
755   -{
  713 +static int set16(char *buf, int n) {
756 714 char *b0 = buf;
757 715  
758 716 n %= 256 * 256;
... ... @@ -1683,18 +1641,18 @@ LIB3270_INTERNAL int lib3270_sock_send(H3270 *hSession, unsigned const char *buf
1683 1641 switch(socket_errno())
1684 1642 {
1685 1643 case SE_EPIPE:
1686   - popup_an_error(hSession, "%s", N_( "Broken pipe" ));
  1644 + popup_an_error(hSession, "%s", _( "Broken pipe" ));
1687 1645 break;
1688 1646  
1689 1647 case SE_ECONNRESET:
1690   - popup_an_error(hSession, "%s", N_( "Connection reset by peer" ));
  1648 + popup_an_error(hSession, "%s", _( "Connection reset by peer" ));
1691 1649 break;
1692 1650  
1693 1651 case SE_EINTR:
1694 1652 return 0;
1695 1653  
1696 1654 default:
1697   - popup_a_sockerr(NULL, "%s", N_( "Socket write error" ) );
  1655 + popup_a_sockerr(NULL, "%s", _( "Socket write error" ) );
1698 1656  
1699 1657 }
1700 1658  
... ... @@ -1702,7 +1660,7 @@ LIB3270_INTERNAL int lib3270_sock_send(H3270 *hSession, unsigned const char *buf
1702 1660 }
1703 1661  
1704 1662 /**
1705   - * Send out raw telnet data.
  1663 + * @brief Send out raw telnet data.
1706 1664 *
1707 1665 * We assume that there will always be enough space to buffer what we want to transmit,
1708 1666 * so we don't handle EAGAIN or EWOULDBLOCK.
... ... @@ -1737,16 +1695,12 @@ static void net_rawout(H3270 *hSession, unsigned const char *buf, size_t len)
1737 1695  
1738 1696 #if defined(X3270_ANSI)
1739 1697  
1740   -/*
1741   - * net_cookedout
1742   - * Send user data out in ANSI mode, without cooked-mode processing.
  1698 +/**
  1699 + * @brief Send user data out in ANSI mode, without cooked-mode processing.
1743 1700 */
1744   -static void
1745   -net_cookedout(H3270 *hSession, const char *buf, int len)
1746   -{
1747   -#if defined(X3270_TRACE)
1748   - if (lib3270_get_toggle(hSession,LIB3270_TOGGLE_DS_TRACE))
1749   - {
  1701 +static void net_cookedout(H3270 *hSession, const char *buf, int len) {
  1702 +
  1703 + if (lib3270_get_toggle(hSession,LIB3270_TOGGLE_DS_TRACE)) {
1750 1704 int i;
1751 1705  
1752 1706 trace_dsn(hSession,">");
... ... @@ -1754,15 +1708,12 @@ net_cookedout(H3270 *hSession, const char *buf, int len)
1754 1708 trace_dsn(hSession," %s", ctl_see((int) *(buf+i)));
1755 1709 trace_dsn(hSession,"\n");
1756 1710 }
1757   -#endif
  1711 +
1758 1712 net_rawout(hSession,(unsigned const char *) buf, len);
1759 1713 }
1760 1714  
1761   -
1762   -/*
1763   - * net_cookout
1764   - * Send output in ANSI mode, including cooked-mode processing if
1765   - * appropriate.
  1715 +/***
  1716 + * @brief Send output in ANSI mode, including cooked-mode processing if appropriate.
1766 1717 */
1767 1718 static void net_cookout(H3270 *hSession, const char *buf, int len)
1768 1719 {
... ... @@ -1818,13 +1769,11 @@ static void net_cookout(H3270 *hSession, const char *buf, int len)
1818 1769 net_cookedout(hSession, buf, len);
1819 1770 }
1820 1771  
1821   -
1822   -/*
1823   - * Cooked mode input processing.
  1772 +/**
  1773 + * @brief Cooked mode input processing.
1824 1774 */
1825 1775  
1826   -static void cooked_init(H3270 *hSession)
1827   -{
  1776 +static void cooked_init(H3270 *hSession) {
1828 1777 if (hSession->lbuf == (unsigned char *)NULL)
1829 1778 hSession->lbuf = (unsigned char *)lib3270_malloc(BUFSZ);
1830 1779 hSession->lbptr = hSession->lbuf;
... ...
src/core/toggles/init.c
... ... @@ -86,7 +86,7 @@ static void toggle_keepalive(H3270 *session, const struct lib3270_toggle GNUC_UN
86 86  
87 87 if (setsockopt(session->connection.sock, SOL_SOCKET, SO_KEEPALIVE, (char *)&optval, sizeof(optval)) < 0)
88 88 {
89   - popup_a_sockerr(session, N_( "Can't %s network keep-alive" ), optval ? _( "enable" ) : _( "disable" ));
  89 + popup_a_sockerr(session, _( "Can't %s network keep-alive" ), optval ? _( "enable" ) : _( "disable" ));
90 90 }
91 91 else
92 92 {
... ...
src/core/windows/connect.c
... ... @@ -130,8 +130,8 @@ static void sockstart(H3270 *session)
130 130 {
131 131 lib3270_popup_dialog( session,
132 132 LIB3270_NOTIFY_CRITICAL,
133   - N_( "Network startup error" ),
134   - N_( "WSAStartup failed" ),
  133 + _( "Network startup error" ),
  134 + _( "WSAStartup failed" ),
135 135 "%s", lib3270_win32_strerror(GetLastError()) );
136 136  
137 137 _exit(1);
... ... @@ -141,9 +141,9 @@ static void sockstart(H3270 *session)
141 141 {
142 142 lib3270_popup_dialog( session,
143 143 LIB3270_NOTIFY_CRITICAL,
144   - N_( "Network startup error" ),
145   - N_( "Bad winsock version" ),
146   - N_( "Can't use winsock version %d.%d" ), LOBYTE(wsaData.wVersion), HIBYTE(wsaData.wVersion));
  144 + _( "Network startup error" ),
  145 + _( "Bad winsock version" ),
  146 + _( "Can't use winsock version %d.%d" ), LOBYTE(wsaData.wVersion), HIBYTE(wsaData.wVersion));
147 147 _exit(1);
148 148 }
149 149 }
... ... @@ -329,7 +329,7 @@ int net_reconnect(H3270 *hSession, int seconds)
329 329 if (setsockopt(hSession->connection.sock, SOL_SOCKET, SO_KEEPALIVE, (char *)&optval, sizeof(optval)) < 0)
330 330 {
331 331 char buffer[4096];
332   - snprintf(buffer,4095,N_( "Can't %s network keep-alive" ), optval ? _( "enable" ) : _( "disable" ));
  332 + snprintf(buffer,4095,_( "Can't %s network keep-alive" ), optval ? _( "enable" ) : _( "disable" ));
333 333  
334 334 lib3270_popup_dialog( hSession,
335 335 LIB3270_NOTIFY_ERROR,
... ...
src/ssl/linux/init.c
... ... @@ -86,8 +86,8 @@ int ssl_ctx_init(H3270 *hSession, SSL_ERROR_MESSAGE * message)
86 86 if(ssl_ctx == NULL)
87 87 {
88 88 message->error = hSession->ssl.error = ERR_get_error();
89   - message->title = N_( "Security error" );
90   - message->text = N_( "Cant initialize the SSL context." );
  89 + message->title = _( "Security error" );
  90 + message->text = _( "Cant initialize the SSL context." );
91 91 return -1;
92 92 }
93 93  
... ...
src/ssl/negotiate.c
... ... @@ -154,9 +154,9 @@ static int background_ssl_negotiation(H3270 *hSession, void *message)
154 154 {
155 155 trace_ssl(hSession,"%s","SSL_set_fd failed!\n");
156 156  
157   - ((SSL_ERROR_MESSAGE *) message)->title = N_( "Security error" );
158   - ((SSL_ERROR_MESSAGE *) message)->text = N_( "SSL negotiation failed" );
159   - ((SSL_ERROR_MESSAGE *) message)->description = N_( "Cant set the file descriptor for the input/output facility for the TLS/SSL (encrypted) side of ssl." );
  157 + ((SSL_ERROR_MESSAGE *) message)->title = _( "Security error" );
  158 + ((SSL_ERROR_MESSAGE *) message)->text = _( "SSL negotiation failed" );
  159 + ((SSL_ERROR_MESSAGE *) message)->description = _( "Cant set the file descriptor for the input/output facility for the TLS/SSL (encrypted) side of ssl." );
160 160  
161 161 return -1;
162 162 }
... ... @@ -188,8 +188,8 @@ static int background_ssl_negotiation(H3270 *hSession, void *message)
188 188  
189 189 trace_ssl(hSession,"SSL_connect failed: %s %s\n",msg,ERR_reason_error_string(hSession->ssl.error));
190 190  
191   - ((SSL_ERROR_MESSAGE *) message)->title = N_( "Security error" );
192   - ((SSL_ERROR_MESSAGE *) message)->text = N_( "SSL Connect failed" );
  191 + ((SSL_ERROR_MESSAGE *) message)->title = _( "Security error" );
  192 + ((SSL_ERROR_MESSAGE *) message)->text = _( "SSL Connect failed" );
193 193  
194 194 return -1;
195 195  
... ...
src/ssl/windows/init.c
... ... @@ -88,8 +88,8 @@ int ssl_ctx_init(H3270 *hSession, SSL_ERROR_MESSAGE * message)
88 88 if(ssl_ctx == NULL)
89 89 {
90 90 message->error = hSession->ssl.error = ERR_get_error();
91   - message->title = N_( "Security error" );
92   - message->text = N_( "Cant initialize the SSL context." );
  91 + message->title = _( "Security error" );
  92 + message->text = _( "Cant initialize the SSL context." );
93 93 return -1;
94 94 }
95 95  
... ... @@ -109,8 +109,8 @@ int ssl_ctx_init(H3270 *hSession, SSL_ERROR_MESSAGE * message)
109 109  
110 110 if(hFind == INVALID_HANDLE_VALUE)
111 111 {
112   - message->title = N_( "Security error" );
113   - message->text = N_( "Cant open custom certificate directory." );
  112 + message->title = _( "Security error" );
  113 + message->text = _( "Cant open custom certificate directory." );
114 114  
115 115 trace_ssl(hSession, _( "Can't open \"%s\" (The Windows error code was %ld)\n" ), certpath, (long) GetLastError());
116 116 }
... ... @@ -135,8 +135,8 @@ int ssl_ctx_init(H3270 *hSession, SSL_ERROR_MESSAGE * message)
135 135 if(!cert)
136 136 {
137 137 message->error = hSession->ssl.error = ERR_get_error();
138   - message->title = N_( "Security error" );
139   - message->text = N_( "Cant read custom certificate file." );
  138 + message->title = _( "Security error" );
  139 + message->text = _( "Cant read custom certificate file." );
140 140  
141 141 trace_ssl(hSession, _( "Can't read \"%s\": %s" ), filename, ERR_lib_error_string(hSession->ssl.error));
142 142 }
... ... @@ -146,8 +146,8 @@ int ssl_ctx_init(H3270 *hSession, SSL_ERROR_MESSAGE * message)
146 146 if(X509_STORE_add_cert(store, cert) != 1)
147 147 {
148 148 message->error = hSession->ssl.error = ERR_get_error();
149   - message->title = N_( "Security error" );
150   - message->text = N_( "Cant load custom certificate file." );
  149 + message->title = _( "Security error" );
  150 + message->text = _( "Cant load custom certificate file." );
151 151  
152 152 trace_ssl(hSession, _( "Can't load \"%s\": %s" ), filename, ERR_lib_error_string(hSession->ssl.error));
153 153 }
... ...