diff --git a/src/core/ft/ft.c b/src/core/ft/ft.c index 72c3c79..825a259 100644 --- a/src/core/ft/ft.c +++ b/src/core/ft/ft.c @@ -124,8 +124,7 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); session->state = state; ft_message(session,message); - session->cbk.state_changed(session->host,state,message,session->user_data); - + session->cbk.state_changed(session->host,state,dgettext(GETTEXT_PACKAGE,message),session->user_data); } @@ -429,7 +428,7 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); // Sending file if(fseek(ft->local_file,0L,SEEK_END) < 0) { - ft_failed(ft,N_( "Can't get file size" )); + ft_failed(ft,_( "Can't get file size" )); return errno ? errno : -1; } @@ -526,7 +525,7 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); if (!flen || flen < strlen(buffer) - 1) { lib3270_write_log(ft->host, "Unable to send command \"%s\" (flen=%d szBuffer=%d)",buffer,flen,strlen(buffer)); - ft_failed(ft,N_( "Unable to send file-transfer request" )); + ft_failed(ft,_( "Unable to send file-transfer request" )); return errno = EINVAL; } @@ -535,9 +534,9 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state); lib3270_emulate_input(ft->host, buffer, strlen(buffer), False); if(ft->flags & LIB3270_FT_OPTION_RECEIVE) - ft_message(ft,N_( "Waiting for GET response" )); + ft_message(ft,_( "Waiting for GET response" )); else - ft_message(ft,N_( "Waiting for PUT response" )); + ft_message(ft,_( "Waiting for PUT response" )); return 0; @@ -578,12 +577,12 @@ static double finish(H3270FT *ft) void ft_complete(H3270FT *ft, const char *errmsg) { - ft->cbk.complete(ft->host,ft->ft_length,finish(ft),errmsg ? errmsg : N_("Transfer complete"),ft->user_data); + ft->cbk.complete(ft->host,ft->ft_length,finish(ft),errmsg ? errmsg : _("Transfer complete"),ft->user_data); } void ft_failed(H3270FT *ft, const char *errmsg) { - ft->cbk.failed(ft->host,ft->ft_length,finish(ft),errmsg ? errmsg : N_("Transfer failed"),ft->user_data); + ft->cbk.failed(ft->host,ft->ft_length,finish(ft),errmsg ? errmsg : _("Transfer failed"),ft->user_data); } LIB3270_EXPORT int lib3270_ft_destroy(H3270 *hSession, const char *reason) @@ -674,7 +673,7 @@ void ft_aborting(H3270FT *h, const char *reason) if (h->state == LIB3270_FT_STATE_RUNNING || h->state == LIB3270_FT_STATE_ABORT_WAIT) { set_ft_state(h,LIB3270_FT_STATE_ABORT_SENT); - h->cbk.message(h->host,N_("Aborting..."),h->user_data); + h->cbk.message(h->host,_("Aborting..."),h->user_data); h->cbk.aborting(h->host,reason,h->user_data); } } diff --git a/src/core/ft/ft_cut.c b/src/core/ft/ft_cut.c index a2b75b1..0b73b9c 100644 --- a/src/core/ft/ft_cut.c +++ b/src/core/ft/ft_cut.c @@ -368,7 +368,7 @@ static void cut_control_code(H3270 *hSession) *bp-- = '\0'; if (!*buf) - strcpy(buf, N_( "Transfer cancelled by host" ) ); + strcpy(buf, _( "Transfer cancelled by host" ) ); } ft_failed(hSession->ft,buf); lib3270_free(buf); @@ -376,7 +376,7 @@ static void cut_control_code(H3270 *hSession) default: trace_ds(hSession,"unknown 0x%04x\n", code); - cut_abort(hSession,SC_ABORT_XMIT, "%s", N_("Unknown FT control code from host")); + cut_abort(hSession,SC_ABORT_XMIT, "%s", _("Unknown FT control code from host")); break; } } @@ -397,7 +397,7 @@ static void cut_data_request(H3270 *hSession) trace_ds(hSession,"< FT DATA_REQUEST %u\n", from6(hSession, seq)); if (lib3270_get_ft_state(hSession) == LIB3270_FT_STATE_ABORT_WAIT) { - cut_abort(hSession,SC_ABORT_FILE,"%s", N_("Transfer cancelled by user") ); + cut_abort(hSession,SC_ABORT_FILE,"%s", _("Transfer cancelled by user") ); return; } diff --git a/src/core/linux/connect.c b/src/core/linux/connect.c index 41c9e7a..c8d6478 100644 --- a/src/core/linux/connect.c +++ b/src/core/linux/connect.c @@ -228,7 +228,7 @@ static void net_connected(H3270 *hSession, int GNUC_UNUSED(fd), LIB3270_IO_FLAG int rc = errno; char buffer[4096]; - snprintf(buffer,4095,N_( "Can't %s network keep-alive" ), optval ? _( "enable" ) : _( "disable" )); + snprintf(buffer,4095,_( "Can't %s network keep-alive" ), optval ? _( "enable" ) : _( "disable" )); lib3270_popup_dialog( hSession, LIB3270_NOTIFY_ERROR, @@ -249,7 +249,7 @@ static void net_connected(H3270 *hSession, int GNUC_UNUSED(fd), LIB3270_IO_FLAG #if defined(OMTU) else if (setsockopt(hSession->sock, SOL_SOCKET, SO_SNDBUF, (char *)&mtu,sizeof(mtu)) < 0) { - popup_a_sockerr(hSession, N_( "setsockopt(%s)" ), "SO_SNDBUF"); + popup_a_sockerr(hSession, _( "setsockopt(%s)" ), "SO_SNDBUF"); SOCK_CLOSE(hSession); } #endif diff --git a/src/core/telnet.c b/src/core/telnet.c index bbcdbaf..1dcf259 100644 --- a/src/core/telnet.c +++ b/src/core/telnet.c @@ -282,45 +282,6 @@ static const char *trsp_flag[2] = { "POSITIVE-RESPONSE", "NEGATIVE-RESPONSE" }; /*--[ Implement ]------------------------------------------------------------------------------------*/ -/* -#if defined(_WIN32) -void sockstart(H3270 *session) -{ - static int initted = 0; - WORD wVersionRequested; - WSADATA wsaData; - - if (initted) - return; - - initted = 1; - - wVersionRequested = MAKEWORD(2, 2); - - if (WSAStartup(wVersionRequested, &wsaData) != 0) - { - lib3270_popup_dialog( session, - LIB3270_NOTIFY_CRITICAL, - N_( "Network startup error" ), - N_( "WSAStartup failed" ), - "%s", lib3270_win32_strerror(GetLastError()) ); - - _exit(1); - } - - if (LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 2) - { - lib3270_popup_dialog( session, - LIB3270_NOTIFY_CRITICAL, - N_( "Network startup error" ), - N_( "Bad winsock version" ), - N_( "Can't use winsock version %d.%d" ), LOBYTE(wsaData.wVersion), HIBYTE(wsaData.wVersion)); - _exit(1); - } -} -#endif -*/ - static union { struct sockaddr sa; struct sockaddr_in sin; @@ -708,11 +669,11 @@ void net_input(H3270 *hSession, int GNUC_UNUSED(fd), LIB3270_IO_FLAG GNUC_UNUSED if (HALF_CONNECTED) { - popup_a_sockerr(hSession, N_( "%s" ),hSession->host.current); + popup_a_sockerr(hSession, "%s", hSession->host.current); } else if (socket_errno() != SE_ECONNRESET) { - popup_a_sockerr(hSession, N_( "Socket read error" ) ); + popup_a_sockerr(hSession, _( "Socket read error" ) ); } host_disconnect(hSession,True); @@ -745,14 +706,11 @@ void net_input(H3270 *hSession, int GNUC_UNUSED(fd), LIB3270_IO_FLAG GNUC_UNUSED } -/* - * set16 - * Put a 16-bit value in a buffer. - * Returns the number of bytes required. +/** + * @brief Put a 16-bit value in a buffer. + * @return The number of bytes required. */ -static int -set16(char *buf, int n) -{ +static int set16(char *buf, int n) { char *b0 = buf; n %= 256 * 256; @@ -1683,18 +1641,18 @@ LIB3270_INTERNAL int lib3270_sock_send(H3270 *hSession, unsigned const char *buf switch(socket_errno()) { case SE_EPIPE: - popup_an_error(hSession, "%s", N_( "Broken pipe" )); + popup_an_error(hSession, "%s", _( "Broken pipe" )); break; case SE_ECONNRESET: - popup_an_error(hSession, "%s", N_( "Connection reset by peer" )); + popup_an_error(hSession, "%s", _( "Connection reset by peer" )); break; case SE_EINTR: return 0; default: - popup_a_sockerr(NULL, "%s", N_( "Socket write error" ) ); + popup_a_sockerr(NULL, "%s", _( "Socket write error" ) ); } @@ -1702,7 +1660,7 @@ LIB3270_INTERNAL int lib3270_sock_send(H3270 *hSession, unsigned const char *buf } /** - * Send out raw telnet data. + * @brief Send out raw telnet data. * * We assume that there will always be enough space to buffer what we want to transmit, * 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) #if defined(X3270_ANSI) -/* - * net_cookedout - * Send user data out in ANSI mode, without cooked-mode processing. +/** + * @brief Send user data out in ANSI mode, without cooked-mode processing. */ -static void -net_cookedout(H3270 *hSession, const char *buf, int len) -{ -#if defined(X3270_TRACE) - if (lib3270_get_toggle(hSession,LIB3270_TOGGLE_DS_TRACE)) - { +static void net_cookedout(H3270 *hSession, const char *buf, int len) { + + if (lib3270_get_toggle(hSession,LIB3270_TOGGLE_DS_TRACE)) { int i; trace_dsn(hSession,">"); @@ -1754,15 +1708,12 @@ net_cookedout(H3270 *hSession, const char *buf, int len) trace_dsn(hSession," %s", ctl_see((int) *(buf+i))); trace_dsn(hSession,"\n"); } -#endif + net_rawout(hSession,(unsigned const char *) buf, len); } - -/* - * net_cookout - * Send output in ANSI mode, including cooked-mode processing if - * appropriate. +/*** + * @brief Send output in ANSI mode, including cooked-mode processing if appropriate. */ static void net_cookout(H3270 *hSession, const char *buf, int len) { @@ -1818,13 +1769,11 @@ static void net_cookout(H3270 *hSession, const char *buf, int len) net_cookedout(hSession, buf, len); } - -/* - * Cooked mode input processing. +/** + * @brief Cooked mode input processing. */ -static void cooked_init(H3270 *hSession) -{ +static void cooked_init(H3270 *hSession) { if (hSession->lbuf == (unsigned char *)NULL) hSession->lbuf = (unsigned char *)lib3270_malloc(BUFSZ); hSession->lbptr = hSession->lbuf; diff --git a/src/core/toggles/init.c b/src/core/toggles/init.c index 26104a5..31d2bda 100644 --- a/src/core/toggles/init.c +++ b/src/core/toggles/init.c @@ -86,7 +86,7 @@ static void toggle_keepalive(H3270 *session, const struct lib3270_toggle GNUC_UN if (setsockopt(session->connection.sock, SOL_SOCKET, SO_KEEPALIVE, (char *)&optval, sizeof(optval)) < 0) { - popup_a_sockerr(session, N_( "Can't %s network keep-alive" ), optval ? _( "enable" ) : _( "disable" )); + popup_a_sockerr(session, _( "Can't %s network keep-alive" ), optval ? _( "enable" ) : _( "disable" )); } else { diff --git a/src/core/windows/connect.c b/src/core/windows/connect.c index 2cc0a0b..427b8d8 100644 --- a/src/core/windows/connect.c +++ b/src/core/windows/connect.c @@ -130,8 +130,8 @@ static void sockstart(H3270 *session) { lib3270_popup_dialog( session, LIB3270_NOTIFY_CRITICAL, - N_( "Network startup error" ), - N_( "WSAStartup failed" ), + _( "Network startup error" ), + _( "WSAStartup failed" ), "%s", lib3270_win32_strerror(GetLastError()) ); _exit(1); @@ -141,9 +141,9 @@ static void sockstart(H3270 *session) { lib3270_popup_dialog( session, LIB3270_NOTIFY_CRITICAL, - N_( "Network startup error" ), - N_( "Bad winsock version" ), - N_( "Can't use winsock version %d.%d" ), LOBYTE(wsaData.wVersion), HIBYTE(wsaData.wVersion)); + _( "Network startup error" ), + _( "Bad winsock version" ), + _( "Can't use winsock version %d.%d" ), LOBYTE(wsaData.wVersion), HIBYTE(wsaData.wVersion)); _exit(1); } } @@ -329,7 +329,7 @@ int net_reconnect(H3270 *hSession, int seconds) if (setsockopt(hSession->connection.sock, SOL_SOCKET, SO_KEEPALIVE, (char *)&optval, sizeof(optval)) < 0) { char buffer[4096]; - snprintf(buffer,4095,N_( "Can't %s network keep-alive" ), optval ? _( "enable" ) : _( "disable" )); + snprintf(buffer,4095,_( "Can't %s network keep-alive" ), optval ? _( "enable" ) : _( "disable" )); lib3270_popup_dialog( hSession, LIB3270_NOTIFY_ERROR, diff --git a/src/ssl/linux/init.c b/src/ssl/linux/init.c index 461f8dc..80b9181 100644 --- a/src/ssl/linux/init.c +++ b/src/ssl/linux/init.c @@ -86,8 +86,8 @@ int ssl_ctx_init(H3270 *hSession, SSL_ERROR_MESSAGE * message) if(ssl_ctx == NULL) { message->error = hSession->ssl.error = ERR_get_error(); - message->title = N_( "Security error" ); - message->text = N_( "Cant initialize the SSL context." ); + message->title = _( "Security error" ); + message->text = _( "Cant initialize the SSL context." ); return -1; } diff --git a/src/ssl/negotiate.c b/src/ssl/negotiate.c index 43b5d1c..91bfc63 100644 --- a/src/ssl/negotiate.c +++ b/src/ssl/negotiate.c @@ -154,9 +154,9 @@ static int background_ssl_negotiation(H3270 *hSession, void *message) { trace_ssl(hSession,"%s","SSL_set_fd failed!\n"); - ((SSL_ERROR_MESSAGE *) message)->title = N_( "Security error" ); - ((SSL_ERROR_MESSAGE *) message)->text = N_( "SSL negotiation failed" ); - ((SSL_ERROR_MESSAGE *) message)->description = N_( "Cant set the file descriptor for the input/output facility for the TLS/SSL (encrypted) side of ssl." ); + ((SSL_ERROR_MESSAGE *) message)->title = _( "Security error" ); + ((SSL_ERROR_MESSAGE *) message)->text = _( "SSL negotiation failed" ); + ((SSL_ERROR_MESSAGE *) message)->description = _( "Cant set the file descriptor for the input/output facility for the TLS/SSL (encrypted) side of ssl." ); return -1; } @@ -188,8 +188,8 @@ static int background_ssl_negotiation(H3270 *hSession, void *message) trace_ssl(hSession,"SSL_connect failed: %s %s\n",msg,ERR_reason_error_string(hSession->ssl.error)); - ((SSL_ERROR_MESSAGE *) message)->title = N_( "Security error" ); - ((SSL_ERROR_MESSAGE *) message)->text = N_( "SSL Connect failed" ); + ((SSL_ERROR_MESSAGE *) message)->title = _( "Security error" ); + ((SSL_ERROR_MESSAGE *) message)->text = _( "SSL Connect failed" ); return -1; diff --git a/src/ssl/windows/init.c b/src/ssl/windows/init.c index d9c8e0f..26e82c6 100644 --- a/src/ssl/windows/init.c +++ b/src/ssl/windows/init.c @@ -88,8 +88,8 @@ int ssl_ctx_init(H3270 *hSession, SSL_ERROR_MESSAGE * message) if(ssl_ctx == NULL) { message->error = hSession->ssl.error = ERR_get_error(); - message->title = N_( "Security error" ); - message->text = N_( "Cant initialize the SSL context." ); + message->title = _( "Security error" ); + message->text = _( "Cant initialize the SSL context." ); return -1; } @@ -109,8 +109,8 @@ int ssl_ctx_init(H3270 *hSession, SSL_ERROR_MESSAGE * message) if(hFind == INVALID_HANDLE_VALUE) { - message->title = N_( "Security error" ); - message->text = N_( "Cant open custom certificate directory." ); + message->title = _( "Security error" ); + message->text = _( "Cant open custom certificate directory." ); trace_ssl(hSession, _( "Can't open \"%s\" (The Windows error code was %ld)\n" ), certpath, (long) GetLastError()); } @@ -135,8 +135,8 @@ int ssl_ctx_init(H3270 *hSession, SSL_ERROR_MESSAGE * message) if(!cert) { message->error = hSession->ssl.error = ERR_get_error(); - message->title = N_( "Security error" ); - message->text = N_( "Cant read custom certificate file." ); + message->title = _( "Security error" ); + message->text = _( "Cant read custom certificate file." ); trace_ssl(hSession, _( "Can't read \"%s\": %s" ), filename, ERR_lib_error_string(hSession->ssl.error)); } @@ -146,8 +146,8 @@ int ssl_ctx_init(H3270 *hSession, SSL_ERROR_MESSAGE * message) if(X509_STORE_add_cert(store, cert) != 1) { message->error = hSession->ssl.error = ERR_get_error(); - message->title = N_( "Security error" ); - message->text = N_( "Cant load custom certificate file." ); + message->title = _( "Security error" ); + message->text = _( "Cant load custom certificate file." ); trace_ssl(hSession, _( "Can't load \"%s\": %s" ), filename, ERR_lib_error_string(hSession->ssl.error)); } -- libgit2 0.21.2