Commit 05595ed8df6563f4c0f2674b0d4fe91a23444ba3
Committed by
GitHub
Exists in
master
and in
3 other branches
Merge pull request #10 from PerryWerneck/develop
Fix windows build and keytable issues.
Showing
16 changed files
with
288 additions
and
66 deletions
Show diff stats
.gitignore
Makefile.in
configure.ac
... | ... | @@ -203,11 +203,13 @@ sccs_user=$USER |
203 | 203 | |
204 | 204 | AC_DEFINE_UNQUOTED(RPQ_BUILD_DATE,"$rpq_build_date") |
205 | 205 | AC_DEFINE_UNQUOTED(RPQ_TIMESTAMP_VALUE,"$rpq_timestamp") |
206 | -AC_DEFINE_UNQUOTED(RPQ_REVISION,"$rpq_revision") | |
207 | 206 | |
208 | 207 | AC_DEFINE_UNQUOTED(SCCS_USER,"$USER") |
209 | 208 | AC_DEFINE_UNQUOTED(SCCS_DATE,"$sccs_date") |
210 | 209 | |
210 | +AC_DEFINE_UNQUOTED(RPQ_REVISION,"$rpq_revision") | |
211 | +AC_SUBST(RPQ_REVISION,"$rpq_revision") | |
212 | + | |
211 | 213 | dnl --------------------------------------------------------------------------- |
212 | 214 | dnl Check for libintl |
213 | 215 | dnl --------------------------------------------------------------------------- |
... | ... | @@ -241,6 +243,8 @@ AC_CHECK_HEADER(libintl.h, [ |
241 | 243 | |
242 | 244 | esac |
243 | 245 | |
246 | +], [ | |
247 | + AC_MSG_ERROR([Can't find required file libintl.h]) | |
244 | 248 | ]) |
245 | 249 | |
246 | 250 | AC_SUBST(INTL_LIBS) |
... | ... | @@ -559,7 +563,7 @@ dnl --------------------------------------------------------------------------- |
559 | 563 | dnl Check for SSL |
560 | 564 | dnl --------------------------------------------------------------------------- |
561 | 565 | |
562 | -PKG_CHECK_MODULES( [LIBSSL], [libssl libcrypto], AC_DEFINE(HAVE_LIBSSL), AC_MSG_NOTICE([libssl not present.]) ) | |
566 | +PKG_CHECK_MODULES( [LIBSSL], [libssl libcrypto], AC_DEFINE(HAVE_LIBSSL), AC_MSG_ERROR([libssl not present.]) ) | |
563 | 567 | |
564 | 568 | AC_SUBST(LIBSSL_LIBS) |
565 | 569 | AC_SUBST(LIBSSL_CFLAGS) | ... | ... |
lib3270.cbp
... | ... | @@ -212,9 +212,6 @@ |
212 | 212 | <Unit filename="src/core/util.c"> |
213 | 213 | <Option compilerVar="CC" /> |
214 | 214 | </Unit> |
215 | - <Unit filename="src/core/version.c"> | |
216 | - <Option compilerVar="CC" /> | |
217 | - </Unit> | |
218 | 215 | <Unit filename="src/core/wait.c"> |
219 | 216 | <Option compilerVar="CC" /> |
220 | 217 | </Unit> |
... | ... | @@ -233,7 +230,9 @@ |
233 | 230 | <Unit filename="src/core/windows/registry.c"> |
234 | 231 | <Option compilerVar="CC" /> |
235 | 232 | </Unit> |
236 | - <Unit filename="src/core/windows/resources.rc" /> | |
233 | + <Unit filename="src/core/windows/resources.rc"> | |
234 | + <Option compilerVar="WINDRES" /> | |
235 | + </Unit> | |
237 | 236 | <Unit filename="src/core/windows/util.c"> |
238 | 237 | <Option compilerVar="CC" /> |
239 | 238 | </Unit> | ... | ... |
locale/pt_BR.po
... | ... | @@ -5,7 +5,7 @@ msgid "" |
5 | 5 | msgstr "" |
6 | 6 | "Project-Id-Version: pw3270 5.0\n" |
7 | 7 | "Report-Msgid-Bugs-To: \n" |
8 | -"POT-Creation-Date: 2020-07-04 14:53-0300\n" | |
8 | +"POT-Creation-Date: 2020-07-09 20:22-0300\n" | |
9 | 9 | "PO-Revision-Date: 2020-05-08 00:52-0300\n" |
10 | 10 | "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n" |
11 | 11 | "Language-Team: Português <>\n" |
... | ... | @@ -265,8 +265,8 @@ msgstr "Não foi possível criar requisição HTTP" |
265 | 265 | msgid "Can't decode CRL" |
266 | 266 | msgstr "Não foi possível decodificar arquivo CRL" |
267 | 267 | |
268 | -#: src/ssl/windows/ldap.c:259 src/ssl/windows/http.c:74 | |
269 | -#: src/ssl/windows/curl.c:264 | |
268 | +#: src/ssl/windows/curl.c:264 src/ssl/windows/http.c:74 | |
269 | +#: src/ssl/windows/ldap.c:259 | |
270 | 270 | msgid "Can't decode certificate revocation list" |
271 | 271 | msgstr "Não foi possível decodificar a lista de certificados revogados" |
272 | 272 | |
... | ... | @@ -371,7 +371,7 @@ msgstr "Não foi possível iniciar transferência de arquivo." |
371 | 371 | msgid "Can't use winsock version %d.%d" |
372 | 372 | msgstr "Não posso usar versão winsock %d.%d" |
373 | 373 | |
374 | -#: src/ssl/negotiate.c:370 src/ssl/crl.c:165 | |
374 | +#: src/ssl/crl.c:165 src/ssl/negotiate.c:370 | |
375 | 375 | msgid "Can't verify." |
376 | 376 | msgstr "Não foi possível verificar" |
377 | 377 | |
... | ... | @@ -637,12 +637,12 @@ msgstr "Apagar campos" |
637 | 637 | msgid "Error" |
638 | 638 | msgstr "Erro" |
639 | 639 | |
640 | -#: src/core/ft/ft_dft.c:454 src/core/ft/ft_cut.c:423 | |
640 | +#: src/core/ft/ft_cut.c:423 src/core/ft/ft_dft.c:454 | |
641 | 641 | #, c-format |
642 | 642 | msgid "Error \"%s\" reading from local file (rc=%d)" |
643 | 643 | msgstr "Erro \"%s\" lendo arquivo local (rc=%d)" |
644 | 644 | |
645 | -#: src/core/ft/ft_dft.c:332 src/core/ft/ft_cut.c:528 | |
645 | +#: src/core/ft/ft_cut.c:528 src/core/ft/ft_dft.c:332 | |
646 | 646 | #, c-format |
647 | 647 | msgid "Error \"%s\" writing to local file (rc=%d)" |
648 | 648 | msgstr "Erro \"%s\" gravando arquivo local (rc=%d)" |
... | ... | @@ -1006,8 +1006,8 @@ msgstr "Move o cursor para o primeiro branco após o último não branco no camp |
1006 | 1006 | msgid "Move to first unprotected field on screen" |
1007 | 1007 | msgstr "Move para o primeiro campo desprotegido" |
1008 | 1008 | |
1009 | -#: src/core/telnet.c:320 src/core/windows/event_dispatcher.c:149 | |
1010 | -#: src/core/windows/connect.c:78 | |
1009 | +#: src/core/telnet.c:320 src/core/windows/connect.c:78 | |
1010 | +#: src/core/windows/event_dispatcher.c:149 | |
1011 | 1011 | msgid "Network error" |
1012 | 1012 | msgstr "Erro de rede" |
1013 | 1013 | |
... | ... | @@ -1282,22 +1282,22 @@ msgstr "Pesquisa não produziu nenhum valor" |
1282 | 1282 | msgid "Secure connection was successful." |
1283 | 1283 | msgstr "Conexão segura efetuada com sucesso." |
1284 | 1284 | |
1285 | -#: src/ssl/negotiate.c:107 src/ssl/negotiate.c:241 src/ssl/negotiate.c:275 | |
1286 | -#: src/ssl/negotiate.c:369 src/ssl/negotiate.c:391 src/ssl/negotiate.c:412 | |
1287 | -#: src/ssl/crl.c:164 src/ssl/windows/ldap.c:108 src/ssl/windows/ldap.c:122 | |
1288 | -#: src/ssl/windows/ldap.c:151 src/ssl/windows/ldap.c:165 | |
1289 | -#: src/ssl/windows/ldap.c:180 src/ssl/windows/ldap.c:210 | |
1290 | -#: src/ssl/windows/ldap.c:222 src/ssl/windows/ldap.c:234 | |
1291 | -#: src/ssl/windows/ldap.c:258 src/ssl/windows/init.c:91 | |
1292 | -#: src/ssl/windows/init.c:112 src/ssl/windows/init.c:138 | |
1293 | -#: src/ssl/windows/init.c:149 src/ssl/windows/http.c:57 | |
1294 | -#: src/ssl/windows/http.c:73 src/ssl/windows/getcrl.c:57 | |
1295 | -#: src/ssl/windows/getcrl.c:74 src/ssl/windows/getcrl.c:86 | |
1296 | -#: src/ssl/windows/getcrl.c:118 src/ssl/windows/curl.c:188 | |
1285 | +#: src/ssl/crl.c:164 src/ssl/negotiate.c:107 src/ssl/negotiate.c:241 | |
1286 | +#: src/ssl/negotiate.c:275 src/ssl/negotiate.c:369 src/ssl/negotiate.c:391 | |
1287 | +#: src/ssl/negotiate.c:412 src/ssl/windows/curl.c:188 | |
1297 | 1288 | #: src/ssl/windows/curl.c:218 src/ssl/windows/curl.c:242 |
1298 | 1289 | #: src/ssl/windows/curl.c:263 src/ssl/windows/curl.c:272 |
1299 | 1290 | #: src/ssl/windows/curl.c:300 src/ssl/windows/curl.c:333 |
1300 | -#: src/ssl/windows/curl.c:369 | |
1291 | +#: src/ssl/windows/curl.c:369 src/ssl/windows/getcrl.c:57 | |
1292 | +#: src/ssl/windows/getcrl.c:74 src/ssl/windows/getcrl.c:86 | |
1293 | +#: src/ssl/windows/getcrl.c:118 src/ssl/windows/http.c:57 | |
1294 | +#: src/ssl/windows/http.c:73 src/ssl/windows/init.c:91 | |
1295 | +#: src/ssl/windows/init.c:112 src/ssl/windows/init.c:138 | |
1296 | +#: src/ssl/windows/init.c:149 src/ssl/windows/ldap.c:108 | |
1297 | +#: src/ssl/windows/ldap.c:122 src/ssl/windows/ldap.c:151 | |
1298 | +#: src/ssl/windows/ldap.c:165 src/ssl/windows/ldap.c:180 | |
1299 | +#: src/ssl/windows/ldap.c:210 src/ssl/windows/ldap.c:222 | |
1300 | +#: src/ssl/windows/ldap.c:234 src/ssl/windows/ldap.c:258 | |
1301 | 1301 | msgid "Security error" |
1302 | 1302 | msgstr "Erro de segurança" |
1303 | 1303 | |
... | ... | @@ -1781,8 +1781,8 @@ msgstr "Mostrar posição do cursor" |
1781 | 1781 | msgid "Transfer cancelled by host" |
1782 | 1782 | msgstr "Transferência cancelada pelo host" |
1783 | 1783 | |
1784 | -#: src/core/ft/ft_dft.c:230 src/core/ft/ft_dft.c:373 src/core/ft/ft_cut.c:400 | |
1785 | -#: src/core/ft/ft_cut.c:495 | |
1784 | +#: src/core/ft/ft_cut.c:400 src/core/ft/ft_cut.c:495 src/core/ft/ft_dft.c:230 | |
1785 | +#: src/core/ft/ft_dft.c:373 | |
1786 | 1786 | msgid "Transfer cancelled by user" |
1787 | 1787 | msgstr "Transferência cancelada pelo usuário" |
1788 | 1788 | ... | ... |
src/core/actions/table.c
... | ... | @@ -91,6 +91,21 @@ |
91 | 91 | return lib3270_move_selection(hSession,LIB3270_DIR_RIGHT); |
92 | 92 | } |
93 | 93 | |
94 | + static int pa1(H3270 *hSession) | |
95 | + { | |
96 | + return lib3270_pakey(hSession,1); | |
97 | + } | |
98 | + | |
99 | + static int pa2(H3270 *hSession) | |
100 | + { | |
101 | + return lib3270_pakey(hSession,1); | |
102 | + } | |
103 | + | |
104 | + static int pa3(H3270 *hSession) | |
105 | + { | |
106 | + return lib3270_pakey(hSession,1); | |
107 | + } | |
108 | + | |
94 | 109 | /** |
95 | 110 | * @brief Get LIB3270 action table; |
96 | 111 | * |
... | ... | @@ -530,7 +545,7 @@ |
530 | 545 | .keys = NULL, |
531 | 546 | .icon = "edit-clear", |
532 | 547 | .label = N_("Erase input"), |
533 | - .summary = NULL, | |
548 | + .summary = N_("Clear"), | |
534 | 549 | .activate = lib3270_eraseinput, |
535 | 550 | |
536 | 551 | .group = LIB3270_ACTION_GROUP_ONLINE, |
... | ... | @@ -618,7 +633,7 @@ |
618 | 633 | .keys = "Escape", |
619 | 634 | .icon = NULL, |
620 | 635 | .label = N_("Reset"), |
621 | - .summary = NULL, | |
636 | + .summary = N_("Reset"), | |
622 | 637 | .activate = lib3270_kybdreset, |
623 | 638 | |
624 | 639 | .group = LIB3270_ACTION_GROUP_ONLINE, |
... | ... | @@ -770,6 +785,51 @@ |
770 | 785 | .activatable = lib3270_is_disconnected |
771 | 786 | }, |
772 | 787 | |
788 | + // | |
789 | + // Misc Actions | |
790 | + // | |
791 | + { | |
792 | + .name = "PA1", | |
793 | + .type = LIB3270_ACTION_TYPE_GENERIC, | |
794 | + | |
795 | + .keys = "<Alt>1", | |
796 | + .icon = NULL, | |
797 | + .label = N_("PA1"), | |
798 | + .summary = N_( "Program Action 1" ), | |
799 | + .activate = pa1, | |
800 | + | |
801 | + .group = LIB3270_ACTION_GROUP_ONLINE, | |
802 | + .activatable = lib3270_is_connected | |
803 | + }, | |
804 | + | |
805 | + { | |
806 | + .name = "PA2", | |
807 | + .type = LIB3270_ACTION_TYPE_GENERIC, | |
808 | + | |
809 | + .keys = "<Alt>2", | |
810 | + .icon = NULL, | |
811 | + .label = N_("PA1"), | |
812 | + .summary = N_( "Program Action 2" ), | |
813 | + .activate = pa2, | |
814 | + | |
815 | + .group = LIB3270_ACTION_GROUP_ONLINE, | |
816 | + .activatable = lib3270_is_connected | |
817 | + }, | |
818 | + | |
819 | + { | |
820 | + .name = "PA3", | |
821 | + .type = LIB3270_ACTION_TYPE_GENERIC, | |
822 | + | |
823 | + .keys = "<Alt>3", | |
824 | + .icon = NULL, | |
825 | + .label = N_("PA1"), | |
826 | + .summary = N_( "Program Action 3" ), | |
827 | + .activate = pa3, | |
828 | + | |
829 | + .group = LIB3270_ACTION_GROUP_ONLINE, | |
830 | + .activatable = lib3270_is_connected | |
831 | + }, | |
832 | + | |
773 | 833 | { |
774 | 834 | .name = NULL, |
775 | 835 | } | ... | ... |
src/core/connect.c
... | ... | @@ -115,6 +115,10 @@ |
115 | 115 | } |
116 | 116 | |
117 | 117 | #if defined(HAVE_LIBSSL) |
118 | + debug("%s: TLS/SSL is %s",__FUNCTION__,hSession->ssl.enabled ? "ENABLED" : "DISABLED") | |
119 | + trace_dsn(hSession,"TLS/SSL is %s\n", hSession->ssl.enabled ? "enabled" : "disabled" ); | |
120 | + | |
121 | + if(hSession->ssl.enabled) | |
118 | 122 | { |
119 | 123 | SSL_ERROR_MESSAGE ssl_error; |
120 | 124 | memset(&ssl_error,0,sizeof(ssl_error)); | ... | ... |
src/core/host.c
... | ... | @@ -288,16 +288,59 @@ LIB3270_EXPORT const char * lib3270_get_url(const H3270 *hSession) |
288 | 288 | if(hSession->host.url) |
289 | 289 | return hSession->host.url; |
290 | 290 | |
291 | -#ifdef LIB3270_DEFAULT_HOST | |
292 | - return LIB3270_DEFAULT_HOST; | |
293 | -#else | |
294 | - return getenv("LIB3270_DEFAULT_HOST"); | |
295 | -#endif // LIB3270_DEFAULT_HOST | |
296 | - | |
291 | + return lib3270_get_default_host(hSession); | |
297 | 292 | } |
298 | 293 | |
299 | 294 | LIB3270_EXPORT const char * lib3270_get_default_host(const H3270 GNUC_UNUSED(*hSession)) |
300 | 295 | { |
296 | +#ifdef _WIN32 | |
297 | + { | |
298 | + HKEY hKey; | |
299 | + DWORD disp = 0; | |
300 | + LSTATUS rc = RegCreateKeyEx( | |
301 | + HKEY_LOCAL_MACHINE, | |
302 | + "Software\\" LIB3270_STRINGIZE_VALUE_OF(PRODUCT_NAME), | |
303 | + 0, | |
304 | + NULL, | |
305 | + REG_OPTION_NON_VOLATILE, | |
306 | + KEY_QUERY_VALUE|KEY_READ, | |
307 | + NULL, | |
308 | + &hKey, | |
309 | + &disp); | |
310 | + | |
311 | + if(rc == ERROR_SUCCESS) | |
312 | + { | |
313 | + static char * default_host = NULL; | |
314 | + DWORD cbData = 4096; | |
315 | + | |
316 | + if(!default_host) | |
317 | + { | |
318 | + default_host = (char *) malloc(cbData+1); | |
319 | + } | |
320 | + else | |
321 | + { | |
322 | + default_host = (char *) realloc(default_host,cbData+1); | |
323 | + } | |
324 | + | |
325 | + DWORD dwRet = RegQueryValueEx(hKey,"host",NULL,NULL,(LPBYTE) default_host, &cbData); | |
326 | + | |
327 | + RegCloseKey(hKey); | |
328 | + | |
329 | + trace("***************** %d",dwRet); | |
330 | + if(dwRet == ERROR_SUCCESS) | |
331 | + { | |
332 | + default_host = (char *) realloc(default_host,cbData+1); | |
333 | + default_host[cbData] = 0; | |
334 | + return default_host; | |
335 | + } | |
336 | + | |
337 | + free(default_host); | |
338 | + default_host = NULL; | |
339 | + | |
340 | + } | |
341 | + } | |
342 | +#endif // _WIN32 | |
343 | + | |
301 | 344 | #ifdef LIB3270_DEFAULT_HOST |
302 | 345 | return LIB3270_DEFAULT_HOST; |
303 | 346 | #else | ... | ... |
src/core/init.c
... | ... | @@ -160,23 +160,30 @@ int lib3270_unloaded(void) |
160 | 160 | |
161 | 161 | BOOL WINAPI DllMain(HANDLE hInstance, DWORD dwcallpurpose, LPVOID GNUC_UNUSED(lpvResvd)) |
162 | 162 | { |
163 | + debug("%s starts",__FUNCTION__); | |
164 | + | |
163 | 165 | switch(dwcallpurpose) |
164 | 166 | { |
165 | 167 | case DLL_PROCESS_ATTACH: |
166 | 168 | hModule = hInstance; |
167 | - hEventLog = RegisterEventSource(NULL, LIB3270_STRINGIZE_VALUE_OF(LIB3270_NAME)); | |
169 | + hEventLog = RegisterEventSource(NULL, LIB3270_STRINGIZE_VALUE_OF(PRODUCT_NAME)); | |
168 | 170 | get_version_info(); |
169 | 171 | lib3270_loaded(); |
170 | 172 | break; |
171 | 173 | |
172 | 174 | case DLL_PROCESS_DETACH: |
173 | 175 | lib3270_unloaded(); |
174 | - DeregisterEventSource(hEventLog); | |
175 | - hEventLog = 0; | |
176 | + if(hEventLog) | |
177 | + { | |
178 | + DeregisterEventSource(hEventLog); | |
179 | + } | |
180 | + hEventLog = NULL; | |
176 | 181 | break; |
177 | 182 | |
178 | 183 | } |
179 | 184 | |
185 | + debug("%s ends",__FUNCTION__); | |
186 | + | |
180 | 187 | return TRUE; |
181 | 188 | } |
182 | 189 | ... | ... |
src/core/iocalls.c
... | ... | @@ -575,6 +575,8 @@ int non_blocking(H3270 *hSession, Boolean on) |
575 | 575 | |
576 | 576 | #endif |
577 | 577 | |
578 | + debug("Socket %d is now %s",hSession->connection.sock,(on ? "Non Blocking" : "Blocking")); | |
579 | + | |
578 | 580 | lib3270_set_poll_state(hSession,hSession->xio.read, on); |
579 | 581 | lib3270_set_poll_state(hSession,hSession->xio.write, on); |
580 | 582 | lib3270_set_poll_state(hSession,hSession->xio.except, on); | ... | ... |
src/core/linux/connect.c
... | ... | @@ -196,8 +196,6 @@ static void net_connected(H3270 *hSession, int GNUC_UNUSED(fd), LIB3270_IO_FLAG |
196 | 196 | hSession->ever_3270 = False; |
197 | 197 | |
198 | 198 | #if defined(HAVE_LIBSSL) |
199 | - debug("%s: TLS/SSL is %s",__FUNCTION__,hSession->ssl.enabled ? "ENABLED" : "DISABLED") | |
200 | - trace_dsn(hSession,"TLS/SSL is %s\n", hSession->ssl.enabled ? "enabled" : "disabled" ); | |
201 | 199 | if(hSession->ssl.enabled) |
202 | 200 | { |
203 | 201 | hSession->ssl.host = 1; | ... | ... |
src/core/telnet.c
src/core/toggles/init.c
... | ... | @@ -116,7 +116,7 @@ void initialize_toggles(H3270 *session) |
116 | 116 | LIB3270_TOGGLE_ID id; |
117 | 117 | void (*upcall)(H3270 *session, const struct lib3270_toggle *t, LIB3270_TOGGLE_TYPE tt); |
118 | 118 | } |
119 | - upcalls[] = | |
119 | + upcalls[LIB3270_TOGGLE_COUNT] = | |
120 | 120 | { |
121 | 121 | { |
122 | 122 | LIB3270_TOGGLE_RECTANGLE_SELECT, |
... | ... | @@ -150,15 +150,66 @@ void initialize_toggles(H3270 *session) |
150 | 150 | |
151 | 151 | unsigned int f; |
152 | 152 | |
153 | + // Set defaults | |
153 | 154 | for(f=0;f<LIB3270_TOGGLE_COUNT;f++) |
155 | + { | |
154 | 156 | session->toggle[f].upcall = toggle_nop; |
157 | + session->toggle[f].value = toggle_descriptor[f].def; | |
158 | + } | |
155 | 159 | |
160 | + // Load upcalls | |
156 | 161 | for(f=0;f<(sizeof(upcalls)/sizeof(upcalls[0]));f++) |
157 | 162 | session->toggle[upcalls[f].id].upcall = upcalls[f].upcall; |
158 | 163 | |
164 | +#ifdef _WIN32 | |
165 | + { | |
166 | + HKEY hKey; | |
167 | + DWORD disp = 0; | |
168 | + LSTATUS rc = RegCreateKeyEx( | |
169 | + HKEY_LOCAL_MACHINE, | |
170 | + "Software\\" LIB3270_STRINGIZE_VALUE_OF(PRODUCT_NAME) "\\toggles", | |
171 | + 0, | |
172 | + NULL, | |
173 | + REG_OPTION_NON_VOLATILE, | |
174 | + KEY_QUERY_VALUE|KEY_READ, | |
175 | + NULL, | |
176 | + &hKey, | |
177 | + &disp); | |
178 | + | |
179 | + if(rc == ERROR_SUCCESS) | |
180 | + { | |
181 | + debug("%s: Loading toggles from registry",__FUNCTION__); | |
182 | + for(f=0;f<LIB3270_TOGGLE_COUNT;f++) | |
183 | + { | |
184 | + DWORD val = 0; | |
185 | + DWORD cbData = sizeof(DWORD); | |
186 | + | |
187 | + DWORD dwRet = RegQueryValueEx( | |
188 | + hKey, | |
189 | + lib3270_toggle_get_from_id(f)->name, | |
190 | + NULL, | |
191 | + NULL, | |
192 | + (LPBYTE) &val, | |
193 | + &cbData | |
194 | + ); | |
195 | + | |
196 | + debug("get(%s)=%d",lib3270_toggle_get_from_id(f)->name,(int) dwRet); | |
197 | + if(dwRet == ERROR_SUCCESS) | |
198 | + { | |
199 | + debug("toggle.%s=%s",lib3270_toggle_get_from_id(f)->name,val ? "True" : "False"); | |
200 | + session->toggle[f].value = (val ? True : False); | |
201 | + } | |
202 | + | |
203 | + } | |
204 | + RegCloseKey(hKey); | |
205 | + } | |
206 | + | |
207 | + } | |
208 | +#endif // _WIN32 | |
209 | + | |
210 | + // Initialize upcalls. | |
159 | 211 | for(f=0;f<LIB3270_TOGGLE_COUNT;f++) |
160 | 212 | { |
161 | - session->toggle[f].value = toggle_descriptor[f].def; | |
162 | 213 | if(session->toggle[f].value) |
163 | 214 | session->toggle[f].upcall(session,&session->toggle[f],LIB3270_TOGGLE_TYPE_INITIAL); |
164 | 215 | } | ... | ... |
src/core/windows/connect.c
... | ... | @@ -190,19 +190,22 @@ static void sockstart(H3270 *session) |
190 | 190 | for(rp = result; hSession->connection.sock < 0 && rp != NULL; rp = rp->ai_next) |
191 | 191 | { |
192 | 192 | hSession->connection.sock = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol); |
193 | + | |
193 | 194 | if(hSession->connection.sock < 0) |
194 | 195 | { |
195 | 196 | ((struct resolver *) host)->rc = errno; |
196 | 197 | ((struct resolver *) host)->message = strerror(errno); |
198 | + debug("Socket error %d: %s",((struct resolver *) host)->rc,((struct resolver *) host)->message); | |
197 | 199 | continue; |
198 | 200 | } |
199 | 201 | |
200 | 202 | // Connected! |
201 | 203 | if(connect(hSession->connection.sock, rp->ai_addr, rp->ai_addrlen)) |
202 | 204 | { |
203 | - SOCK_CLOSE(hSession); | |
204 | 205 | ((struct resolver *) host)->rc = errno; |
205 | 206 | ((struct resolver *) host)->message = strerror(errno); |
207 | + debug("Connection error %d: %s",((struct resolver *) host)->rc,((struct resolver *) host)->message); | |
208 | + SOCK_CLOSE(hSession); | |
206 | 209 | continue; |
207 | 210 | } |
208 | 211 | |
... | ... | @@ -210,6 +213,8 @@ static void sockstart(H3270 *session) |
210 | 213 | |
211 | 214 | freeaddrinfo(result); |
212 | 215 | |
216 | + debug("%s: Connected using socket %d",__FUNCTION__,hSession->connection.sock); | |
217 | + | |
213 | 218 | return 0; |
214 | 219 | |
215 | 220 | } |
... | ... | @@ -233,6 +238,7 @@ int net_reconnect(H3270 *hSession, int seconds) |
233 | 238 | |
234 | 239 | debug("host.message=\"%s\"",host.message); |
235 | 240 | |
241 | + if(hEventLog) | |
236 | 242 | { |
237 | 243 | // Register on event log |
238 | 244 | lib3270_autoptr(char) username = lib3270_get_user_name(); | ... | ... |
src/core/windows/log.c
... | ... | @@ -43,31 +43,38 @@ |
43 | 43 | |
44 | 44 | void default_log_writer(H3270 GNUC_UNUSED(*session), const char *module, int rc, const char *fmt, va_list arg_ptr) |
45 | 45 | { |
46 | - lib3270_autoptr(char) username = lib3270_get_user_name(); | |
47 | 46 | lib3270_autoptr(char) msg = lib3270_vsprintf(fmt,arg_ptr); |
48 | 47 | |
49 | - const char *outMsg[] = { | |
50 | - username, | |
51 | - module, | |
52 | - msg | |
53 | - }; | |
48 | + debug("%s",msg); | |
54 | 49 | |
55 | -#ifdef DEBUG | |
56 | - fprintf(stderr,"LOG(%s): %s\n",module,msg); | |
57 | - fflush(stderr); | |
58 | -#endif // DEBUG | |
50 | + if(hEventLog) | |
51 | + { | |
52 | + lib3270_autoptr(char) username = lib3270_get_user_name(); | |
59 | 53 | |
60 | - ReportEvent( | |
61 | - hEventLog, | |
62 | - (rc == 0 ? EVENTLOG_INFORMATION_TYPE : EVENTLOG_ERROR_TYPE), | |
63 | - 1, | |
64 | - 0, | |
65 | - NULL, | |
66 | - 3, | |
67 | - 0, | |
68 | - outMsg, | |
69 | - NULL | |
70 | - ); | |
54 | + const char *outMsg[] = { | |
55 | + username, | |
56 | + module, | |
57 | + msg | |
58 | + }; | |
59 | + | |
60 | + #ifdef DEBUG | |
61 | + fprintf(stderr,"LOG(%s): %s\n",module,msg); | |
62 | + fflush(stderr); | |
63 | + #endif // DEBUG | |
64 | + | |
65 | + ReportEvent( | |
66 | + hEventLog, | |
67 | + (rc == 0 ? EVENTLOG_INFORMATION_TYPE : EVENTLOG_ERROR_TYPE), | |
68 | + 1, | |
69 | + 0, | |
70 | + NULL, | |
71 | + 3, | |
72 | + 0, | |
73 | + outMsg, | |
74 | + NULL | |
75 | + ); | |
76 | + | |
77 | + } | |
71 | 78 | |
72 | 79 | } |
73 | 80 | ... | ... |
src/testprogram/testprogram.c
1 | +/* | |
2 | + * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270 | |
3 | + * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a | |
4 | + * aplicativos mainframe. Registro no INPI sob o nome G3270. | |
5 | + * | |
6 | + * Copyright (C) <2008> <Banco do Brasil S.A.> | |
7 | + * | |
8 | + * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob | |
9 | + * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela | |
10 | + * Free Software Foundation. | |
11 | + * | |
12 | + * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER | |
13 | + * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO | |
14 | + * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para | |
15 | + * obter mais detalhes. | |
16 | + * | |
17 | + * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este | |
18 | + * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin | |
19 | + * St, Fifth Floor, Boston, MA 02110-1301 USA | |
20 | + * | |
21 | + * Este programa está nomeado como connect.c e possui - linhas de código. | |
22 | + * | |
23 | + * Contatos: | |
24 | + * | |
25 | + * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck) | |
26 | + * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça) | |
27 | + * | |
28 | + */ | |
1 | 29 | |
2 | 30 | #include <stdio.h> |
3 | 31 | #include <string.h> |
... | ... | @@ -36,6 +64,10 @@ static void online_group_state_changed(H3270 GNUC_UNUSED(*hSession), void GNUC_U |
36 | 64 | |
37 | 65 | int main(int argc, char *argv[]) |
38 | 66 | { |
67 | +#ifdef _WIN32 | |
68 | + debug("Process %s running on pid %u\n",argv[0],(unsigned int) GetCurrentProcessId()); | |
69 | +#endif // _WIN32 | |
70 | + | |
39 | 71 | #ifdef LC_ALL |
40 | 72 | setlocale( LC_ALL, "" ); |
41 | 73 | #endif |
... | ... | @@ -57,6 +89,8 @@ int main(int argc, char *argv[]) |
57 | 89 | H3270 * h = lib3270_session_new(""); |
58 | 90 | int rc = 0; |
59 | 91 | |
92 | + lib3270_write_log(h,"TEST","Testprogram %s starts (%s)",argv[0],LIB3270_STRINGIZE_VALUE_OF(PRODUCT_NAME)); | |
93 | + | |
60 | 94 | lib3270_autoptr(char) version_info = lib3270_get_version_info(); |
61 | 95 | printf("3270 session %p created\n%s\n]",h,version_info); |
62 | 96 | ... | ... |