diff --git a/po/pt_BR.po b/po/pt_BR.po index e88e80d..4886f52 100644 --- a/po/pt_BR.po +++ b/po/pt_BR.po @@ -5,7 +5,7 @@ msgid "" msgstr "" "Project-Id-Version: pw3270 5.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2013-12-04 08:42-0200\n" +"POT-Creation-Date: 2013-12-06 08:13-0200\n" "PO-Revision-Date: 2013-12-03 13:26-0200\n" "Last-Translator: Perry Werneck \n" "Language-Team: Portugues <>\n" @@ -19,6 +19,12 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Generator: Gtranslator 2.91.6\n" +#: ssl.c:257 ssl.c:310 connect.c:91 connect.c:104 connect.c:106 connect.c:554 +#: connect.c:571 +#, c-format +msgid "%s" +msgstr "%s" + #: window.c:283 #, c-format msgid "%s - Disconnected" @@ -49,32 +55,32 @@ msgstr "Ação %s precisa do atributo src" msgid "%s requires GTK version %d.%d.%d" msgstr "%s requer GTK versão %d.%d.%d" -#: kybd.c:2694 +#: kybd.c:2681 #, c-format msgid "%s: Bell not supported" msgstr "%s: Alerta sonoro não suportado" -#: kybd.c:2853 +#: kybd.c:2840 #, c-format msgid "%s: Missing hex digits after \\x" msgstr "%s: Faltando dígitos hexadecimais após \\x" -#: kybd.c:2793 +#: kybd.c:2780 #, c-format msgid "%s: Unknown character after \\p" msgstr "%s: Caractere desconhecido depois de \\p" -#: kybd.c:2829 +#: kybd.c:2816 #, c-format msgid "%s: Unknown character after \\pa" msgstr "%s: Caractere desconhecido depois de \\pa" -#: kybd.c:2807 +#: kybd.c:2794 #, c-format msgid "%s: Unknown character after \\pf" msgstr "%s: Caractere desconhecido depois de \\pf" -#: kybd.c:2745 +#: kybd.c:2732 #, c-format msgid "%s: Vertical tab not supported" msgstr "%s: Tabulação vertical não é suportada" @@ -84,7 +90,7 @@ msgstr "%s: Tabulação vertical não é suportada" msgid "%s: unknown family %d" msgstr "%s: Familia %d é inválida" -#: telnet.c:1173 +#: telnet.c:1039 #, c-format msgid "%s:%d" msgstr "%s:%d" @@ -194,7 +200,11 @@ msgstr "" "A CA certificate is invalid. Either it is not a CA or its extensions are not " "consistent with the supplied purpose." -#: ft.c:525 +#: ft.c:100 +msgid "Abort sent; awaiting response" +msgstr "Abort sent; awaiting response" + +#: ft.c:553 msgid "Aborting..." msgstr "Abortando..." @@ -202,6 +212,10 @@ msgstr "Abortando..." msgid "About security" msgstr "Sobre a segurança" +#: ft.c:98 +msgid "Ack received, data flowing" +msgstr "Ack received, data flowing" + #: paste.c:300 msgid "Action failed" msgstr "Ação falhou" @@ -252,11 +266,15 @@ msgstr "Reconectar automaticamente" msgid "Avblock" msgstr "Avblock" +#: ft.c:99 +msgid "Awaiting chance to send an abort" +msgstr "Awaiting chance to send an abort" + #: colors.c:435 msgid "Background" msgstr "Fundo" -#: telnet.c:328 +#: telnet.c:303 connect.c:169 msgid "Bad winsock version" msgstr "Versão winsock inválida" @@ -292,7 +310,7 @@ msgstr "Portal do Software Público Brasileiro" msgid "Break" msgstr "Break" -#: telnet.c:2114 +#: telnet.c:2003 msgid "Broken pipe" msgstr "Conexão interrompida" @@ -326,7 +344,7 @@ msgstr "C_odificação de caracteres:" msgid "C_olor scheme:" msgstr "Tema de c_ores:" -#: toggles.c:177 telnet.c:670 +#: toggles.c:177 telnet.c:645 connect.c:386 connect.c:438 #, c-format msgid "Can't %s network keep-alive" msgstr "Can't %s network keep-alive" @@ -336,11 +354,16 @@ msgstr "Can't %s network keep-alive" msgid "Can't accept unnamed %s" msgstr "Não posso aceitar elemento %s sem nome" -#: telnet.c:684 +#: telnet.c:659 #, c-format msgid "Can't connect to %s:%d" msgstr "Não foi possível conectar a %s:%d" +#: connect.c:242 connect.c:359 connect.c:410 +#, fuzzy, c-format +msgid "Can't connect to %s:%s" +msgstr "Não foi possível conectar a %s:%d" + #: host.c:154 msgid "Can't connect to host" msgstr "Não foi possível conectar ao servidor" @@ -354,7 +377,12 @@ msgstr "Não foi possível converter a linha %d de %s para %s" msgid "Can't cut rectangular regions" msgstr "Recortar não permitido em seleção retangular" -#: ft.c:308 +#: connect.c:226 +#, c-format +msgid "Can't determine value for environment variable \"%s\" " +msgstr "Can't determine value for environment variable \"%s\" " + +#: ft.c:331 msgid "Can't get file size" msgstr "Não foi possível obter o tamanho do arquivo" @@ -371,7 +399,7 @@ msgstr "Não foi possível carregar arquivo" msgid "Can't open file" msgstr "Não foi possível abrir arquivo" -#: ft.c:216 +#: ft.c:239 msgid "Can't open local file." msgstr "Não foi possível abrir arquivo local." @@ -433,15 +461,25 @@ msgstr "Não foi possível salvar trace no arquivo %s" msgid "Can't set host charset" msgstr "Não foi possível definir o charset do host" -#: v3270/iocallback.c:347 +#: v3270/iocallback.c:359 msgid "Can't set lib3270 I/O handlers" msgstr "Não foi possível registrar manipuladores de I/O 3270" +#: connect.c:570 +#, fuzzy +msgid "Can't set socket to blocking mode." +msgstr "Não foi possível definir o descritor de socket SSL" + +#: connect.c:570 +#, fuzzy +msgid "Can't set socket to non blocking mode" +msgstr "Erro em fcntl(%s) ao ativar o modo não blocante" + #: filetransfer.c:294 msgid "Can't start download." msgstr "Não foi possível iniciar o download." -#: ft.c:171 ft.c:183 ft.c:197 +#: ft.c:194 ft.c:206 ft.c:220 msgid "Can't start file transfer." msgstr "Não foi possível iniciar transferência de arquivo." @@ -449,19 +487,45 @@ msgstr "Não foi possível iniciar transferência de arquivo." msgid "Can't start upload." msgstr "Não foi possível iniciar upload." -#: telnet.c:329 +#: telnet.c:304 connect.c:170 #, c-format msgid "Can't use winsock version %d.%d" msgstr "Não é possível usar a Winsock versão %d.%d" -#: ft.c:124 +#: ft.c:147 msgid "Cancelled by user" msgstr "Cancelado pelo usuário" -#: telnet.c:721 +#: connect.c:324 +#, fuzzy +msgid "Cannot create socket event" +msgstr "Não foi possível criar um manipulador de socket" + +#: telnet.c:696 msgid "Cannot create socket handle" msgstr "Não foi possível criar um manipulador de socket" +#: ssl.c:309 +msgid "Cant create a new SSL structure for current connection." +msgstr "Cant create a new SSL structure for current connection." + +#: ssl.c:250 +#, c-format +msgid "" +"Cant set default locations for trusted CA certificates to\n" +"%s" +msgstr "" +"Cant set default locations for trusted CA certificates to\n" +"%s" + +#: ssl.c:83 +msgid "" +"Cant set the file descriptor for the input/output facility for the TLS/SSL " +"(encrypted) side of ssl." +msgstr "" +"Cant set the file descriptor for the input/output facility for the TLS/SSL " +"(encrypted) side of ssl." + #: v3270/security.c:110 msgid "Certificate has expired" msgstr "O certificado expirou" @@ -518,7 +582,14 @@ msgstr "Command:" msgid "Connect on startup" msgstr "Conectar ao iniciar" -#: telnet.c:2118 +#: connect.c:224 connect.c:263 connect.c:272 connect.c:348 connect.c:363 +#: connect.c:375 connect.c:390 connect.c:414 connect.c:427 connect.c:442 +#: connect.c:540 +#, fuzzy +msgid "Connection error" +msgstr "Erro na conexão SSL" + +#: telnet.c:2007 msgid "Connection reset by peer" msgstr "Conexão foi cancelada pelo servidor" @@ -608,11 +679,11 @@ msgstr "Padrão" msgid "Delete field" msgstr "Apagar campo" -#: telnet.c:1789 +#: telnet.c:1678 msgid "Device type rejected" msgstr "Tipo de dispositivo rejeitado" -#: ft.c:173 +#: ft.c:196 msgid "Disconnected from host." msgstr "Desconectado do servidor." @@ -620,7 +691,7 @@ msgstr "Desconectado do servidor." msgid "Display current charset" msgstr "Mostrar a tabela de caracteres ativa" -#: telnet.c:1364 +#: telnet.c:1230 msgid "EOR received when not in 3270 mode, ignored." msgstr "EOR recebido fora do modo 3270, ignorado." @@ -668,7 +739,7 @@ msgstr "Apagar até o final do campo" msgid "Erase to end of line" msgstr "Apagar até o final da linha" -#: print.c:239 v3270/widget.c:215 util.c:1019 +#: print.c:239 v3270/widget.c:215 util.c:1023 msgid "Error" msgstr "Erro" @@ -687,16 +758,6 @@ msgstr "Erro \"%s\" gravando arquivo local (rc=%d)" msgid "Error %d resolving %s" msgstr "Erro %d resolvendo %s" -#: telnet.c:3146 telnet.c:3157 -#, c-format -msgid "Error in fcntl(%s) when setting non blocking mode" -msgstr "Erro em fcntl(%s) ao ativar o modo não blocante" - -#: telnet.c:3136 -#, c-format -msgid "Error in ioctl(%s) when setting no blocking mode" -msgstr "Erro em ioctl(%s) ao ativar o modo não blocante" - #: dialog.c:377 #, c-format msgid "Error loading %s" @@ -719,7 +780,7 @@ msgstr "Script rexx externo" msgid "Field colors" msgstr "Cor dos campos" -#: ft.c:185 +#: ft.c:208 msgid "File transfer is already active in this session." msgstr "Transferência de arquivos já está ativa nesta sessão." @@ -812,11 +873,11 @@ msgstr "HTTP Proxy: Resposta desconhecida" msgid "Help" msgstr "Ajuda" -#: ft.c:534 +#: ft.c:562 msgid "Host disconnected, transfer cancelled" msgstr "Servidor desconectou, transferência cancelada" -#: telnet.c:1847 +#: telnet.c:1736 msgid "Host illegally added function(s)" msgstr "Host illegally added function(s)" @@ -828,11 +889,11 @@ msgstr "Servidor é AS/400" msgid "Host is TSO" msgstr "Servidor é TSO" -#: telnet.c:1772 +#: telnet.c:1661 msgid "Host rejected device type or request type" msgstr "Servidor rejeitou o tipo de dispositivo ou requisição" -#: telnet.c:1785 +#: telnet.c:1674 msgid "Host rejected resource(s)" msgstr "Servidor rejeitou recurso(s)" @@ -979,7 +1040,8 @@ msgstr "Nome do arquivo destino." msgid "Network Trace" msgstr "Trace do tráfego de rede" -#: telnet.c:360 telnet.c:688 +#: telnet.c:335 telnet.c:663 iocalls.c:428 iocalls.c:520 connect.c:86 +#: connect.c:101 msgid "Network error" msgstr "Erro de rede" @@ -987,7 +1049,8 @@ msgstr "Erro de rede" msgid "Network keep alive" msgstr "Network keep alive" -#: telnet.c:316 telnet.c:327 telnet.c:720 telnet.c:731 +#: telnet.c:291 telnet.c:302 telnet.c:695 telnet.c:706 connect.c:157 +#: connect.c:168 connect.c:323 connect.c:334 msgid "Network startup error" msgstr "Erro ao iniciar a rede" @@ -1003,6 +1066,11 @@ msgstr "" "Nenhuma assinatura pode ser verificada, porque a cadeia contém apenas um " "certificado e não é auto assinado." +#: ft.c:97 +#, fuzzy +msgid "No transfer in progress" +msgstr "Erro na transferência de arquivos" + #: colors.c:454 msgid "Normal/Protected" msgstr "Normal/Protegido" @@ -1015,7 +1083,7 @@ msgstr "Normal/Desprotegido" msgid "Not available" msgstr "Não disponível" -#: ft.c:541 +#: ft.c:569 msgid "Not in 3270 mode, transfer cancelled" msgstr "Não está no modo 3270, transferência cancelada" @@ -1402,7 +1470,7 @@ msgstr "" msgid "Remove selection" msgstr "Remover seleção" -#: filetransfer.c:293 filetransfer.c:338 ft.c:170 ft.c:182 ft.c:196 ft.c:215 +#: filetransfer.c:293 filetransfer.c:338 ft.c:193 ft.c:205 ft.c:219 ft.c:238 msgid "Request failed" msgstr "Requisição falhou" @@ -1546,31 +1614,32 @@ msgstr "SOCKS5 Proxy: xmit version 5 nmethods 1 (no auth)\n" msgid "SOCKS5 proxy: %s/%u: %s" msgstr "SOCKS5 proxy: %s/%u: %s" -#: telnet.c:1156 +#: ssl.c:107 +#, fuzzy +msgid "SSL Connect failed" +msgstr "Conexão SSL falhou" + +#: telnet.c:1022 msgid "SSL Error" msgstr "Erro SSL" -#: telnet.c:1156 +#: telnet.c:1022 msgid "SSL Read error" msgstr "Erro de leitura SSL" -#: telnet.c:846 telnet.c:860 -msgid "SSL connect failed!" -msgstr "Conexão SSL falhou" - #: host.c:140 msgid "SSL error" msgstr "Erro SSL" -#: telnet.c:819 -msgid "SSL init failed!" -msgstr "Inicialização SSL falhou" +#: ssl.c:82 +msgid "SSL negotiation failed" +msgstr "Negociação SSL falhou" -#: telnet.c:828 -msgid "SSL_set_fd failed!" -msgstr "SSL_set_fd falhou!" +#: ssl.c:217 +msgid "SSL_CTX_new() has failed" +msgstr "SSL_CTX_new() has failed" -#: telnet.c:2104 +#: telnet.c:1993 #, c-format msgid "" "SSL_write:\n" @@ -1635,6 +1704,11 @@ msgstr "Secondary space:" msgid "Secure connection was successful." msgstr "Conexão segura efetuada com sucesso." +#: ssl.c:81 ssl.c:106 ssl.c:216 ssl.c:255 ssl.c:308 +#, fuzzy +msgid "Security error" +msgstr "Erro ao enviar dados para a rede" + #: ui/00default.xml:264 msgid "Select Field" msgstr "Selecionar campo" @@ -1667,6 +1741,11 @@ msgstr "Selecione fonte" msgid "Select hostname" msgstr "Selecione host" +#: iocalls.c:521 +#, fuzzy +msgid "Select() failed when processing for events." +msgstr "select() falhou ao processar eventos" + #: colors.c:457 msgid "Selection background" msgstr "Fundo da seleção" @@ -1747,11 +1826,16 @@ msgstr "Mostrar padrão de teste" msgid "Smart paste" msgstr "Colar inteligente" -#: telnet.c:1177 +#: connect.c:552 connect.c:569 +#, fuzzy +msgid "Socket error" +msgstr "Erro ao ler dados da rede" + +#: telnet.c:1043 msgid "Socket read error" msgstr "Erro ao ler dados da rede" -#: telnet.c:2125 +#: telnet.c:2014 msgid "Socket write error" msgstr "Erro ao enviar dados para a rede" @@ -1821,7 +1905,7 @@ msgstr "Tipo de servidor:" msgid "TELNET Proxy: send error" msgstr "TELNET Proxy: Erro ao enviar" -#: telnet.c:3343 +#: telnet.c:1503 msgid "TLS negotiation failure" msgstr "Negociação TLS falhou" @@ -1999,7 +2083,7 @@ msgid "" msgstr "" "The public key in the certificate SubjectPublicKeyInfo could not be read." -#: ft.c:199 +#: ft.c:222 msgid "The remote file name is invalid." msgstr "O nome do arquivo remoto não é válido." @@ -2101,7 +2185,7 @@ msgstr "Transferência cancelada pelo servidor" msgid "Transfer cancelled by user" msgstr "Transferência cancelada pelo usuário" -#: ft_cut.c:334 +#: ft.c:477 ft_cut.c:334 msgid "Transfer complete" msgstr "Transferência completa" @@ -2125,6 +2209,11 @@ msgstr "UTF-8" msgid "Uknown DFT Open type from host" msgstr "Host enviou código de abertura DFT desconhecido" +#: connect.c:102 +#, fuzzy +msgid "Unable to connect to host." +msgstr "Não é possível conectar em servidores seguros" + #: host.c:141 msgid "Unable to connect to secure hosts" msgstr "Não é possível conectar em servidores seguros" @@ -2142,10 +2231,20 @@ msgstr "" msgid "Unable to decrypt certificate's signature" msgstr "Incapaz de decifrar a assinatura do certificado" +#: connect.c:225 +#, fuzzy +msgid "Unable to find selected hostname." +msgstr "Não é possível conectar em servidores seguros" + #: v3270/security.c:61 msgid "Unable to get certificate CRL" msgstr "Unable to get certificate CRL" +#: connect.c:87 +#, fuzzy +msgid "Unable to get connection state." +msgstr "Unable to get certificate CRL" + #: v3270/security.c:54 msgid "Unable to get issuer certificate" msgstr "Não foi possível obter emissor do certificado" @@ -2158,7 +2257,7 @@ msgstr "Unable to get local issuer certificate" msgid "Unable to paste text" msgstr "Incapaz de colar texto" -#: ft.c:401 +#: ft.c:424 msgid "Unable to send file-transfer request" msgstr "Não foi possível enviar a requisição de transferência de arquivo" @@ -2248,12 +2347,12 @@ msgstr "Unknown 3270 Data Stream command: 0x%X" msgid "Unknown FT control code from host" msgstr "Servidor enviou código de controle FT desconhecido" -#: kybd.c:2443 +#: kybd.c:2430 #, c-format msgid "Unknown PA key %d" msgstr "PA %d desconhecida" -#: kybd.c:2458 +#: kybd.c:2445 #, c-format msgid "Unknown PF key %d" msgstr "PF %d desconhecida" @@ -2271,7 +2370,7 @@ msgstr "" "Servidor desconhecido:\n" "%s" -#: telnet.c:551 +#: telnet.c:526 #, c-format msgid "Unknown passthru host: %s" msgstr "Servidor \"passthru\" desconhecido: %s" @@ -2281,7 +2380,7 @@ msgstr "Servidor \"passthru\" desconhecido: %s" msgid "Unknown popup type \"%s\"" msgstr "Tipo de popup \"%s\" não é conhecido" -#: telnet.c:580 resolver.c:147 +#: telnet.c:555 resolver.c:147 #, c-format msgid "Unknown port number or service: %s" msgstr "Número de porta ou serviço desconhecido: %s" @@ -2294,7 +2393,7 @@ msgstr "Unsupported RPQ term" msgid "Unsupported certificate purpose" msgstr "Finalidade do certificado não é suportada" -#: telnet.c:536 +#: telnet.c:511 msgid "Unsupported passthru host session" msgstr "Unsupported passthru host session" @@ -2323,19 +2422,24 @@ msgstr "Versão %s - Revisão %s" msgid "View Field Delimiters" msgstr "Mostrar delimitadores de campo" -#: telnet.c:732 +#: telnet.c:707 connect.c:335 msgid "WSAEventSelect failed" msgstr "WSAEventSelect falhou" -#: telnet.c:317 +#: telnet.c:292 connect.c:158 msgid "WSAStartup failed" msgstr "WSAStartup falhou" -#: ft.c:410 +#: iocalls.c:429 +#, fuzzy +msgid "WaitForMultipleObjects() failed when processing for events." +msgstr "select() falhou ao processar eventos" + +#: ft.c:433 msgid "Waiting for GET response" msgstr "Aguardando resposta do pedido de download" -#: ft.c:412 +#: ft.c:435 msgid "Waiting for PUT response" msgstr "Aguardando resposta do pedido de upload" @@ -2359,6 +2463,11 @@ msgstr "Janela" msgid "Windows Western languages (CP1252)" msgstr "Windows ocidental (CP1252)" +#: util.c:159 +#, fuzzy, c-format +msgid "Windows error %d" +msgstr "Erro desconhecido" + #: v3270/oia.c:424 v3270/oia.c:448 v3270/oia.c:452 msgid "X" msgstr "X" @@ -2520,24 +2629,32 @@ msgstr "um atributo \"action\"" msgid "bracket" msgstr "bracket" -#: toggles.c:177 telnet.c:670 +#: toggles.c:177 telnet.c:645 connect.c:386 connect.c:438 msgid "disable" msgstr "desabilitar" -#: toggles.c:177 telnet.c:670 +#: toggles.c:177 telnet.c:645 connect.c:386 connect.c:438 msgid "enable" msgstr "enable" -#: iocalls.c:450 -msgid "select() failed when dispatching events" -msgstr "select() falhou ao processar eventos" +#: connect.c:553 +msgid "fcntl() error when getting socket state." +msgstr "fcntl() error when getting socket state." -#: telnet.c:631 telnet.c:638 +#: connect.c:349 connect.c:541 +msgid "ioctlsocket(FIONBIO) failed." +msgstr "ioctlsocket(FIONBIO) failed." + +#: telnet.c:606 telnet.c:613 #, c-format msgid "setsockopt(%s)" msgstr "setsockopt(%s)" -#: telnet.c:624 +#: connect.c:376 connect.c:428 +msgid "setsockopt(SO_OOBINLINE) has failed" +msgstr "setsockopt(SO_OOBINLINE) has failed" + +#: telnet.c:599 msgid "socket" msgstr "socket" @@ -2545,10 +2662,19 @@ msgstr "socket" msgid "translator-credits" msgstr "translator-credits" -#: telnet.c:1152 +#: telnet.c:1018 msgid "unknown error" msgstr "Erro desconhecido" +#~ msgid "Error in ioctl(%s) when setting no blocking mode" +#~ msgstr "Erro em ioctl(%s) ao ativar o modo não blocante" + +#~ msgid "SSL init failed!" +#~ msgstr "Inicialização SSL falhou" + +#~ msgid "SSL_set_fd failed!" +#~ msgstr "SSL_set_fd falhou!" + #~ msgid "Add _CR at end of line." #~ msgstr "Adicionar/Remover _CR no final da linha." @@ -2587,9 +2713,6 @@ msgstr "Erro desconhecido" #~ msgid "File transfer" #~ msgstr "Transferência de arquivos" -#~ msgid "File transfer error" -#~ msgstr "Erro na transferência de arquivos" - #~ msgid "LRECL:" #~ msgstr "LRECL:" @@ -2672,12 +2795,6 @@ msgstr "Erro desconhecido" #~ "Unexpected SSL status %ld\n" #~ "Security status is undefined" -#~ msgid "SSL Connect error" -#~ msgstr "Erro na conexão SSL" - -#~ msgid "Can't set SSL socket file descriptor" -#~ msgstr "Não foi possível definir o descritor de socket SSL" - #~ msgid "Connection failed" #~ msgstr "Conexão falhou" @@ -2688,9 +2805,6 @@ msgstr "Erro desconhecido" #~ "Quanto ativo o pw3270 response à uma consulta \"color\" com uma lista de " #~ "apenas 8 cores." -#~ msgid "SSL negotiation failed" -#~ msgstr "Negociação SSL falhou" - #~ msgid "Copiar tudo" #~ msgstr "Copiar tudo" diff --git a/src/include/lib3270.h b/src/include/lib3270.h index 82e99f9..6b7a1c4 100644 --- a/src/include/lib3270.h +++ b/src/include/lib3270.h @@ -401,12 +401,12 @@ * Set host id for the connect/reconnect operations. * * @param h Session handle. - * @param n Host ID to set. + * @param url URL of host to set in the format tn3270://hostname:service ou tn3270s://hostname:service . * - * @return Pointer to host id set (internal data, do not change it) + * @return Processed host url * */ - LIB3270_EXPORT const char * lib3270_set_host(H3270 *h, const char *n); + LIB3270_EXPORT const char * lib3270_set_host(H3270 *h, const char *url); /** * Get host id for the connect/reconnect operations. @@ -1040,6 +1040,7 @@ LIB3270_EXPORT const char * lib3270_get_revision(void); LIB3270_EXPORT char * lib3270_vsprintf(const char *fmt, va_list args); + LIB3270_EXPORT char * lib3270_strdup_printf(const char *fmt, ...); LIB3270_EXPORT int lib3270_clear_operator_error(H3270 *hSession); diff --git a/src/include/lib3270/session.h b/src/include/lib3270/session.h index 00e9343..e04830a 100644 --- a/src/include/lib3270/session.h +++ b/src/include/lib3270/session.h @@ -129,7 +129,7 @@ } toggle[LIB3270_TOGGLE_COUNT]; // Network & Termtype - char * hostname; +// char * hostname; char * connected_type; char * connected_lu; char luname[LIB3270_LUNAME_LENGTH+1]; @@ -139,9 +139,15 @@ int model_num; char * termtype; - char * current_host; /**< the hostname part, stripped of qualifiers, luname and port number */ - char * full_current_host; /**< the entire string, for use in reconnecting */ - char * qualified_host; + struct + { + LIB3270_CONNECT_OPTION opt; /**< Connect options */ + char * current; /**< The hostname part, stripped of qualifiers, luname and port number */ + char * full; /**< The entire string, for use in reconnecting */ + char * srvc; /**< The service name */ + char * qualified; + } host; + char * proxy; /**< Proxy server (type:host[:port]) */ char * termname; diff --git a/src/include/pw3270.h b/src/include/pw3270.h index 567d2ce..0d93cfc 100644 --- a/src/include/pw3270.h +++ b/src/include/pw3270.h @@ -52,7 +52,7 @@ LIB3270_EXPORT GtkWidget * pw3270_new(const gchar *host, const gchar *systype, unsigned short colors); - LIB3270_EXPORT void pw3270_set_host(GtkWidget *widget, const gchar *uri); + LIB3270_EXPORT const gchar * pw3270_set_host(GtkWidget *widget, const gchar *uri); LIB3270_EXPORT const gchar * pw3270_get_host(GtkWidget *widget); LIB3270_EXPORT void pw3270_connect_host(GtkWidget *widget, const gchar *uri); diff --git a/src/include/pw3270/v3270.h b/src/include/pw3270/v3270.h index b6fbc84..447253e 100644 --- a/src/include/pw3270/v3270.h +++ b/src/include/pw3270/v3270.h @@ -213,7 +213,7 @@ LIB3270_EXPORT void v3270_set_scaled_fonts(GtkWidget *widget, gboolean on); LIB3270_EXPORT void v3270_set_session_options(GtkWidget *widget, LIB3270_OPTION options); LIB3270_EXPORT int v3270_set_session_color_type(GtkWidget *widget, unsigned short colortype); - LIB3270_EXPORT void v3270_set_host(GtkWidget *widget, const gchar *uri); + LIB3270_EXPORT const gchar * v3270_set_host(GtkWidget *widget, const gchar *uri); LIB3270_EXPORT const gchar * v3270_get_host(GtkWidget *widget); LIB3270_EXPORT GtkWidget * v3270_get_default_widget(void); diff --git a/src/lib3270/connect.c b/src/lib3270/connect.c index 3948b2c..f98bc1d 100644 --- a/src/lib3270/connect.c +++ b/src/lib3270/connect.c @@ -201,6 +201,19 @@ static void net_connected(H3270 *hSession) sockstart(hSession); #endif + hSession->host.opt = opt; + Replace(hSession->host.current,strdup(hostname)); + + Replace(hSession->host.full, + lib3270_strdup_printf( + "%s%s:%s", + opt&LIB3270_CONNECT_OPTION_SSL ? "L:" : "", + hostname, + srvc )); + + trace("current_host=\"%s\"",hSession->host.current); + + set_ssl_state(hSession,LIB3270_SSL_UNSECURE); hSession->ever_3270 = False; @@ -231,7 +244,8 @@ static void net_connected(H3270 *hSession) hostname = name; } - status_changed(hSession,LIB3270_STATUS_RESOLVING); + hSession->cstate = LIB3270_RESOLVING; + lib3270_st_changed(hSession, LIB3270_STATE_RESOLVING, True); s = getaddrinfo(hostname, srvc, &hints, &result); @@ -286,15 +300,25 @@ static void net_connected(H3270 *hSession) (void) fcntl(hSession->sock, F_SETFD, 1); #endif - hSession->ssl_host = 0; + hSession->ever_3270 = False; + hSession->ssl_host = 0; -#if defined(HAVE_LIBSSL) if(opt&LIB3270_CONNECT_OPTION_SSL) { +#if defined(HAVE_LIBSSL) hSession->ssl_host = 1; ssl_init(hSession); +#else + lib3270_popup_dialog( hSession, + LIB3270_NOTIFY_ERROR, + _( "SSL error" ), + _( "Unable to connect to secure hosts" ), + _( "This version of %s was built without support for secure sockets layer (SSL)." ), + PACKAGE_NAME)); + + return EINVAL; +#endif // HAVE_LIBSSL } -#endif /* connect */ status_connecting(hSession,1); diff --git a/src/lib3270/host.c b/src/lib3270/host.c index a970cb6..3e03990 100644 --- a/src/lib3270/host.c +++ b/src/lib3270/host.c @@ -38,6 +38,7 @@ * connection. */ +#include #include "globals.h" // #include "appres.h" #include "resources.h" @@ -64,7 +65,7 @@ static void try_reconnect(H3270 *session); * Returns the hostname part in a newly-malloc'd string. * 'needed' is returned True if anything was actually stripped. * Returns NULL if there is a syntax error. - */ + */ /* static char * split_host(H3270 *hSession, char *s, char *ansi, char *std_ds, char *passthru, char *non_e, char *secure, char *no_login, char *xluname, @@ -85,18 +86,18 @@ split_host(H3270 *hSession, char *s, char *ansi, char *std_ds, char *passthru, *needed = False; - /* - * Hostname syntax is: - * Zero or more optional prefixes (A:, S:, P:, N:, L:, C:). - * An optional LU name separated by '@'. - * A hostname optionally in square brackets (which quote any colons - * in the name). - * An optional port name or number separated from the hostname by a - * space or colon. - * No additional white space or colons are allowed. - */ - - /* Strip leading whitespace. */ + // + // Hostname syntax is: + // Zero or more optional prefixes (A:, S:, P:, N:, L:, C:). + // An optional LU name separated by '@'. + // A hostname optionally in square brackets (which quote any colons + // in the name). + // An optional port name or number separated from the hostname by a + // space or colon. + // No additional white space or colons are allowed. + // + + // Strip leading whitespace. while (*s && isspace(*s)) s++; @@ -106,11 +107,11 @@ split_host(H3270 *hSession, char *s, char *ansi, char *std_ds, char *passthru, goto split_fail; } - /* Strip trailing whitespace. */ + // Strip trailing whitespace. while (isspace(*(s + strlen(s) - 1))) *(s + strlen(s) - 1) = '\0'; - /* Start with the prefixes. */ + // Start with the prefixes. while (*s && *(s + 1) && isalpha(*s) && *(s + 1) == ':') { switch (*s) { case 'a': @@ -160,12 +161,12 @@ split_host(H3270 *hSession, char *s, char *ansi, char *std_ds, char *passthru, *needed = True; s += 2; - /* Allow whitespace around the prefixes. */ + // Allow whitespace around the prefixes. while (*s && isspace(*s)) s++; } - /* Process the LU name. */ + // Process the LU name. lbracket = strchr(s, '['); at = strchr(s, '@'); if (at != CN && lbracket != CN && at > lbracket) @@ -203,15 +204,15 @@ split_host(H3270 *hSession, char *s, char *ansi, char *std_ds, char *passthru, *needed = True; } - /* - * Isolate the hostname. - * At this point, we've found its start, so we can malloc the buffer - * that will hold the copy. - */ + // + // Isolate the hostname. + // At this point, we've found its start, so we can malloc the buffer + // that will hold the copy. + /// if (lbracket != CN) { char *rbracket; - /* Check for junk before the '['. */ + // Check for junk before the '['. if (lbracket != s) { popup_system_error(hSession,NULL,_("Hostname syntax error"),"%s",_("Text before '['")); goto split_fail; @@ -219,10 +220,10 @@ split_host(H3270 *hSession, char *s, char *ansi, char *std_ds, char *passthru, s = r = NewString(lbracket + 1); - /* - * Take whatever is inside square brackets, including - * whitespace, unmodified -- except for empty strings. - */ + // + // Take whatever is inside square brackets, including + // whitespace, unmodified -- except for empty strings. + // rbracket = strchr(s, ']'); if (rbracket == CN) { popup_system_error(hSession,NULL,_("Hostname syntax error"),"%s",_("Missing ']'")); @@ -234,7 +235,7 @@ split_host(H3270 *hSession, char *s, char *ansi, char *std_ds, char *passthru, } *rbracket = '\0'; - /* Skip over any whitespace after the bracketed name. */ + // Skip over any whitespace after the bracketed name. s = rbracket + 1; while (*s && isspace(*s)) s++; @@ -244,7 +245,7 @@ split_host(H3270 *hSession, char *s, char *ansi, char *std_ds, char *passthru, } else { char *name_end; - /* Check for an empty string. */ + // Check for an empty string. if (!*s || *s == ':') { popup_an_error(hSession,"Empty hostname"); goto split_fail; @@ -252,19 +253,19 @@ split_host(H3270 *hSession, char *s, char *ansi, char *std_ds, char *passthru, s = r = NewString(s); - /* Find the end of the hostname. */ + // Find the end of the hostname. while (*s && !isspace(*s) && *s != ':') s++; name_end = s; - /* If the terminator is whitespace, skip the rest of it. */ + // If the terminator is whitespace, skip the rest of it. while (*s && isspace(*s)) s++; - /* - * If there's nothing but whitespace (or nothing) after the - * name, we're done. - */ + // + // If there's nothing but whitespace (or nothing) after the + // name, we're done. + // if (*s == '\0') { *name_end = '\0'; goto split_success; @@ -273,10 +274,10 @@ split_host(H3270 *hSession, char *s, char *ansi, char *std_ds, char *passthru, *name_end = '\0'; } - /* - * If 'colon' is set, 's' points at it (or where it was). Skip - * it and any whitespace that follows. - */ + // + // If 'colon' is set, 's' points at it (or where it was). Skip + // it and any whitespace that follows. + // if (colon) { s++; while (*s && isspace(*s)) @@ -287,11 +288,11 @@ split_host(H3270 *hSession, char *s, char *ansi, char *std_ds, char *passthru, } } - /* - * Set the portname and find its end. - * Note that trailing spaces were already stripped, so the end of the - * portname must be a NULL. - */ + // + // Set the portname and find its end. + // Note that trailing spaces were already stripped, so the end of the + // portname must be a NULL. + // *port = s; *needed = True; while (*s && !isspace(*s) && *s != ':') @@ -309,23 +310,25 @@ split_fail: split_success: return r; } +*/ -static int do_connect(H3270 *hSession, const char *n) +static int do_connect(H3270 *hSession) { - char nb[2048]; /* name buffer */ - char *s; /* temporary */ - char *chost = NULL; /* to whom we will connect */ +// char nb[2048]; // name buffer +// char *s; // temporary + char *chost = NULL; // to whom we will connect // char *ps = CN; - char *port = CN; +// char *port = CN; Boolean resolving; Boolean pending; - static Boolean ansi_host; - Boolean has_colons = False; +// static Boolean ansi_host; +// Boolean has_colons = False; if (lib3270_connected(hSession) || hSession->auto_reconnect_inprogress) return EBUSY; - /* Skip leading blanks. */ + /* + // Skip leading blanks. while (*n == ' ') n++; @@ -334,22 +337,26 @@ static int do_connect(H3270 *hSession, const char *n) popup_an_error(hSession,_( "Invalid (empty) hostname" )); return -1; } + */ - /* Save in a modifiable buffer. */ + /* + // Save in a modifiable buffer. (void) strncpy(nb, n, 2047); - /* Strip trailing blanks. */ + // Strip trailing blanks. s = nb + strlen(nb) - 1; while (*s == ' ') *s-- = '\0'; + */ /* Remember this hostname, as the last hostname we connected to. */ - lib3270_set_host(hSession,nb); + // lib3270_set_host(hSession,nb); + /* { Boolean needed; - /* Strip off and remember leading qualifiers. */ + // Strip off and remember leading qualifiers. if ((s = split_host(hSession, nb, &ansi_host, &hSession->std_ds_host, &hSession->passthru_host, &hSession->non_tn3270e_host, &hSession->ssl_host, &hSession->no_login_host, hSession->luname, &port, @@ -358,35 +365,52 @@ static int do_connect(H3270 *hSession, const char *n) chost = s; - /* Default the port. */ + // Default the port. if (port == CN) port = "telnet"; } - /* - * Store the original name in globals, even if we fail the connect - * later: - * current_host is the hostname part, stripped of qualifiers, luname - * and port number - * full_current_host is the entire string, for use in reconnecting - */ - Replace(hSession->current_host, CN); + // + // Store the original name in globals, even if we fail the connect + // later: + // current_host is the hostname part, stripped of qualifiers, luname + // and port number + // full_current_host is the entire string, for use in reconnecting + // + // + // Replace(hSession->current_host, CN); has_colons = (strchr(chost, ':') != NULL); - Replace(hSession->qualified_host, + Replace(hSession->host.qualified, xs_buffer("%s%s%s%s:%s", hSession->ssl_host? "L:": "", has_colons? "[": "", chost, has_colons? "]": "", port)); - + */ /* Attempt contact. */ hSession->ever_3270 = False; + hSession->ssl_host = 0; - if(net_connect(hSession, chost, port, 0, &resolving,&pending) != 0 && !resolving) + if(hSession->host.opt&LIB3270_CONNECT_OPTION_SSL) + { +#if defined(HAVE_LIBSSL) + hSession->ssl_host = 1; + ssl_init(hSession); +#else + popup_system_error(hSession, _( "SSL error" ), + _( "Unable to connect to secure hosts" ), + _( "This version of %s was built without support for secure sockets layer (SSL)." ), + PACKAGE_NAME + ); +#endif + } + + trace("Conneting to hostname=[%s] service=[%s]",hSession->host.current, hSession->host.srvc); + if(net_connect(hSession, hSession->host.current, hSession->host.srvc, 0, &resolving,&pending) != 0 && !resolving) { /* Redundantly signal a disconnect. */ lib3270_set_disconnected(hSession); @@ -457,14 +481,13 @@ int lib3270_connect(H3270 *hSession, const char *n, int wait) if(PCONNECTED) return EBUSY; - if(!n) - { - n = hSession->full_current_host; - if(!n) - return EINVAL; - } + if(n) + lib3270_set_host(hSession,n); - rc = do_connect(hSession,n); + if(!hSession->host.full) + return EINVAL; + + rc = do_connect(hSession); if(rc) return rc; @@ -489,7 +512,7 @@ int lib3270_connect(H3270 *hSession, const char *n, int wait) */ static void try_reconnect(H3270 *session) { - lib3270_write_log(session,"3270","Starting auto-reconnect (Host: %s)",session->full_current_host ? session->full_current_host : "-"); + lib3270_write_log(session,"3270","Starting auto-reconnect (Host: %s)",session->host.full ? session->host.full : "-"); session->auto_reconnect_inprogress = 0; lib3270_reconnect(session,0); } @@ -626,26 +649,88 @@ LIB3270_EXPORT const char * lib3270_set_host(H3270 *h, const char *n) { CHECK_SESSION_HANDLE(h); - if(n && n != h->full_current_host) + if(n && n != h->host.full) { - char *new_hostname = strdup(n); + static const struct _sch + { + LIB3270_CONNECT_OPTION opt; + const char * text; + const char * srvc; + } sch[] = + { + { LIB3270_CONNECT_OPTION_DEFAULTS, "tn3270://", "telnet" }, + { LIB3270_CONNECT_OPTION_SSL, "tn3270s://", "telnets" }, + { LIB3270_CONNECT_OPTION_DEFAULTS, "telnet://", "telnet" }, + { LIB3270_CONNECT_OPTION_DEFAULTS, "telnets://", "telnets" }, + { LIB3270_CONNECT_OPTION_SSL, "L://", "telnets" }, + + { LIB3270_CONNECT_OPTION_SSL, "L:", "telnets" } // The compatibility should be the last option + }; + + char * str = strdup(n); + char * hostname = str; + const char * srvc = "telnet"; + char * ptr; + char * query = ""; + int f; + + trace("%s(%s)",__FUNCTION__,str); + h->host.opt = LIB3270_CONNECT_OPTION_DEFAULTS; + + for(f=0;f < sizeof(sch)/sizeof(sch[0]);f++) + { + size_t sz = strlen(sch[f].text); + if(!strncasecmp(hostname,sch[f].text,sz)) + { + h->host.opt = sch[f].opt; + srvc = sch[f].srvc; + hostname += sz; + break; + } + } - trace("new hostname is \"%s\"",new_hostname); + trace("SRVC=[%s]",srvc); - if(h->full_current_host) - lib3270_free(h->full_current_host); + if(!*hostname) + return h->host.current; - h->full_current_host = new_hostname; + ptr = strchr(hostname,':'); + if(ptr) + { + *(ptr++) = 0; + srvc = ptr; + query = strchr(ptr,'?'); + + trace("QUERY=[%s]",query); + + if(query) + *(query++) = 0; + else + query = ""; + } + Replace(h->host.current,strdup(hostname)); + Replace(h->host.srvc,strdup(srvc)); + Replace(h->host.full, + lib3270_strdup_printf( + "%s%s:%s%s%s", + h->host.opt&LIB3270_CONNECT_OPTION_SSL ? "L:" : "", + hostname, + srvc, + *query ? "?" : "", + query + )); + + free(str); } - return h->full_current_host; + return h->host.current; } LIB3270_EXPORT const char * lib3270_get_host(H3270 *h) { CHECK_SESSION_HANDLE(h); - return h->full_current_host; + return h->host.full; } LIB3270_EXPORT int lib3270_reconnect(H3270 *hSession,int wait) @@ -657,13 +742,13 @@ LIB3270_EXPORT int lib3270_reconnect(H3270 *hSession,int wait) if (CONNECTED || HALF_CONNECTED) return EBUSY; - if (hSession->full_current_host == CN) + if (hSession->host.full == CN) return EINVAL; if (hSession->auto_reconnect_inprogress) return EBUSY; - rc = lib3270_connect(hSession,hSession->full_current_host,wait); + rc = lib3270_connect(hSession,hSession->host.full,wait); if(rc) { diff --git a/src/lib3270/session.c b/src/lib3270/session.c index 0a2bb08..ec16fdd 100644 --- a/src/lib3270/session.c +++ b/src/lib3270/session.c @@ -99,6 +99,13 @@ void lib3270_session_free(H3270 *h) if(h == default_session) default_session = NULL; + + // Release hostname info + release_pointer(h->host.current); + release_pointer(h->host.full); + release_pointer(h->host.srvc); + release_pointer(h->host.qualified); + lib3270_free(h); } diff --git a/src/lib3270/telnet.c b/src/lib3270/telnet.c index 3d29a86..4542973 100644 --- a/src/lib3270/telnet.c +++ b/src/lib3270/telnet.c @@ -501,7 +501,7 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo *resolving = False; *pending = False; - Replace(session->hostname, NewString(host)); +// Replace(session->hostname, NewString(host)); /* get the passthru host and port number */ if (session->passthru_host) @@ -656,7 +656,7 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo } else { - char *msg = xs_buffer( _( "Can't connect to %s:%d" ), session->hostname, session->current_port); + char *msg = xs_buffer( _( "Can't connect to %s" ), session->host.current); lib3270_popup_dialog( session, LIB3270_NOTIFY_ERROR, @@ -778,9 +778,10 @@ static void setup_lus(H3270 *hSession) static int net_connected(H3270 *hSession) { + /* if(hSession->proxy_type > 0) { - /* Negotiate with the proxy. */ + // Negotiate with the proxy. trace_dsn(hSession,"Connected to proxy server %s, port %u.\n",hSession->proxy_host, hSession->proxy_port); if (proxy_negotiate(hSession, hSession->proxy_type, hSession->sock, hSession->hostname,hSession->current_port) < 0) @@ -789,8 +790,9 @@ static int net_connected(H3270 *hSession) return -1; } } + */ - trace_dsn(hSession,"Connected to %s, port %u%s.\n", hSession->hostname, hSession->current_port,hSession->ssl_host? " via SSL": ""); + trace_dsn(hSession,"Connected to %s%s.\n", hSession->host.current,hSession->ssl_host? " using SSL": ""); #if defined(HAVE_LIBSSL) /* Set up SSL. */ @@ -847,6 +849,7 @@ LIB3270_EXPORT void lib3270_setup_session(H3270 *hSession) check_linemode(hSession,True); /* write out the passthru hostname and port nubmer */ + /* if (hSession->passthru_host) { unsigned char *buffer = (unsigned char *) xs_buffer("%s %d\r\n", hSession->hostname, hSession->current_port); @@ -854,6 +857,7 @@ LIB3270_EXPORT void lib3270_setup_session(H3270 *hSession) lib3270_free(buffer); trace_ds(hSession,"SENT HOSTNAME %s:%d\n", hSession->hostname, hSession->current_port); } + */ } /** @@ -1036,7 +1040,7 @@ void net_input(H3270 *hSession) if (HALF_CONNECTED) { - popup_a_sockerr(hSession, N_( "%s:%d" ),hSession->hostname, hSession->current_port); + popup_a_sockerr(hSession, N_( "%s" ),hSession->host.current); } else if (socket_errno() != SE_ECONNRESET) { diff --git a/src/lib3270/testprogram.c b/src/lib3270/testprogram.c index a0bebd9..dc7effc 100644 --- a/src/lib3270/testprogram.c +++ b/src/lib3270/testprogram.c @@ -22,7 +22,7 @@ static void * mainloop(void *dunno) int main(int numpar, char *param[]) { H3270 * h; - int rc; + int rc = 0; // char line[4096]; // pthread_t thread; @@ -37,7 +37,10 @@ int main(int numpar, char *param[]) // pthread_detach(thread); // rc = lib3270_connect_host(h, "fandezhi.efglobe.com", "telnet", LIB3270_CONNECT_OPTION_WAIT); - rc = lib3270_connect_host(h, "127.0.0.1", "9090", LIB3270_CONNECT_OPTION_WAIT); +// rc = lib3270_connect_host(h, "127.0.0.1", "9090", LIB3270_CONNECT_OPTION_WAIT); + +// lib3270_set_host_url(h,"tn3270://fandezhi.efglobe.com:9090?lu=default"); + lib3270_set_host(h,"tn3270://fandezhi.efglobe.com"); printf("\nConnect exits with rc=%d\n",rc); diff --git a/src/lib3270/util.c b/src/lib3270/util.c index cbfa54d..3e142c3 100644 --- a/src/lib3270/util.c +++ b/src/lib3270/util.c @@ -237,6 +237,17 @@ char * lib3270_vsprintf(const char *fmt, va_list args) #endif /*]*/ } +LIB3270_EXPORT char * lib3270_strdup_printf(const char *fmt, ...) +{ + va_list args; + char *r; + + va_start(args, fmt); + r = lib3270_vsprintf(fmt, args); + va_end(args); + return r; +} + /* * Common helper functions to insert strings, through a template, into a new * buffer. @@ -280,77 +291,6 @@ xs_error(const char *fmt, ...) lib3270_free(r); } -/* Prettyprinter for strings with unprintable data. */ /* -void -fcatv(FILE *f, char *s) -{ - char c; - - while ((c = *s++)) { - switch (c) { - case '\n': - (void) fprintf(f, "\\n"); - break; - case '\t': - (void) fprintf(f, "\\t"); - break; - case '\b': - (void) fprintf(f, "\\b"); - break; - default: - if ((c & 0x7f) < ' ') - (void) fprintf(f, "\\%03o", c & 0xff); - else - fputc(c, f); - break; - } - } -} -*/ - -/* String version of fcatv. */ /* -char * -scatv(const char *s, char *buf, size_t len) -{ - char c; - char *dst = buf; - - while ((c = *s++) && len > 0) { - char cbuf[5]; - char *t = cbuf; - - // Expand this character. - switch (c) { - case '\n': - (void) strcpy(cbuf, "\\n"); - break; - case '\t': - (void) strcpy(cbuf, "\\t"); - break; - case '\b': - (void) strcpy(cbuf, "\\b"); - break; - default: - if ((c & 0x7f) < ' ') - (void) sprintf(cbuf, "\\%03o", c & 0xff); - else { - cbuf[0] = c; - cbuf[1] = '\0'; - } - break; - } - // Copy as much as will fit. - while ((c = *t++) && len > 0) { - *dst++ = c; - len--; - } - } - if (len > 0) - *dst = '\0'; - - return buf; -} -*/ /* * Definition resource splitter, for resources of the repeating form: diff --git a/src/pw3270/v3270/widget.c b/src/pw3270/v3270/widget.c index fcd0ddf..256082e 100644 --- a/src/pw3270/v3270/widget.c +++ b/src/pw3270/v3270/widget.c @@ -57,6 +57,15 @@ #define CONTENTS_WIDTH(terminal) (cols * terminal->metrics.width) #define CONTENTS_HEIGHT(terminal) (((rows+1) * terminal->metrics.spacing)+OIA_TOP_MARGIN+2) +/** + * SECTION: v3270 + * @title: Virtual 3270 widget + * @short_description: The virtual 3270 terminal widget. + * + * Common functions for interact with the 3270 virtual terminal widget. + * + */ + /*--[ Widget definition ]----------------------------------------------------------------------------*/ G_DEFINE_TYPE(v3270, v3270, GTK_TYPE_WIDGET); @@ -721,7 +730,7 @@ static void update_connect(H3270 *session, unsigned char connected) if(connected) { widget->cursor.show |= 2; - g_signal_emit(GTK_WIDGET(widget), v3270_widget_signal[SIGNAL_CONNECTED], 0, session->full_current_host); + g_signal_emit(GTK_WIDGET(widget), v3270_widget_signal[SIGNAL_CONNECTED], 0, session->host.full); } else { @@ -1380,18 +1389,71 @@ H3270 * v3270_get_session(GtkWidget *widget) return GTK_V3270(widget)->host; } -int v3270_connect(GtkWidget *widget, const gchar *host) +int v3270_connect(GtkWidget *widget, const gchar *uri) { v3270 * terminal; int rc = -1; - trace("%s widget=%p host=%p",__FUNCTION__,widget,host); + trace("%s widget=%p host=%p",__FUNCTION__,widget,uri); g_return_val_if_fail(GTK_IS_V3270(widget),EINVAL); terminal = GTK_V3270(widget); - rc = lib3270_connect(terminal->host,host,0); +#ifdef DEBUG + if(uri) + { + LIB3270_CONNECT_OPTION opt = LIB3270_CONNECT_OPTION_DEFAULTS; + gchar * scheme = g_uri_unescape_string(uri,NULL); + gchar * hostname = strchr(scheme,':'); + gchar * srvc; + gchar * query; + + if(hostname) + { + *(hostname++) = 0; + + while(*hostname && !g_ascii_isalnum(*hostname)) + hostname++; + + if(*hostname) + { + if( ! (g_ascii_strcasecmp(scheme,"l") && g_ascii_strcasecmp(scheme,"ssl")) ) + opt |= LIB3270_CONNECT_OPTION_SSL; + + srvc = strchr(hostname,':'); + if(srvc) + { + *(srvc++) = 0; + query = strchr(srvc,'?'); + if(query) + *(query++) = 0; + else + query = ""; + } + else + { + srvc = "telnet"; + } + + rc = lib3270_connect_host(terminal->host,hostname,srvc,opt); + + } + + } + + + g_free(scheme); + + } + else + { + rc = lib3270_connect(terminal->host,uri,0); + } + +#else + rc = lib3270_connect(terminal->host,uri,0); +#endif // DEBUG trace("%s exits with rc=%d (%s)",__FUNCTION__,rc,strerror(rc)); @@ -1476,11 +1538,23 @@ gboolean v3270_get_toggle(GtkWidget *widget, LIB3270_TOGGLE ix) return FALSE; } -void v3270_set_host(GtkWidget *widget, const gchar *uri) +/** + * v3270_set_host: + * + * @widget: V3270 widget. + * @uri: a valid tn3270 URL. + * + * Set the default URL for the tn3270e host. + * + * Returns: The lib3270 processed string as an internal constant. + * + * Since: 5.0 + **/ +const gchar * v3270_set_host(GtkWidget *widget, const gchar *uri) { g_return_if_fail(GTK_IS_V3270(widget)); g_return_if_fail(uri != NULL); - lib3270_set_host(GTK_V3270(widget)->host,uri); + return lib3270_set_host(GTK_V3270(widget)->host,uri); } const gchar * v3270_get_host(GtkWidget *widget) diff --git a/src/pw3270/window.c b/src/pw3270/window.c index 04f04d2..2a31d59 100644 --- a/src/pw3270/window.c +++ b/src/pw3270/window.c @@ -233,10 +233,10 @@ v3270_connect(GTK_PW3270(widget)->terminal,uri); } - void pw3270_set_host(GtkWidget *widget, const gchar *uri) + const gchar * pw3270_set_host(GtkWidget *widget, const gchar *uri) { g_return_if_fail(GTK_IS_PW3270(widget)); - v3270_set_host(GTK_PW3270(widget)->terminal,uri); + return v3270_set_host(GTK_PW3270(widget)->terminal,uri); } const gchar * pw3270_get_host(GtkWidget *widget) -- libgit2 0.21.2