Commit 9e0f89c5e3c9dbcdeb7a6235a1d12f96fbc4e81c

Authored by perry.werneck@gmail.com
1 parent e133a289

Incluindo opção de configuração para desativar o uso do registro windows, inicia…

…ndo implementação de código exemplo de uso
@@ -299,6 +299,10 @@ install-sdk: @@ -299,6 +299,10 @@ install-sdk:
299 @$(INSTALL_DATA) lib3270.pc $(DESTDIR)/$(libdir)/pkgconfig 299 @$(INSTALL_DATA) lib3270.pc $(DESTDIR)/$(libdir)/pkgconfig
300 @$(INSTALL_DATA) pw3270.pc $(DESTDIR)/$(libdir)/pkgconfig 300 @$(INSTALL_DATA) pw3270.pc $(DESTDIR)/$(libdir)/pkgconfig
301 301
  302 + @$(MKDIR) $(DESTDIR)$(datarootdir)/$(PACKAGE_NAME)/sample
  303 + @$(INSTALL_DATA) src/sample/Makefile $(DESTDIR)$(datarootdir)/$(PACKAGE_NAME)/sample
  304 + @$(INSTALL_DATA) src/sample/*.c $(DESTDIR)$(datarootdir)/$(PACKAGE_NAME)/sample
  305 +
302 clean: 306 clean:
303 @rm -fr .obj 307 @rm -fr .obj
304 @rm -fr .bin 308 @rm -fr .bin
@@ -418,6 +418,7 @@ AC_CONFIG_FILES([ @@ -418,6 +418,7 @@ AC_CONFIG_FILES([
418 src/plugins/rx3270/Makefile 418 src/plugins/rx3270/Makefile
419 man/Makefile 419 man/Makefile
420 makegtkruntime.sh 420 makegtkruntime.sh
  421 + src/sample/Makefile
421 ]) 422 ])
422 423
423 dnl Output the generated config.status script. 424 dnl Output the generated config.status script.
@@ -5,7 +5,7 @@ msgid "" @@ -5,7 +5,7 @@ msgid ""
5 msgstr "" 5 msgstr ""
6 "Project-Id-Version: pw3270 5.0\n" 6 "Project-Id-Version: pw3270 5.0\n"
7 "Report-Msgid-Bugs-To: \n" 7 "Report-Msgid-Bugs-To: \n"
8 -"POT-Creation-Date: 2013-01-30 10:26-0200\n" 8 +"POT-Creation-Date: 2013-02-15 16:38-0200\n"
9 "PO-Revision-Date: 2013-01-14 09:49-0200\n" 9 "PO-Revision-Date: 2013-01-14 09:49-0200\n"
10 "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n" 10 "Last-Translator: Perry Werneck <perry.werneck@gmail.com>\n"
11 "Language-Team: Português <>\n" 11 "Language-Team: Português <>\n"
@@ -130,12 +130,12 @@ msgid &quot;&lt;%s&gt; requires a %s attribute&quot; @@ -130,12 +130,12 @@ msgid &quot;&lt;%s&gt; requires a %s attribute&quot;
130 msgstr "<%s> precisa do atributo %s" 130 msgstr "<%s> precisa do atributo %s"
131 131
132 #: uiparser/accelerator.c:41 uiparser/menubar.c:42 uiparser/toolbar.c:58 132 #: uiparser/accelerator.c:41 uiparser/menubar.c:42 uiparser/toolbar.c:58
133 -#: uiparser/popup.c:45 uiparser/scroll.c:43 uiparser/keypad.c:252 133 +#: uiparser/popup.c:45 uiparser/scroll.c:43 uiparser/keypad.c:152
134 #, c-format 134 #, c-format
135 msgid "<%s> should be on toplevel" 135 msgid "<%s> should be on toplevel"
136 msgstr "<%s> deve estar no primeiro nível" 136 msgstr "<%s> deve estar no primeiro nível"
137 137
138 -#: v3270/widget.c:295 138 +#: v3270/widget.c:296
139 msgid "" 139 msgid ""
140 "<b>Identity not verified</b>\n" 140 "<b>Identity not verified</b>\n"
141 "Disconnected from host" 141 "Disconnected from host"
@@ -143,7 +143,7 @@ msgstr &quot;&quot; @@ -143,7 +143,7 @@ msgstr &quot;&quot;
143 "<b>Identidade não foi confirmada</b>\n" 143 "<b>Identidade não foi confirmada</b>\n"
144 "Desconectado do servidor" 144 "Desconectado do servidor"
145 145
146 -#: v3270/widget.c:300 v3270/security.c:370 146 +#: v3270/widget.c:301 v3270/security.c:370
147 msgid "" 147 msgid ""
148 "<b>Identity not verified</b>\n" 148 "<b>Identity not verified</b>\n"
149 "The connection is insecure" 149 "The connection is insecure"
@@ -151,7 +151,7 @@ msgstr &quot;&quot; @@ -151,7 +151,7 @@ msgstr &quot;&quot;
151 "<b>Identidade não foi confirmada</b>\n" 151 "<b>Identidade não foi confirmada</b>\n"
152 "A conexão não é segura" 152 "A conexão não é segura"
153 153
154 -#: v3270/widget.c:305 154 +#: v3270/widget.c:306
155 msgid "" 155 msgid ""
156 "<b>Identity verified</b>\n" 156 "<b>Identity verified</b>\n"
157 "The connection is secure" 157 "The connection is secure"
@@ -159,7 +159,7 @@ msgstr &quot;&quot; @@ -159,7 +159,7 @@ msgstr &quot;&quot;
159 "<b>Identidade verificada</b>\n" 159 "<b>Identidade verificada</b>\n"
160 "A conexão é segura" 160 "A conexão é segura"
161 161
162 -#: v3270/widget.c:320 162 +#: v3270/widget.c:321
163 #, c-format 163 #, c-format
164 msgid "<b>SSL state is undefined</b>Unexpected SSL status %ld" 164 msgid "<b>SSL state is undefined</b>Unexpected SSL status %ld"
165 msgstr "<b>Estado do SSL é indefinido</b>Estado SSL inesperado %ld" 165 msgstr "<b>Estado do SSL é indefinido</b>Estado SSL inesperado %ld"
@@ -315,7 +315,7 @@ msgstr &quot;Tema de c_ores:&quot; @@ -315,7 +315,7 @@ msgstr &quot;Tema de c_ores:&quot;
315 msgid "C_urrent" 315 msgid "C_urrent"
316 msgstr "At_ual" 316 msgstr "At_ual"
317 317
318 -#: uiparser/parsefile.c:225 uiparser/keypad.c:146 318 +#: uiparser/parsefile.c:225
319 #, c-format 319 #, c-format
320 msgid "Can't accept unnamed %s" 320 msgid "Can't accept unnamed %s"
321 msgstr "Não posso aceitar elemento %s sem nome" 321 msgstr "Não posso aceitar elemento %s sem nome"
@@ -628,7 +628,7 @@ msgstr &quot;Apagar até o final do campo&quot; @@ -628,7 +628,7 @@ msgstr &quot;Apagar até o final do campo&quot;
628 msgid "Erase to end of line" 628 msgid "Erase to end of line"
629 msgstr "Apagar até o final da linha" 629 msgstr "Apagar até o final da linha"
630 630
631 -#: print.c:234 v3270/widget.c:251 util.c:994 631 +#: print.c:234 v3270/widget.c:252 util.c:994
632 msgid "Error" 632 msgid "Error"
633 msgstr "Erro" 633 msgstr "Erro"
634 634
@@ -813,7 +813,7 @@ msgstr &quot;IBM AS/400&quot; @@ -813,7 +813,7 @@ msgstr &quot;IBM AS/400&quot;
813 msgid "IBM S/390" 813 msgid "IBM S/390"
814 msgstr "IBM S/390" 814 msgstr "IBM S/390"
815 815
816 -#: v3270/widget.c:313 816 +#: v3270/widget.c:314
817 msgid "Identity not verified" 817 msgid "Identity not verified"
818 msgstr "Identity not verified" 818 msgstr "Identity not verified"
819 819
@@ -1984,7 +1984,7 @@ msgstr &quot;Erro SSL &lt;b&gt;%ld&lt;/b&gt; inesperado&quot; @@ -1984,7 +1984,7 @@ msgstr &quot;Erro SSL &lt;b&gt;%ld&lt;/b&gt; inesperado&quot;
1984 msgid "Unexpected action attribute in <%s>" 1984 msgid "Unexpected action attribute in <%s>"
1985 msgstr "Atributo inesperado \"action\" em <%s>" 1985 msgstr "Atributo inesperado \"action\" em <%s>"
1986 1986
1987 -#: uiparser/keypad.c:190 1987 +#: uiparser/keypad.c:67
1988 #, c-format 1988 #, c-format
1989 msgid "Unexpected element <%s>" 1989 msgid "Unexpected element <%s>"
1990 msgstr "Elemento <%s> inesperado" 1990 msgstr "Elemento <%s> inesperado"
@@ -2017,7 +2017,7 @@ msgstr &quot;Valor de cor inválido ou inesperado: \&quot;%s\&quot;&quot; @@ -2017,7 +2017,7 @@ msgstr &quot;Valor de cor inválido ou inesperado: \&quot;%s\&quot;&quot;
2017 msgid "Unexpected or unknown security status" 2017 msgid "Unexpected or unknown security status"
2018 msgstr "Unexpected or unknown security status" 2018 msgstr "Unexpected or unknown security status"
2019 2019
2020 -#: v3270/widget.c:875 2020 +#: v3270/widget.c:876
2021 msgid "" 2021 msgid ""
2022 "Unexpected signature in H3270 object, possible version mismatch in lib3270" 2022 "Unexpected signature in H3270 object, possible version mismatch in lib3270"
2023 msgstr "" 2023 msgstr ""
@@ -2294,7 +2294,7 @@ msgstr &quot;um attributo \&quot;label\&quot;&quot; @@ -2294,7 +2294,7 @@ msgstr &quot;um attributo \&quot;label\&quot;&quot;
2294 msgid "a type or group attribute" 2294 msgid "a type or group attribute"
2295 msgstr "um atributo \"type\" ou \"group\"" 2295 msgstr "um atributo \"type\" ou \"group\""
2296 2296
2297 -#: uiparser/script.c:75 uiparser/keypad.c:258 2297 +#: uiparser/script.c:75 uiparser/keypad.c:158
2298 #, c-format 2298 #, c-format
2299 msgid "action attribute is invalid for <%s>" 2299 msgid "action attribute is invalid for <%s>"
2300 msgstr "Atributo inesperado \"action\" em <%s>" 2300 msgstr "Atributo inesperado \"action\" em <%s>"
@@ -160,6 +160,9 @@ Section /o &quot;Software Development Kit&quot; SecSDK @@ -160,6 +160,9 @@ Section /o &quot;Software Development Kit&quot; SecSDK
160 file "/oname=$INSTDIR\sdk\include\lib3270\config.h" "src\include\lib3270\config.h" 160 file "/oname=$INSTDIR\sdk\include\lib3270\config.h" "src\include\lib3270\config.h"
161 file "/oname=$INSTDIR\sdk\include\lib3270\rules.mak" "src\include\rules.mak" 161 file "/oname=$INSTDIR\sdk\include\lib3270\rules.mak" "src\include\rules.mak"
162 162
  163 + file "/oname=$INSTDIR\sdk\sample\Makefile" "src\sample\Makefile"
  164 + file "/oname=$INSTDIR\sdk\sample\connect.c" "src\sample\connect.c"
  165 +
163 SectionEnd 166 SectionEnd
164 167
165 # create a section to define what the uninstaller does. 168 # create a section to define what the uninstaller does.
pw3270.spec.in
@@ -170,10 +170,12 @@ rm -rf $RPM_BUILD_ROOT @@ -170,10 +170,12 @@ rm -rf $RPM_BUILD_ROOT
170 %{_includedir}/lib3270/*.h 170 %{_includedir}/lib3270/*.h
171 %{_includedir}/lib3270.h 171 %{_includedir}/lib3270.h
172 %{_includedir}/pw3270.h 172 %{_includedir}/pw3270.h
173 -%{_datadir}/pw3270/ui/99debug.xml 173 +%{_datadir}/@PACKAGE_NAME@/ui/99debug.xml
174 %{_libdir}/pkgconfig/*.pc 174 %{_libdir}/pkgconfig/*.pc
175 %{_libdir}/lib3270.so 175 %{_libdir}/lib3270.so
176 %{_libdir}/libpw3270.so 176 %{_libdir}/libpw3270.so
  177 +%dir %{_datadir}/@PACKAGE_NAME@/sample
  178 +%{_datadir}/@PACKAGE_NAME@/sample/*
177 179
178 #---[ Scripts ]------------------------------------------------------------------------------------------------------- 180 #---[ Scripts ]-------------------------------------------------------------------------------------------------------
179 181
src/pw3270/common/config.c
@@ -572,8 +572,6 @@ gchar * filename_from_va(const gchar *first_element, va_list args) @@ -572,8 +572,6 @@ gchar * filename_from_va(const gchar *first_element, va_list args)
572 572
573 #if defined( HAVE_WIN_REGISTRY ) 573 #if defined( HAVE_WIN_REGISTRY )
574 574
575 -#error aqui  
576 -  
577 if(!result) 575 if(!result)
578 { 576 {
579 // No predefined datadir, search registry 577 // No predefined datadir, search registry
@@ -590,31 +588,31 @@ gchar * filename_from_va(const gchar *first_element, va_list args) @@ -590,31 +588,31 @@ gchar * filename_from_va(const gchar *first_element, va_list args)
590 588
591 rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE,path,0,KEY_QUERY_VALUE|KEY_WOW64_64KEY,&hKey); 589 rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE,path,0,KEY_QUERY_VALUE|KEY_WOW64_64KEY,&hKey);
592 SetLastError(rc); 590 SetLastError(rc);
593 - 591 +
594 if(rc == ERROR_SUCCESS) 592 if(rc == ERROR_SUCCESS)
595 { 593 {
596 char data[4096]; 594 char data[4096];
597 unsigned long datalen = sizeof(data); // data field length(in), data returned length(out) 595 unsigned long datalen = sizeof(data); // data field length(in), data returned length(out)
598 unsigned long datatype; // #defined in winnt.h (predefined types 0-11) 596 unsigned long datatype; // #defined in winnt.h (predefined types 0-11)
599 - 597 +
600 rc = RegQueryValueExA(hKey,NULL,NULL,&datatype,(LPBYTE) data,&datalen); 598 rc = RegQueryValueExA(hKey,NULL,NULL,&datatype,(LPBYTE) data,&datalen);
601 - if(rc == ERROR_SUCCESS)  
602 - { 599 + if(rc == ERROR_SUCCESS)
  600 + {
603 result = g_string_new(g_strchomp(data)); 601 result = g_string_new(g_strchomp(data));
604 - }  
605 - else  
606 - { 602 + }
  603 + else
  604 + {
607 gchar *msg = g_win32_error_message(rc); 605 gchar *msg = g_win32_error_message(rc);
608 - g_message("Error \"%s\" when getting application datadir from registry",msg);  
609 - g_free(msg); 606 + g_message("Error \"%s\" when getting application datadir from registry",msg);
  607 + g_free(msg);
610 } 608 }
611 RegCloseKey(hKey); 609 RegCloseKey(hKey);
612 - }  
613 - else  
614 - { 610 + }
  611 + else
  612 + {
615 gchar *msg = g_win32_error_message(rc); 613 gchar *msg = g_win32_error_message(rc);
616 - g_message("Error \"%s\" when opening datadir key from registry",msg);  
617 - g_free(msg); 614 + g_message("Error \"%s\" when opening datadir key from registry",msg);
  615 + g_free(msg);
618 } 616 }
619 617
620 g_free(path); 618 g_free(path);
src/sample/Makefile.in 0 → 100644
@@ -0,0 +1,45 @@ @@ -0,0 +1,45 @@
  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., 59 Temple
  19 +# Place, Suite 330, Boston, MA, 02111-1307, USA
  20 +#
  21 +# Contatos:
  22 +#
  23 +# perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
  24 +# erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça)
  25 +# licinio@bb.com.br (Licínio Luis Branco)
  26 +# kraucer@bb.com.br (Kraucer Fernandes Mazuco)
  27 +#
  28 +#
  29 +
  30 +LIB3270_CFLAGS=`pkg-config --cflags lib3270`
  31 +LIB3270_LIBS=`pkg-config --libs lib3270`
  32 +
  33 +EXEEXT=@EXEEXT@
  34 +MKDIR=@MKDIR_P@
  35 +CC=@CC@
  36 +LD=@CC@
  37 +
  38 +#---[ Targets ]----------------------------------------------------------------
  39 +
  40 +all: connect$(EXEEXT)
  41 +
  42 +connect$(EXEEXT): connect.c
  43 + $(CC) $(CFLAGS) $(LIB3270_CFLAGS) -o $@ $^ $(LIB3270_LIBS)
  44 +
  45 +
src/sample/connect.c 0 → 100644
@@ -0,0 +1,51 @@ @@ -0,0 +1,51 @@
  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 main.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 + * licinio@bb.com.br (Licínio Luis Branco)
  28 + * kraucer@bb.com.br (Kraucer Fernandes Mazuco)
  29 + *
  30 + */
  31 +
  32 + #include <stdio.h>
  33 + #include <stdlib.h>
  34 + #include <lib3270.h>
  35 +
  36 +/*--[ Implement ]------------------------------------------------------------------------------------*/
  37 +
  38 + int main(int numpar, char *param[])
  39 + {
  40 + H3270 *hSession;
  41 +
  42 + if(numpar != 1)
  43 + {
  44 + fprintf(stderr,"Inform host URI as argument\n");
  45 + exit(-1);
  46 + }
  47 +
  48 +
  49 + return 0;
  50 + }
  51 +