Commit 3119aee5c4b17c7dc21a4e2243f0fedb6c8129ef

Authored by Perry Werneck
Committed by GitHub
2 parents 4f8cf634 1cc777fb
Exists in master and in 2 other branches develop, macos

Merge pull request #30 from PerryWerneck/develop

Updating to the latest version. Fixes and enhancements. #25
Makefile.in
... ... @@ -24,6 +24,23 @@
24 24 # erico.mendonca@gmail.com (Erico Mascarenhas de Mendonça)
25 25 #
26 26  
  27 +#---[ Paths ]----------------------------------------------------------------------------
  28 +
  29 +prefix=@prefix@
  30 +exec_prefix=@exec_prefix@
  31 +srcdir=@srcdir@
  32 +bindir=@bindir@
  33 +srcdir=@srcdir@
  34 +sbindir=@sbindir@
  35 +libdir=@libdir@
  36 +includedir=@includedir@
  37 +datarootdir=@datarootdir@
  38 +localedir=@localedir@
  39 +docdir=@docdir@
  40 +sysconfdir=@sysconfdir@
  41 +datadir=$(datarootdir)/$(PRODUCT_NAME)
  42 +confdir=$(sysconfdir)/$(PRODUCT_NAME)
  43 +
27 44 #---[ Library configuration ]------------------------------------------------------------
28 45  
29 46 SONAME=@SONAME@
... ... @@ -35,22 +52,22 @@ INSTALL_PACKAGES=@INSTALL_PACKAGES@
35 52 NETWORK_MODULES=default openssl
36 53  
37 54 SOURCES= \
38   - $(wildcard src/core/*.c) \
39   - $(wildcard src/core/keyboard/*.c) \
40   - $(wildcard src/core/actions/*.c) \
41   - $(wildcard src/core/toggles/*.c) \
42   - $(wildcard src/core/charset/*.c) \
43   - $(wildcard src/core/ft/*.c) \
44   - $(wildcard src/core/@OSNAME@/*.rc) \
45   - $(wildcard src/core/@OSNAME@/*.c) \
46   - $(wildcard src/core/properties/*.c) \
47   - $(wildcard src/selection/*.c) \
48   - $(wildcard src/network_modules/*.c) \
49   - $(BASEDIR)/.tmp/$(LIBNAME)/fallbacks.c \
50   - $(foreach MODULE, $(NETWORK_MODULES), $(wildcard src/network_modules/$(MODULE)/*.c))
  55 + $(wildcard $(srcdir)/src/core/*.c) \
  56 + $(wildcard $(srcdir)/src/core/keyboard/*.c) \
  57 + $(wildcard $(srcdir)/src/core/actions/*.c) \
  58 + $(wildcard $(srcdir)/src/core/toggles/*.c) \
  59 + $(wildcard $(srcdir)/src/core/charset/*.c) \
  60 + $(wildcard $(srcdir)/src/core/ft/*.c) \
  61 + $(wildcard $(srcdir)/src/core/@OSNAME@/*.rc) \
  62 + $(wildcard $(srcdir)/src/core/@OSNAME@/*.c) \
  63 + $(wildcard $(srcdir)/src/core/properties/*.c) \
  64 + $(wildcard $(srcdir)/src/selection/*.c) \
  65 + $(wildcard $(srcdir)/src/network_modules/*.c) \
  66 + $(BUILDDIR)/.tmp/$(LIBNAME)/fallbacks.c \
  67 + $(foreach MODULE, $(NETWORK_MODULES), $(wildcard $(srcdir)/src/network_modules/$(MODULE)/*.c))
51 68  
52 69 TEST_SOURCES= \
53   - $(wildcard src/testprogram/*.c)
  70 + $(wildcard $(srcdir)/src/testprogram/*.c)
54 71  
55 72 #---[ Tools ]----------------------------------------------------------------------------
56 73  
... ... @@ -72,47 +89,28 @@ DOXYGEN=@DOXYGEN@
72 89 DLLTOOL=@DLLTOOL@
73 90 STRIP=@STRIP@
74 91  
75   -#---[ Paths ]----------------------------------------------------------------------------
  92 +#---[ Build Paths ]----------------------------------------------------------------------
76 93  
77   -prefix=@prefix@
78   -exec_prefix=@exec_prefix@
79   -bindir=@bindir@
80   -sbindir=@sbindir@
81   -libdir=@libdir@
82   -includedir=@includedir@
83   -datarootdir=@datarootdir@
84   -localedir=@localedir@
85   -docdir=@docdir@
86   -sysconfdir=@sysconfdir@
87   -datadir=$(datarootdir)/$(PRODUCT_NAME)
88   -confdir=$(sysconfdir)/$(PRODUCT_NAME)
  94 +BUILDDIR=@BUILDDIR@
89 95  
90   -BASEDIR=@BASEDIR@
  96 +POTDIR=$(BUILDDIR)/.pot
91 97  
92   -POTDIR=$(BASEDIR)/.pot
93   -
94   -OBJDIR=$(BASEDIR)/.obj
  98 +OBJDIR=$(BUILDDIR)/.obj
95 99 OBJDBG=$(OBJDIR)/Debug
96 100 OBJRLS=$(OBJDIR)/Release
97 101  
98   -BINDIR=$(BASEDIR)/.bin
  102 +BINDIR=$(BUILDDIR)/.bin
99 103 BINDBG=$(BINDIR)/Debug
100 104 BINRLS=$(BINDIR)/Release
101 105  
102 106 #---[ Rules ]----------------------------------------------------------------------------
103 107  
104   -DEPENDS= \
105   - Makefile \
106   - src/include/*.h \
107   - src/include/lib3270/*.h \
108   - src/include/@OSNAME@/lib3270/*.h \
109   - $(BASEDIR)/src/include/lib3270/actions.h
110   -
111 108 CFLAGS= \
112 109 @CFLAGS@ \
113 110 -g \
114   - -I$(BASEDIR)/src/include \
115   - -I$(BASEDIR)/src/include/@OSNAME@ \
  111 + -Isrc/include \
  112 + -I$(srcdir)/src/include \
  113 + -I$(srcdir)/src/include/@OSNAME@ \
116 114 @LIBSSL_CFLAGS@ \
117 115 @LDAP_CFLAGS@ \
118 116 @LIBCURL_CFLAGS@
... ... @@ -131,9 +129,8 @@ LIBS= \
131 129 #---[ Debug Rules ]----------------------------------------------------------------------
132 130  
133 131 $(OBJDBG)/%.o: \
134   - %.c \
135   - $(DEPENDS)
136   -
  132 + %.c
  133 +
137 134 @echo $< ...
138 135 @$(MKDIR) $(dir $@)
139 136  
... ... @@ -158,8 +155,7 @@ $(OBJDBG)/%.o: \
158 155 #---[ Release Rules ]--------------------------------------------------------------------
159 156  
160 157 $(OBJRLS)/%.o: \
161   - %.c \
162   - $(DEPENDS)
  158 + %.c
163 159  
164 160 @echo $< ...
165 161 @$(MKDIR) $(dir $@)
... ... @@ -232,7 +228,7 @@ all-windows: \
232 228  
233 229 @$(INSTALL_DATA) \
234 230 $(BINRLS)/$(LIBNAME).def \
235   - $(BASEDIR)/win
  231 + $(BUILDDIR)/win
236 232  
237 233 all-linux: \
238 234 $(BINRLS)/$(SONAME) \
... ... @@ -306,6 +302,20 @@ install-linux-lib: \
306 302 # Install default configs
307 303 @mkdir -p $(DESTDIR)$(datarootdir)/pw3270
308 304  
  305 +install-macos-lib: \
  306 + $(BINRLS)/$(SONAME) \
  307 + install-locale
  308 +
  309 + # Install library
  310 + @$(MKDIR) $(DESTDIR)$(libdir)
  311 +
  312 + @$(INSTALL_PROGRAM) \
  313 + $(BINRLS)/$(SONAME) \
  314 + $(DESTDIR)$(libdir)/$(LIBNAME)@DLLEXT@.@PACKAGE_MAJOR_VERSION@.@PACKAGE_MINOR_VERSION@
  315 +
  316 + # Install default configs
  317 + @mkdir -p $(DESTDIR)$(datarootdir)/pw3270
  318 +
309 319 install-windows-lib: \
310 320 strip \
311 321 $(BINRLS)/$(LIBNAME).dll.a \
... ... @@ -357,15 +367,15 @@ install-dev: \
357 367 @mkdir -p $(DESTDIR)$(includedir)/lib3270
358 368  
359 369 @$(INSTALL_DATA) \
360   - src/include/@OSNAME@/lib3270/*.h \
  370 + $(srcdir)/src/include/@OSNAME@/lib3270/*.h \
361 371 $(DESTDIR)$(includedir)/lib3270
362 372  
363 373 @$(INSTALL_DATA) \
364   - src/include/lib3270/*.h \
  374 + $(srcdir)/src/include/lib3270/*.h \
365 375 $(DESTDIR)$(includedir)/lib3270
366 376  
367 377 @$(INSTALL_DATA) \
368   - src/include/lib3270.h \
  378 + $(srcdir)/src/include/lib3270.h \
369 379 $(DESTDIR)$(includedir)/lib3270.h
370 380  
371 381 # Install PKG-CONFIG files
... ... @@ -387,6 +397,15 @@ install-linux-dev:
387 397 $(LIBNAME)@DLLEXT@.@PACKAGE_MAJOR_VERSION@.@PACKAGE_MINOR_VERSION@ \
388 398 $(DESTDIR)$(libdir)/$(LIBNAME)@DLLEXT@
389 399  
  400 +install-macos-dev:
  401 +
  402 + @$(MKDIR) \
  403 + $(DESTDIR)$(libdir)
  404 +
  405 + @$(LN_S) \
  406 + $(LIBNAME)@DLLEXT@.@PACKAGE_MAJOR_VERSION@.@PACKAGE_MINOR_VERSION@ \
  407 + $(DESTDIR)$(libdir)/$(LIBNAME)@DLLEXT@
  408 +
390 409 install-windows-dev: \
391 410 $(BINRLS)/$(SONAME) \
392 411 $(BINRLS)/$(LIBNAME).dll.a
... ... @@ -418,9 +437,9 @@ install-windows-dev: \
418 437  
419 438 #---[ Misc Targets ]---------------------------------------------------------------------
420 439  
421   -$(BASEDIR)/.tmp/$(LIBNAME)/fallbacks.c: \
422   - src/core/X3270.xad \
423   - $(wildcard src/mkfb/*.c)
  440 +$(BUILDDIR)/.tmp/$(LIBNAME)/fallbacks.c: \
  441 + $(srcdir)/src/core/X3270.xad \
  442 + $(wildcard $(srcdir)/src/mkfb/*.c)
424 443  
425 444 @$(MKDIR) $(dir $@)
426 445 @$(MKDIR) $(BINDIR)
... ... @@ -429,12 +448,12 @@ $(BASEDIR)/.tmp/$(LIBNAME)/fallbacks.c: \
429 448  
430 449 @$(HOST_CC) \
431 450 -g \
432   - -I$(BASEDIR)/src/include \
  451 + -Isrc/include \
433 452 -o $(BINDIR)/mkfb@EXEEXT@ \
434   - $(wildcard src/mkfb/*.c)
  453 + $(wildcard $(srcdir)/src/mkfb/*.c)
435 454  
436 455 @$(BINDIR)/mkfb@EXEEXT@ \
437   - -c src/core/X3270.xad \
  456 + -c $(srcdir)/src/core/X3270.xad \
438 457 $@
439 458  
440 459 locale/$(PACKAGE_NAME).pot: \
... ... @@ -506,7 +525,7 @@ clean: \
506 525 cleanDebug \
507 526 cleanRelease
508 527  
509   - @rm -fr $(BASEDIR)/.tmp/$(LIBNAME)
  528 + @rm -fr $(BUILDDIR)/.tmp/$(LIBNAME)
510 529 @rm -fr $(POTDIR)/$(LIBNAME)
511 530 @rm -f locale/*.pot
512 531  
... ...
README.md
... ... @@ -7,7 +7,6 @@ See more details at https://softwarepublico.gov.br/social/pw3270/
7 7  
8 8 [![License: GPL v3](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
9 9 ![CodeQL](https://github.com/PerryWerneck/lib3270/workflows/CodeQL/badge.svg)
10   -![Analytics](https://ga-beacon.appspot.com/UA-35100728-2/github//lib3270)
11 10 ![Downloads](https://img.shields.io/github/downloads/PerryWerneck/lib3270/total.svg)
12 11  
13 12 Installation repositories
... ... @@ -136,15 +135,20 @@ Windows native with MSYS2
136 135 make install
137 136 ```
138 137  
139   -Building for macOS (using homebrew)
140   -===================================
  138 +Building for macOS
  139 +==================
  140 +
  141 +Using homebrew
  142 +--------------
  143 +
  144 +Install
141 145  
142 146 1. Install [homebrew](https://brew.sh/)
143 147  
144 148 2. Install dependencies
145 149  
146 150 ```shell
147   - brew install automake binutils coreutils curl gettext libtool openldap openssl pkgconfig
  151 + brew install automake binutils coreutils curl gettext libtool openssl pkgconfig
148 152 ```
149 153  
150 154 3. Use [open-keg](https://gist.github.com/andrebreves/5f36e78575e20162ed0a62bd27c4bcea) to make keg-only dependencies available during build process
... ... @@ -156,17 +160,29 @@ Building for macOS (using homebrew)
156 160 4. Configure, build and install (inside the [open-keg](https://gist.github.com/andrebreves/5f36e78575e20162ed0a62bd27c4bcea) shell opened above)
157 161  
158 162 ```shell
159   - ./autogen.sh --prefix="$(brew --cellar)/lib3270/5.3"
  163 + ./autogen.sh --prefix="$(brew --cellar)/lib3270/5.4"
160 164 make all && make install
161   - $ brew link lib3270
  165 + brew link lib3270
162 166 ```
163 167  
164   -Uninstalling
165   -------------
166   -
167   -1. To uninstall
  168 +Uninstall
168 169  
169 170 ```shell
170 171 brew unlink lib3270
171 172 rm -fr "$(brew --cellar)/lib3270"
172 173 ```
  174 +
  175 +Using jhbuild
  176 +--------------
  177 +
  178 +1. Install jhbuild
  179 +
  180 + https://wiki.gnome.org/Projects/GTK/OSX/Building
  181 +
  182 +2. build
  183 +
  184 + ```shell
  185 + jhbuild --moduleset=https://raw.githubusercontent.com/PerryWerneck/lib3270/macos/mac/lib3270.modules build lib3270
  186 + ```
  187 +
  188 +
... ...
autogen.sh
1 1 #!/bin/bash
2 2  
  3 +builddir=${PWD}
  4 +
3 5 test -n "$srcdir" || srcdir=`dirname "$0"`
4 6 test -n "$srcdir" || srcdir=.
5 7  
... ... @@ -45,7 +47,9 @@ automake --add-missing 2&gt; /dev/null | true
45 47  
46 48 autopoint
47 49  
48   -test -n "$NOCONFIGURE" || "$srcdir/configure" $@
  50 +cd "${builddir}"
  51 +
  52 +test -n "$NOCONFIGURE" || "$srcdir/configure" --srcdir=${srcdir} $@
49 53  
50 54  
51 55  
... ...
configure.ac
... ... @@ -44,7 +44,6 @@ AC_CONFIG_MACRO_DIRS([m4])
44 44 dnl Initialize libtool.
45 45 LT_INIT
46 46  
47   -
48 47 dnl Put macro definitions here (though they aren't used).
49 48 AC_CONFIG_HEADERS([src/include/config.h])
50 49  
... ... @@ -54,7 +53,7 @@ AM_INIT_AUTOMAKE
54 53 dnl Check for iconv
55 54 AM_ICONV
56 55  
57   -dnf Set gettext version
  56 +dnl Set gettext version
58 57 AM_GNU_GETTEXT_VERSION([0.14])
59 58  
60 59 dnl Checks for programs.
... ... @@ -124,10 +123,10 @@ case &quot;$host&quot; in
124 123 LIBS="$LIBS -framework CoreFoundation"
125 124 app_cv_osname="macos"
126 125 LOGDIR="/var/log"
127   - DLLEXT=".so"
  126 + DLLEXT=".dylib"
128 127 DLL_LDFLAGS="-shared -Wl,-install_name,\$(@F)"
129 128  
130   - INSTALL_PACKAGES="linux-lib ${INSTALL_PACKAGES}"
  129 + INSTALL_PACKAGES="macos-lib ${INSTALL_PACKAGES}"
131 130  
132 131 app_cv_static='no'
133 132  
... ... @@ -503,10 +502,8 @@ case &quot;$host&quot; in
503 502  
504 503 ;;
505 504  
506   - s390x-*)
507   -
508   - AC_SUBST(SONAME,lib$app_cv_libname.so)
509   -
  505 + *-apple-darwin*)
  506 + AC_SUBST(SONAME,lib$app_cv_libname.dylib.$app_vrs_major.$app_vrs_minor)
510 507 ;;
511 508  
512 509 *)
... ... @@ -644,32 +641,42 @@ dnl ---------------------------------------------------------------------------
644 641 dnl Check for CURL
645 642 dnl ---------------------------------------------------------------------------
646 643  
647   -AC_ARG_ENABLE([curl],
648   - AS_HELP_STRING([--disable-curl],[Disable use of libcurl]),
649   - [case "${enableval}" in
650   - yes) have_curl=yes ;;
651   - no) have_curl=no ;;
652   - *) AC_MSG_ERROR(bad value ${enableval} for --disable-curl);;
653   - esac],
654   - [case "$host" in
655   - *-mingw32|*-pc-msys) have_curl=no ;;
656   - *) have_curl=yes;;
657   - esac])
658   -
  644 +case "$host" in
659 645  
660   -if test "x${have_curl}" != xno ; then
661   - PKG_CHECK_MODULES( [LIBCURL], [libcurl], AC_DEFINE(HAVE_LIBCURL,[],[Do we have libcurl?]), AC_MSG_ERROR([libcurl not present.]) )
662   -fi
  646 + *-mingw32|*-pc-msys)
  647 + AC_SUBST(LIBCURL_LIBS)
  648 + AC_SUBST(LIBCURL_CFLAGS)
  649 + ;;
663 650  
664   -AC_SUBST(LIBCURL_LIBS)
665   -AC_SUBST(LIBCURL_CFLAGS)
  651 + *-apple-darwin*)
  652 + AC_PATH_TOOL([CURLCONFIG], [curl-config], [no])
  653 +
  654 + if test x$CURLCONFIG = xno; then
  655 + AC_MSG_NOTICE([Building without CURL support])
  656 + AC_SUBST(LIBCURL_CFLAGS)
  657 + AC_SUBST(LIBCURL_LIBS)
  658 + else
  659 + AC_MSG_NOTICE([Using $($CURLCONFIG --version)])
  660 + AC_DEFINE(HAVE_LIBCURL,[],[Do we have libcurl?])
  661 + AC_SUBST(LIBCURL_CFLAGS,"$($CURLCONFIG --cflags)")
  662 + AC_SUBST(LIBCURL_LIBS,"$($CURLCONFIG --libs)")
  663 + fi
  664 + ;;
  665 +
  666 + *)
  667 + PKG_CHECK_MODULES( [LIBCURL], [libcurl], AC_DEFINE(HAVE_LIBCURL,[],[Do we have libcurl?]), AC_MSG_ERROR([libcurl not present.]) )
  668 + AC_SUBST(LIBCURL_CFLAGS)
  669 + AC_SUBST(LIBCURL_LIBS)
  670 + ;;
  671 +
  672 +esac
666 673  
667 674 dnl ---------------------------------------------------------------------------
668 675 dnl Directory config
669 676 dnl ---------------------------------------------------------------------------
670 677  
671 678 AC_ARG_WITH([build-dir], [AS_HELP_STRING([--with-build-dir], [Setup build path])], [ app_cv_buildir="$withval" ],[ app_cv_buildir="$ac_pwd" ])
672   -AC_SUBST(BASEDIR,$app_cv_buildir)
  679 +AC_SUBST(BUILDDIR,$app_cv_buildir)
673 680  
674 681 dnl ---------------------------------------------------------------------------
675 682 dnl Configure which files to generate.
... ...
mac/lib3270.modules 0 → 100644
... ... @@ -0,0 +1,20 @@
  1 +<?xml version="1.0"?>
  2 +<!DOCTYPE moduleset SYSTEM "moduleset.dtd">
  3 +<?xml-stylesheet type="text/xsl" href="moduleset.xsl"?>
  4 +<moduleset>
  5 +
  6 + <!-- include href="https://gitlab.gnome.org/GNOME/gtk-osx/raw/master/modulesets-stable/gtk-osx.modules"/ -->
  7 + <include href="https://gitlab.gnome.org/GNOME/jhbuild/raw/master/modulesets/gnome-sysdeps-latest.modules" />
  8 +
  9 + <repository type="git" name="github.com" href="git://github.com/"/>
  10 +
  11 + <autotools id="lib3270">
  12 + <branch repo="github.com" module="PerryWerneck/lib3270" revision="macos" />
  13 +
  14 + <dependencies>
  15 + <dep package="openssl"/>
  16 + </dependencies>
  17 + </autotools>
  18 +
  19 +</moduleset>
  20 +
... ...
src/core/macos/connect.c
... ... @@ -39,86 +39,80 @@
39 39 #include <sys/ioctl.h>
40 40 #include <netinet/in.h>
41 41 #include <netdb.h>
42   -#include <unistd.h>
43 42 #include <fcntl.h>
44 43  
45   -#define SOCK_CLOSE(s) close(s->connection.sock); s->connection.sock = -1;
46   -
47 44 #include <stdlib.h>
48 45  
49 46 #include "hostc.h"
50 47 #include "trace_dsc.h"
51 48 #include "telnetc.h"
52 49 #include "screen.h"
  50 +#include "utilc.h"
53 51  
54 52 #include <lib3270/internals.h>
55 53 #include <lib3270/log.h>
56 54 #include <lib3270/trace.h>
  55 +#include <lib3270/os.h>
  56 +#include <networking.h>
  57 +//#include <fcntl.h>
  58 +#include <poll.h>
57 59  
58 60 /*---[ Implement ]-------------------------------------------------------------------------------*/
59 61  
  62 +static int sock_connect(H3270 *hSession, int sock, const struct sockaddr *address, socklen_t address_len) {
60 63  
61   -static void net_connected(H3270 *hSession, int GNUC_UNUSED(fd), LIB3270_IO_FLAG GNUC_UNUSED(flag), void GNUC_UNUSED(*dunno)) {
62   - int err;
63   - socklen_t len = sizeof(err);
  64 + lib3270_socket_set_non_blocking(hSession, sock, 1);
64 65  
65   - if(hSession->xio.write) {
66   - trace("%s write=%p",__FUNCTION__,hSession->xio.write);
67   - lib3270_remove_poll(hSession, hSession->xio.write);
68   - hSession->xio.write = NULL;
69   - }
  66 + if(!connect(sock,address,address_len))
  67 + return 0;
70 68  
71   - if(getsockopt(hSession->connection.sock, SOL_SOCKET, SO_ERROR, (char *) &err, &len) < 0) {
72   - lib3270_disconnect(hSession);
73   - lib3270_popup_dialog(
74   - hSession,
75   - LIB3270_NOTIFY_ERROR,
76   - _( "Network error" ),
77   - _( "Unable to get connection state." ),
78   - _( "%s" ), strerror(errno)
79   - );
80   - return;
81   - } else if(err) {
82   - char buffer[4096];
  69 + if(errno != EINPROGRESS)
  70 + return errno;
83 71  
84   - snprintf(buffer,4095,_( "Can't connect to %s" ), lib3270_get_url(hSession) );
  72 + unsigned int timer;
  73 + for(timer = 0; timer < hSession->connection.timeout; timer += 10) {
85 74  
86   - lib3270_disconnect(hSession);
87   - lib3270_popup_dialog(
88   - hSession,
89   - LIB3270_NOTIFY_ERROR,
90   - _( "Connection failed" ),
91   - buffer,
92   - _( "%s" ), strerror(err)
93   - );
94   - return;
95   - }
  75 + if(lib3270_get_connection_state(hSession) != LIB3270_CONNECTING)
  76 + return errno = ECANCELED;
96 77  
97   - hSession->xio.except = lib3270_add_poll_fd(hSession,hSession->connection.sock,LIB3270_IO_FLAG_EXCEPTION,net_exception,0);
98   - hSession->xio.read = lib3270_add_poll_fd(hSession,hSession->connection.sock,LIB3270_IO_FLAG_READ,net_input,0);
  78 + struct pollfd pfd = {
  79 + .fd = sock,
  80 + .events = POLLOUT
  81 + };
  82 +
  83 + switch(poll(&pfd,1,10)) {
  84 + case -1: // Poll error
  85 + return errno;
  86 +
  87 + case 0:
  88 + break;
  89 +
  90 + case 1:
  91 + // Got response.
  92 + if(pfd.revents & POLLOUT) {
  93 + debug("%s: Connection complete",__FUNCTION__);
  94 + return 0;
  95 + }
  96 + break;
  97 + }
99 98  
100   -#if defined(HAVE_LIBSSL)
101   - if(hSession->ssl.con && hSession->ssl.state == LIB3270_SSL_UNDEFINED) {
102   - if(ssl_negotiate(hSession))
103   - return;
104 99 }
105   -#endif
106 100  
107   - lib3270_setup_session(hSession);
108   - lib3270_set_connected_initial(hSession);
  101 + return errno = ETIMEDOUT;
109 102  
110 103 }
111 104  
112   -struct resolver {
113   - const char * message;
114   -};
115 105  
116   -static int background_connect(H3270 *hSession, void *host) {
  106 +int lib3270_network_connect(H3270 *hSession, LIB3270_NETWORK_STATE *state) {
  107 +
  108 + // Reset state
  109 + set_ssl_state(hSession,LIB3270_SSL_UNDEFINED);
117 110  
  111 + //
  112 + // Resolve hostname
  113 + //
118 114 struct addrinfo hints;
119 115 struct addrinfo * result = NULL;
120   - struct addrinfo * rp = NULL;
121   -
122 116 memset(&hints,0,sizeof(hints));
123 117 hints.ai_family = AF_UNSPEC; // Allow IPv4 or IPv6
124 118 hints.ai_socktype = SOCK_STREAM; // Stream socket
... ... @@ -128,74 +122,199 @@ static int background_connect(H3270 *hSession, void *host) {
128 122 status_resolving(hSession);
129 123  
130 124 int rc = getaddrinfo(hSession->host.current, hSession->host.srvc, &hints, &result);
131   - if(rc != 0) {
132   - ((struct resolver *) host)->message = gai_strerror(rc);
  125 + if(rc) {
  126 + state->error_message = gai_strerror(rc);
133 127 return -1;
134 128 }
135 129  
  130 + //
  131 + // Try connecting to hosts.
  132 + //
  133 + int sock = -1;
  134 + struct addrinfo * rp = NULL;
  135 +
136 136 status_connecting(hSession);
137 137  
138   - for(rp = result; hSession->connection.sock < 0 && rp != NULL; rp = rp->ai_next) {
139   - hSession->connection.sock = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
140   - if(hSession->connection.sock < 0) {
141   - ((struct resolver *) host)->message = strerror(errno);
  138 + for(rp = result; sock < 0 && rp != NULL && state->syserror != ECANCELED; rp = rp->ai_next) {
  139 + // Got socket from host definition.
  140 + sock = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);
  141 + if(sock < 0) {
  142 + // Can't get socket.
  143 + state->syserror = errno;
142 144 continue;
143 145 }
144 146  
145   - // Connected!
146   - if(connect(hSession->connection.sock, rp->ai_addr, rp->ai_addrlen)) {
147   - SOCK_CLOSE(hSession);
148   - ((struct resolver *) host)->message = strerror(errno);
  147 + // Try connect.
  148 + if(sock_connect(hSession, sock, rp->ai_addr, rp->ai_addrlen)) {
  149 + // Can't connect to host
  150 + state->syserror = errno;
  151 + close(sock);
  152 + sock = -1;
149 153 continue;
150 154 }
151 155  
  156 + lib3270_socket_set_non_blocking(hSession,sock,0);
152 157 }
153 158  
154 159 freeaddrinfo(result);
155 160  
156   - return 0;
  161 + if(sock < 0) {
  162 + static const LIB3270_POPUP popup = {
  163 + .name = "CantConnect",
  164 + .type = LIB3270_NOTIFY_ERROR,
  165 + .summary = N_("Can't connect to host"),
  166 + .label = N_("Try again")
  167 + };
  168 +
  169 + state->popup = &popup;
  170 + return sock;
  171 + }
  172 +
  173 + // don't share the socket with our children
  174 + (void) fcntl(sock, F_SETFD, 1);
157 175  
  176 + return sock;
158 177 }
159 178  
160   -int net_reconnect(H3270 *hSession, int seconds) {
161   - struct resolver host;
162   - memset(&host,0,sizeof(host));
  179 +static void net_connected(H3270 *hSession, int GNUC_UNUSED(fd), LIB3270_IO_FLAG GNUC_UNUSED(flag), void GNUC_UNUSED(*dunno)) {
  180 + int err = 0;
  181 + socklen_t len = sizeof(err);
163 182  
164   - // Connect to host
165   - if(lib3270_run_task(hSession, background_connect, &host) || hSession->connection.sock < 0) {
166   - char buffer[4096];
167   - snprintf(buffer,4095,_( "Can't connect to %s:%s"), hSession->host.current, hSession->host.srvc);
  183 + if(hSession->xio.write) {
  184 + trace("%s write=%p",__FUNCTION__,hSession->xio.write);
  185 + lib3270_remove_poll(hSession, hSession->xio.write);
  186 + hSession->xio.write = NULL;
  187 + }
168 188  
169   - lib3270_popup_dialog( hSession,
170   - LIB3270_NOTIFY_ERROR,
171   - _( "Connection error" ),
172   - buffer,
173   - "%s",
174   - host.message);
  189 + if(hSession->network.module->getsockopt(hSession, SOL_SOCKET, SO_ERROR, (char *) &err, &len) < 0) {
  190 + lib3270_autoptr(char) body = lib3270_strdup_printf(
  191 + _("The System error was '%s' (rc=%d)"),
  192 + strerror(errno),
  193 + errno
  194 + );
175 195  
176   - lib3270_set_disconnected(hSession);
177   - return errno = ENOTCONN;
  196 + lib3270_disconnect(hSession);
  197 +
  198 + LIB3270_POPUP popup = {
  199 + .type = LIB3270_NOTIFY_ERROR,
  200 + .title = _( "Network error" ),
  201 + .summary = _( "Unable to get connection state." ),
  202 + .body = body
  203 + };
  204 +
  205 + lib3270_popup(hSession,&popup,0);
  206 +
  207 + return;
  208 +
  209 + } else if(err) {
  210 +
  211 + lib3270_disconnect(hSession);
  212 +
  213 + lib3270_autoptr(char) summary =
  214 + lib3270_strdup_printf(
  215 + _( "Can't connect to %s:%s"),
  216 + hSession->host.current,
  217 + hSession->host.srvc
  218 + );
  219 +
  220 + lib3270_autoptr(char) body =
  221 + lib3270_strdup_printf(
  222 + _("The system error was \"%s\" (rc=%d)"),
  223 + strerror(err),
  224 + err
  225 + );
  226 +
  227 +
  228 + LIB3270_POPUP popup = {
  229 + .type = LIB3270_NOTIFY_ERROR,
  230 + .title = _( "Connection error" ),
  231 + .summary = summary,
  232 + .body = body,
  233 + .label = _("_Retry")
  234 + };
  235 +
  236 + if(lib3270_popup(hSession,&popup,!hSession->auto_reconnect_inprogress) == 0)
  237 + lib3270_activate_auto_reconnect(hSession,1000);
  238 +
  239 + return;
178 240 }
179 241  
180   - /* don't share the socket with our children */
181   - (void) fcntl(hSession->connection.sock, F_SETFD, 1);
  242 + if(lib3270_start_tls(hSession)) {
  243 + lib3270_disconnect(hSession);
  244 + return;
  245 + }
182 246  
183   - hSession->ever_3270 = False;
  247 + hSession->xio.except = hSession->network.module->add_poll(hSession,LIB3270_IO_FLAG_EXCEPTION,net_exception,0);
  248 + hSession->xio.read = hSession->network.module->add_poll(hSession,LIB3270_IO_FLAG_READ,net_input,0);
  249 +
  250 + lib3270_setup_session(hSession);
  251 + lib3270_set_connected_initial(hSession);
184 252  
185   -#if defined(HAVE_LIBSSL)
186   - debug("%s: TLS/SSL is %s",__FUNCTION__,hSession->ssl.enabled ? "ENABLED" : "DISABLED")
187   - trace_dsn(hSession,"TLS/SSL is %s\n", hSession->ssl.enabled ? "enabled" : "disabled" );
188   - if(hSession->ssl.enabled) {
189   - hSession->ssl.host = 1;
190   - if(ssl_init(hSession))
191   - return errno = ENOTCONN;
  253 + lib3270_notify_tls(hSession);
192 254  
  255 +}
  256 +
  257 +int net_reconnect(H3270 *hSession, int seconds) {
  258 + LIB3270_NETWORK_STATE state;
  259 + memset(&state,0,sizeof(state));
  260 +
  261 + // Initialize and connect to host
  262 + set_ssl_state(hSession,LIB3270_SSL_UNDEFINED);
  263 + lib3270_set_cstate(hSession,LIB3270_CONNECTING);
  264 +
  265 + if(lib3270_run_task(hSession, (int(*)(H3270 *, void *)) hSession->network.module->connect, &state)) {
  266 + lib3270_autoptr(LIB3270_POPUP) popup =
  267 + lib3270_popup_clone_printf(
  268 + NULL,
  269 + _( "Can't connect to %s:%s"),
  270 + hSession->host.current,
  271 + hSession->host.srvc
  272 + );
  273 +
  274 + if(!popup->summary) {
  275 + popup->summary = popup->body;
  276 + popup->body = NULL;
  277 + }
  278 +
  279 + lib3270_autoptr(char) syserror = NULL;
  280 + if(state.syserror) {
  281 + syserror = lib3270_strdup_printf(
  282 + _("The system error was \"%s\" (rc=%d)"),
  283 + strerror(state.syserror),
  284 + state.syserror
  285 + );
  286 + }
  287 +#ifdef _WIN32
  288 + else if(state.winerror) {
  289 +#error TODO
  290 + }
  291 +#endif // _WIN32
  292 +
  293 + if(!popup->body) {
  294 + if(state.error_message)
  295 + popup->body = state.error_message;
  296 + else
  297 + popup->body = syserror;
  298 + }
  299 +
  300 + lib3270_disconnect(hSession); // To cleanup states.
  301 +
  302 + popup->label = _("_Retry");
  303 + if(lib3270_popup(hSession,popup,!hSession->auto_reconnect_inprogress) == 0)
  304 + lib3270_activate_auto_reconnect(hSession,1000);
  305 +
  306 + return errno = ENOTCONN;
193 307 }
194   -#endif // HAVE_LIBSSL
  308 +
  309 +
  310 + //
  311 + // Connected
  312 + //
  313 + hSession->ever_3270 = False;
195 314  
196 315 // set options for inline out-of-band data and keepalives
197 316 int optval = 1;
198   - if (setsockopt(hSession->connection.sock, SOL_SOCKET, SO_OOBINLINE, (char *)&optval,sizeof(optval)) < 0) {
  317 + if(hSession->network.module->setsockopt(hSession, SOL_SOCKET, SO_OOBINLINE, &optval, sizeof(optval)) < 0) {
199 318 int rc = errno;
200 319 lib3270_popup_dialog( hSession,
201 320 LIB3270_NOTIFY_ERROR,
... ... @@ -203,12 +322,12 @@ int net_reconnect(H3270 *hSession, int seconds) {
203 322 _( "setsockopt(SO_OOBINLINE) has failed" ),
204 323 "%s",
205 324 strerror(rc));
206   - SOCK_CLOSE(hSession);
  325 + hSession->network.module->disconnect(hSession);
207 326 return rc;
208 327 }
209 328  
210 329 optval = lib3270_get_toggle(hSession,LIB3270_TOGGLE_KEEP_ALIVE) ? 1 : 0;
211   - if (setsockopt(hSession->connection.sock, SOL_SOCKET, SO_KEEPALIVE, (char *)&optval, sizeof(optval)) < 0) {
  330 + if (hSession->network.module->setsockopt(hSession, SOL_SOCKET, SO_KEEPALIVE, &optval, sizeof(optval)) < 0) {
212 331 int rc = errno;
213 332  
214 333 char buffer[4096];
... ... @@ -220,7 +339,8 @@ int net_reconnect(H3270 *hSession, int seconds) {
220 339 buffer,
221 340 "%s",
222 341 strerror(rc));
223   - SOCK_CLOSE(hSession);
  342 +
  343 + hSession->network.module->disconnect(hSession);
224 344 return rc;
225 345 } else {
226 346 trace_dsn(hSession,"Network keep-alive is %s\n",optval ? "enabled" : "disabled" );
... ... @@ -242,18 +362,27 @@ int net_reconnect(H3270 *hSession, int seconds) {
242 362 lib3270_set_cstate(hSession, LIB3270_PENDING);
243 363 lib3270_st_changed(hSession, LIB3270_STATE_HALF_CONNECT, True);
244 364  
245   - hSession->xio.write = lib3270_add_poll_fd(hSession,hSession->connection.sock,LIB3270_IO_FLAG_WRITE,net_connected,0);
246   - // hSession->ns_write_id = AddOutput(hSession->sock, hSession, net_connected);
  365 + hSession->xio.write = hSession->network.module->add_poll(hSession,LIB3270_IO_FLAG_WRITE,net_connected,0);
247 366  
248 367 trace("%s: Connection in progress",__FUNCTION__);
249 368  
250 369 if(seconds) {
  370 + int rc = lib3270_wait_for_cstate(hSession,LIB3270_CONNECTED_TN3270E,seconds);
  371 + if(rc) {
  372 + lib3270_disconnect(hSession);
  373 + lib3270_write_log(hSession,"connect", "%s: %s",__FUNCTION__,strerror(ETIMEDOUT));
  374 + return errno = rc;
  375 + }
  376 +
  377 + /*
251 378 time_t end = time(0)+seconds;
252 379  
253   - while(time(0) < end) {
  380 + while(time(0) < end)
  381 + {
254 382 lib3270_main_iterate(hSession,1);
255 383  
256   - switch(hSession->connection.state) {
  384 + switch(hSession->connection.state)
  385 + {
257 386 case LIB3270_PENDING:
258 387 case LIB3270_CONNECTED_INITIAL:
259 388 case LIB3270_CONNECTED_ANSI:
... ... @@ -261,7 +390,7 @@ int net_reconnect(H3270 *hSession, int seconds) {
261 390 case LIB3270_CONNECTED_INITIAL_E:
262 391 case LIB3270_CONNECTED_NVT:
263 392 case LIB3270_CONNECTED_SSCP:
264   - case LIB3270_RESOLVING:
  393 + case LIB3270_CONNECTING:
265 394 break;
266 395  
267 396 case LIB3270_NOT_CONNECTED:
... ... @@ -283,6 +412,7 @@ int net_reconnect(H3270 *hSession, int seconds) {
283 412 lib3270_write_log(hSession,"connect", "%s: %s",__FUNCTION__,strerror(ETIMEDOUT));
284 413  
285 414 return errno = ETIMEDOUT;
  415 + */
286 416 }
287 417  
288 418 return 0;
... ...
src/core/macos/curl.c
... ... @@ -155,21 +155,20 @@ static int internal_curl_trace_callback(CURL GNUC_UNUSED(*handle), curl_infotype
155 155 return 0;
156 156 }
157 157  
158   -char * lib3270_get_from_url(H3270 *hSession, const char *url, size_t *length, const char **error_message) {
  158 +char * lib3270_url_get_using_curl(H3270 *hSession, const char *url, const char **error) {
159 159 lib3270_write_event_trace(hSession,"Getting data from %s",url);
160 160  
161 161 // Use CURL to download the CRL
162   - lib3270_autoptr(CURLDATA) crl_data = lib3270_malloc(sizeof(CURLDATA));
  162 + lib3270_autoptr(CURLDATA) curl_data = lib3270_malloc(sizeof(CURLDATA));
163 163 lib3270_autoptr(CURL) hCurl = curl_easy_init();
164 164  
165   - memset(crl_data,0,sizeof(CURLDATA));
166   - crl_data->hSession = hSession;
167   - crl_data->data.length = CRL_DATA_LENGTH;
168   - crl_data->data.contents = lib3270_malloc(crl_data->data.length);
  165 + memset(curl_data,0,sizeof(CURLDATA));
  166 + curl_data->hSession = hSession;
  167 + curl_data->data.length = CRL_DATA_LENGTH;
  168 + curl_data->data.contents = lib3270_malloc(curl_data->data.length);
169 169  
170 170 if(!hCurl) {
171   - *error_message= _( "Can't initialize curl operation" );
172   - errno = EINVAL;
  171 + *error = _( "Can't initialize curl operation" );
173 172 return NULL;
174 173 }
175 174  
... ... @@ -178,39 +177,36 @@ char * lib3270_get_from_url(H3270 *hSession, const char *url, size_t *length, co
178 177 curl_easy_setopt(hCurl, CURLOPT_URL, url);
179 178 curl_easy_setopt(hCurl, CURLOPT_FOLLOWLOCATION, 1L);
180 179  
181   - curl_easy_setopt(hCurl, CURLOPT_ERRORBUFFER, crl_data->errbuf);
  180 + curl_easy_setopt(hCurl, CURLOPT_ERRORBUFFER, curl_data->errbuf);
182 181  
183 182 curl_easy_setopt(hCurl, CURLOPT_WRITEFUNCTION, internal_curl_write_callback);
184   - curl_easy_setopt(hCurl, CURLOPT_WRITEDATA, (void *) crl_data);
  183 + curl_easy_setopt(hCurl, CURLOPT_WRITEDATA, (void *) curl_data);
185 184  
186 185 curl_easy_setopt(hCurl, CURLOPT_USERNAME, "");
187 186  
188 187 if(lib3270_get_toggle(hSession,LIB3270_TOGGLE_SSL_TRACE)) {
189 188 curl_easy_setopt(hCurl, CURLOPT_VERBOSE, 1L);
190 189 curl_easy_setopt(hCurl, CURLOPT_DEBUGFUNCTION, internal_curl_trace_callback);
191   - curl_easy_setopt(hCurl, CURLOPT_DEBUGDATA, (void *) crl_data);
  190 + curl_easy_setopt(hCurl, CURLOPT_DEBUGDATA, (void *) curl_data);
192 191 }
193 192  
194 193 res = curl_easy_perform(hCurl);
195 194  
196 195 if(res != CURLE_OK) {
197   - if(crl_data->errbuf[0])
198   - lib3270_write_log(hSession,"curl","%s: %s",url, crl_data->errbuf);
  196 + if(curl_data->errbuf[0])
  197 + lib3270_write_log(hSession,"curl","%s: %s",url, curl_data->errbuf);
199 198  
200   - *error_message = curl_easy_strerror(res);
  199 + *error = curl_easy_strerror(res);
201 200  
202   - lib3270_write_log(hSession,"curl","%s: %s",url, *error_message);
  201 + lib3270_write_log(hSession,"curl","%s: %s",url, *error);
203 202 errno = EINVAL;
204 203 return NULL;
205 204  
206 205 }
207 206  
208   - if(length)
209   - *length = (size_t) crl_data->length;
210   -
211   - char * httpText = lib3270_malloc(crl_data->length+1);
212   - memset(httpText,0,crl_data->length+1);
213   - memcpy(httpText,crl_data->data.contents,crl_data->length);
  207 + char * httpText = lib3270_malloc(curl_data->length+1);
  208 + memset(httpText,0,curl_data->length+1);
  209 + memcpy(httpText,curl_data->data.contents,curl_data->length);
214 210  
215 211 return httpText;
216 212  
... ...
src/core/macos/download.c 0 → 100644
... ... @@ -0,0 +1,63 @@
  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 - 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 + */
  29 +
  30 +#include "private.h"
  31 +#include <utilc.h>
  32 +
  33 +/*--[ Implement ]------------------------------------------------------------------------------------*/
  34 +
  35 +char * lib3270_url_get(H3270 *hSession, const char *u, const char **error) {
  36 +
  37 + lib3270_autoptr(char) url = lib3270_unescape(u);
  38 +
  39 + if(strncasecmp(url,"file://",7) == 0) {
  40 +
  41 + // Load local file contents.
  42 + char *rc = lib3270_file_get_contents(hSession,url+7);
  43 + if(!rc)
  44 + *error = strerror(errno);
  45 + return rc;
  46 + }
  47 +
  48 +#if defined(HAVE_LIBCURL)
  49 +
  50 + return lib3270_url_get_using_curl(hSession,url,error);
  51 +
  52 +#else
  53 +
  54 + // Can't get contents
  55 + *error = _("No handler for URL scheme.");
  56 + errno = EINVAL;
  57 + return NULL;
  58 +
  59 +
  60 +#endif // HAVE_LIBCURL
  61 +
  62 +
  63 +}
... ...
src/core/macos/event_dispatcher.c
... ... @@ -166,11 +166,13 @@ retry:
166 166  
167 167 if (t->tv.tv_sec < now.tv_sec ||(t->tv.tv_sec == now.tv_sec && t->tv.tv_usec < now.tv_usec)) {
168 168 t->in_play = True;
169   - (*t->proc)(hSession);
170   - processed_any = True;
171 169  
  170 + (*t->proc)(hSession,t->userdata);
172 171 lib3270_linked_list_delete_node(&hSession->timeouts,t);
173 172  
  173 + processed_any = True;
  174 +
  175 +
174 176 } else {
175 177 break;
176 178 }
... ...
src/core/macos/ldap.c 0 → 100644
... ... @@ -0,0 +1,176 @@
  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 - 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 + */
  29 +
  30 +#include <config.h>
  31 +
  32 +#if defined(HAVE_LDAP) && defined(HAVE_LIBSSL)
  33 +
  34 +#include <internals.h>
  35 +#include <lib3270.h>
  36 +#include <lib3270/log.h>
  37 +#include <lib3270/trace.h>
  38 +#include <openssl/x509.h>
  39 +#include <networking.h>
  40 +
  41 +#define LDAP_DEPRECATED 1
  42 +#include <ldap.h>
  43 +
  44 +typedef char LDAPPTR;
  45 +
  46 +//--[ Implement ]------------------------------------------------------------------------------------
  47 +
  48 +static inline void lib3270_autoptr_cleanup_LDAPMessage(LDAPMessage **message) {
  49 + debug("%s(%p)",__FUNCTION__,*message);
  50 + if(message)
  51 + ldap_msgfree(*message);
  52 + *message = NULL;
  53 +}
  54 +
  55 +static inline void lib3270_autoptr_cleanup_LDAP(LDAP **ld) {
  56 + debug("%s(%p)",__FUNCTION__,*ld);
  57 + if(*ld)
  58 + ldap_unbind_ext(*ld, NULL, NULL);
  59 + *ld = NULL;
  60 +}
  61 +
  62 +static inline void lib3270_autoptr_cleanup_BerElement(BerElement **ber) {
  63 + debug("%s(%p)",__FUNCTION__,*ber);
  64 + if(*ber)
  65 + ber_free(*ber, 0);
  66 + *ber = NULL;
  67 +}
  68 +
  69 +static inline void lib3270_autoptr_cleanup_LDAPPTR(char **ptr) {
  70 + debug("%s(%p)",__FUNCTION__,*ptr);
  71 + if(*ptr)
  72 + ldap_memfree(*ptr);
  73 + *ptr = NULL;
  74 +}
  75 +
  76 +X509_CRL * lib3270_crl_get_using_ldap(H3270 *hSession, const char *url, const char **error) {
  77 +
  78 + // Get attributes
  79 + char * attrs[] = { NULL, NULL };
  80 + char * base = strchr(url+7,'/');
  81 + if(!base) {
  82 + *error = _( "The URL argument should be in the format ldap://[HOST]/[DN]?attribute" );
  83 + errno = EINVAL;
  84 + return NULL;
  85 + }
  86 +
  87 + *(base++) = 0;
  88 + attrs[0] = strchr(base,'?');
  89 +
  90 + if(!base) {
  91 + *error = _( "The URL argument should be in the format ldap://[HOST]/[DN]?attribute" );
  92 + errno = EINVAL;
  93 + return NULL;
  94 + }
  95 +
  96 + *(attrs[0]++) = 0;
  97 +
  98 + debug("host: \"%s\"",url);
  99 + debug("Base: \"%s\"",base);
  100 + debug("Attr: \"%s\"",attrs[0]);
  101 +
  102 + // Do LDAP Query
  103 + lib3270_autoptr(LDAP) ld = NULL;
  104 + lib3270_autoptr(BerElement) ber = NULL;
  105 +
  106 + int rc = ldap_initialize(&ld, url);
  107 + if(rc != LDAP_SUCCESS) {
  108 + *error = ldap_err2string(rc);
  109 + return NULL;
  110 + }
  111 +
  112 + unsigned long version = LDAP_VERSION3;
  113 + rc = ldap_set_option(ld, LDAP_OPT_PROTOCOL_VERSION,(void *) &version);
  114 + if(rc != LDAP_SUCCESS) {
  115 + *error = ldap_err2string(rc);
  116 + return NULL;
  117 + }
  118 +
  119 + rc = ldap_simple_bind_s(ld, "", "");
  120 + if(rc != LDAP_SUCCESS) {
  121 + *error = ldap_err2string(rc);
  122 + return NULL;
  123 + }
  124 +
  125 + lib3270_autoptr(LDAPMessage) results = NULL;
  126 + rc = ldap_search_ext_s(
  127 + ld, // Specifies the LDAP pointer returned by a previous call to ldap_init(), ldap_ssl_init(), or ldap_open().
  128 + base, // Specifies the DN of the entry at which to start the search.
  129 + LDAP_SCOPE_BASE, // Specifies the scope of the search.
  130 + NULL, // Specifies a string representation of the filter to apply in the search.
  131 + (char **) &attrs, // Specifies a null-terminated array of character string attribute types to return from entries that match filter.
  132 + 0, // Should be set to 1 to request attribute types only. Set to 0 to request both attributes types and attribute values.
  133 + NULL,
  134 + NULL,
  135 + NULL,
  136 + 0,
  137 + &results
  138 + );
  139 +
  140 + if(rc != LDAP_SUCCESS) {
  141 + *error = ldap_err2string(rc);
  142 + return NULL;
  143 + }
  144 +
  145 + lib3270_autoptr(LDAPPTR) attr = ldap_first_attribute(ld, results, &ber);
  146 + if(!attr) {
  147 + *error = _("LDAP search did not produce any attributes.");
  148 + errno = ENOENT;
  149 + return NULL;
  150 + }
  151 +
  152 + //
  153 + // Load CRL
  154 + //
  155 + struct berval ** value = ldap_get_values_len(ld, results, attr);
  156 + if(!value) {
  157 + *error =_("LDAP search did not produce any values.");
  158 + errno = ENOENT;
  159 + return NULL;
  160 + }
  161 +
  162 + X509_CRL * crl = NULL;
  163 +
  164 + const unsigned char *crl_data = (const unsigned char *) value[0]->bv_val;
  165 +
  166 + if(!d2i_X509_CRL(&crl, &crl_data, value[0]->bv_len)) {
  167 + *error = _( "Can't decode certificate revocation list" );
  168 + }
  169 +
  170 + ldap_value_free_len(value);
  171 +
  172 + return crl;
  173 +
  174 +}
  175 +
  176 +#endif // HAVE_LDAP
... ...
src/core/macos/log.c
... ... @@ -42,22 +42,19 @@
42 42  
43 43 int use_syslog = 0;
44 44  
45   -void default_log_writer(H3270 GNUC_UNUSED(*session), const char *module, int GNUC_UNUSED(rc), const char *fmt, va_list arg_ptr) {
  45 +int default_loghandler(const H3270 GNUC_UNUSED(*session), void GNUC_UNUSED(*userdata), const char *module, int GNUC_UNUSED(rc), const char *message) {
46 46 #ifdef HAVE_SYSLOG
47 47 if(use_syslog) {
48   - vsyslog(LOG_INFO, fmt, arg_ptr);
  48 + syslog(LOG_INFO, "%s: %s", module, message);
49 49 } else {
50   - printf("%s:\t",module);
51   - vprintf(fmt,arg_ptr);
52   - printf("\n");
  50 + printf("%s %s\n", module, message);
53 51 fflush(stdout);
54 52 }
55 53 #else
56   - printf("%s:\t",module);
57   - vprintf(fmt,arg_ptr);
58   - printf("\n");
  54 + printf("%s %s\n", module, message);
59 55 fflush(stdout);
60 56 #endif
  57 + return 0;
61 58 }
62 59  
63 60 LIB3270_EXPORT int lib3270_set_syslog(int flag) {
... ...
src/core/macos/private.h 0 → 100644
... ... @@ -0,0 +1,48 @@
  1 +/*
  2 + * "Software G3270, 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 ', 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 private.h 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 de Mendonça)
  27 + *
  28 + */
  29 +
  30 +#ifndef PRIVATE_H_INCLUDED
  31 +
  32 +#define PRIVATE_H_INCLUDED
  33 +
  34 +#include <config.h>
  35 +#include <internals.h>
  36 +
  37 +#include <lib3270.h>
  38 +#include <lib3270/log.h>
  39 +
  40 +#if defined(HAVE_LIBCURL)
  41 +LIB3270_INTERNAL char * lib3270_url_get_using_curl(H3270 *hSession, const char *u, const char **error);
  42 +#endif // HAVE_LIBCURL
  43 +
  44 +#if defined(HAVE_LDAP)
  45 +LIB3270_INTERNAL char * lib3270_url_get_using_ldap(H3270 *hSession, const char *u, const char **error);
  46 +#endif // HAVE_LDAP
  47 +
  48 +#endif // !PRIVATE_H_INCLUDED
... ...
src/core/macos/util.c
  1 +/* SPDX-License-Identifier: LGPL-3.0-or-later */
  2 +
1 3 /*
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. Registro no INPI sob
5   - * o nome G3270.
6   - *
7   - * Copyright (C) <2008> <Banco do Brasil S.A.>
8   - *
9   - * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
10   - * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
11   - * Free Software Foundation.
12   - *
13   - * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
14   - * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
15   - * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
16   - * obter mais detalhes.
17   - *
18   - * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
19   - * programa; se não, escreva para a Free Software Foundation, Inc., 51 Franklin
20   - * St, Fifth Floor, Boston, MA 02110-1301 USA
  4 + * Copyright (C) 2008 Banco do Brasil S.A.
21 5 *
22   - * Este programa está nomeado como - e possui - linhas de código.
  6 + * This program is free software: you can redistribute it and/or modify
  7 + * it under the terms of the GNU Lesser General Public License as published
  8 + * by the Free Software Foundation, either version 3 of the License, or
  9 + * (at your option) any later version.
23 10 *
24   - * Contatos:
25   - *
26   - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
27   - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
28 15 *
  16 + * You should have received a copy of the GNU Lesser General Public License
  17 + * along with this program. If not, see <https://www.gnu.org/licenses/>.
29 18 */
30 19  
31 20 /**
32   - * @brief Linux Utility functions.
  21 + * @brief Mac Utility functions.
33 22 */
34 23  
35 24  
... ... @@ -40,6 +29,8 @@
40 29 #include <CoreFoundation/CFBundle.h>
41 30 #include <CoreFoundation/CFURL.h>
42 31 #include <sys/syslimits.h>
  32 +#include <lib3270.h>
  33 +#include <lib3270/os.h>
43 34  
44 35 static char * concat(char *path, const char *name, size_t *length) {
45 36 size_t szCurrent = strlen(path);
... ... @@ -74,28 +65,61 @@ static char * build_filename(const char *root, const char *str, va_list args) {
74 65 }
75 66  
76 67 char * lib3270_build_data_filename(const char *str, ...) {
  68 +
77 69 va_list args;
78   - va_start (args, str);
79 70  
80   - char *filename;
  71 + size_t szPath = PATH_MAX;
  72 + lib3270_autoptr(char) path = (char *) lib3270_malloc(szPath);
  73 + char *filename = NULL;
  74 +
  75 + //
  76 + // Try bundle
  77 + //
81 78 CFBundleRef mainBundle = CFBundleGetMainBundle();
  79 +
82 80 if (mainBundle) {
  81 +
83 82 CFURLRef url = CFBundleCopyBundleURL(mainBundle);
  83 +
84 84 if (url) {
85   - size_t szPath = PATH_MAX;
86   - char *path = (char *) lib3270_malloc(szPath);
87   - CFURLGetFileSystemRepresentation(url, true, path, szPath);
  85 +
  86 + CFURLGetFileSystemRepresentation(url, true, (UInt8 *) path, szPath);
88 87 CFRelease(url);
89 88 path = concat(path, "Contents/Resources", &szPath);
90   - filename = build_filename(path, str, args);
91   - lib3270_free(path);
92   - } else {
93   - filename = build_filename(LIB3270_STRINGIZE_VALUE_OF(DATADIR), str, args);
  89 +
  90 + if(access(path,R_OK) == 0) {
  91 + va_start (args, str);
  92 + filename = build_filename(path, str, args);
  93 + va_end (args);
  94 + return filename;
  95 + }
  96 +#ifdef DEBUG
  97 + else {
  98 + debug("No bundle in '%s'",path);
  99 + }
  100 +#endif // DEBUG
94 101 }
95   - } else {
96   - filename = build_filename(LIB3270_STRINGIZE_VALUE_OF(DATADIR), str, args);
  102 +
97 103 }
98 104  
  105 + /*
  106 + //
  107 + // Try EXE Path
  108 + //
  109 + {
  110 + uint32_t size = szPath;
  111 + _NSGetExecutablePath(path, &size);
  112 + path[size] = 0;
  113 +
  114 +
  115 + }
  116 + */
  117 +
  118 + //
  119 + // Not found, use the system datadir
  120 + //
  121 + va_start (args, str);
  122 + filename = build_filename(LIB3270_STRINGIZE_VALUE_OF(DATADIR), str, args);
99 123 va_end (args);
100 124  
101 125 return filename;
... ...
src/core/screen.c
... ... @@ -672,6 +672,7 @@ static void status_3270_mode(H3270 *hSession, int GNUC_UNUSED(ignored), void GNU
672 672 }
673 673  
674 674 void mcursor_set(H3270 *hSession,LIB3270_POINTER m) {
  675 +
675 676 if(hSession->pointer != ((unsigned short) m)) {
676 677  
677 678 // Pointer changed
... ...
src/core/session.c
  1 +/* SPDX-License-Identifier: LGPL-3.0-or-later */
  2 +
1 3 /*
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. 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 session.c e possui - linhas de código.
  4 + * Copyright (C) 2008 Banco do Brasil S.A.
22 5 *
23   - * Contatos:
  6 + * This program is free software: you can redistribute it and/or modify
  7 + * it under the terms of the GNU Lesser General Public License as published
  8 + * by the Free Software Foundation, either version 3 of the License, or
  9 + * (at your option) any later version.
24 10 *
25   - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
26   - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
27 15 *
  16 + * You should have received a copy of the GNU Lesser General Public License
  17 + * along with this program. If not, see <https://www.gnu.org/licenses/>.
28 18 */
29 19  
30 20 #ifndef ANDROID
... ... @@ -154,13 +144,16 @@ void lib3270_session_free(H3270 *h) {
154 144  
155 145 }
156 146  
157   -static void update_char(H3270 GNUC_UNUSED(*session), int GNUC_UNUSED(addr), unsigned char GNUC_UNUSED(chr), unsigned short GNUC_UNUSED(attr), unsigned char GNUC_UNUSED(cursor)) {
  147 +static void nop_void() {
158 148 }
159 149  
160   -static void nop_char(H3270 GNUC_UNUSED(*session), unsigned char GNUC_UNUSED(chr)) {
  150 +static int default_action(H3270 GNUC_UNUSED(*hSession), const char GNUC_UNUSED(*name)) {
  151 + return errno = ENOENT;
161 152 }
162 153  
163   -static void nop(H3270 GNUC_UNUSED(*session)) {
  154 +
  155 +/*
  156 +static void update_char(H3270 GNUC_UNUSED(*session), int GNUC_UNUSED(addr), unsigned char GNUC_UNUSED(chr), unsigned short GNUC_UNUSED(attr), unsigned char GNUC_UNUSED(cursor)) {
164 157 }
165 158  
166 159 static void update_model(H3270 GNUC_UNUSED(*session), const char GNUC_UNUSED(*name), int GNUC_UNUSED(model), int GNUC_UNUSED(rows), int GNUC_UNUSED(cols)) {
... ... @@ -181,6 +174,20 @@ static void update_selection(H3270 GNUC_UNUSED(*session), int GNUC_UNUSED(start)
181 174 static void set_cursor(H3270 GNUC_UNUSED(*session), LIB3270_POINTER GNUC_UNUSED(id)) {
182 175 }
183 176  
  177 +static void update_ssl(H3270 GNUC_UNUSED(*session), LIB3270_SSL_STATE GNUC_UNUSED(state)) {
  178 +}
  179 +
  180 +static void set_timer(H3270 GNUC_UNUSED(*session), unsigned char GNUC_UNUSED(on)) {
  181 +}
  182 +
  183 +static void default_update_luname(H3270 GNUC_UNUSED(*session), const char GNUC_UNUSED(*name)) {
  184 +}
  185 +
  186 +static void default_update_url(H3270 GNUC_UNUSED(*session), const char GNUC_UNUSED(*url)) {
  187 +}
  188 +
  189 +*/
  190 +
184 191 static int print(H3270 *session, LIB3270_CONTENT_OPTION GNUC_UNUSED(mode)) {
185 192 lib3270_write_log(session, "print", "%s", "Printing is unavailable");
186 193 lib3270_popup_dialog(session, LIB3270_NOTIFY_WARNING, _( "Can't print" ), _( "Unable to print" ), "%s", strerror(ENOTSUP));
... ... @@ -199,60 +206,46 @@ static int load(H3270 *session, const char GNUC_UNUSED(*filename)) {
199 206 return errno = ENOTSUP;
200 207 }
201 208  
202   -static void update_ssl(H3270 GNUC_UNUSED(*session), LIB3270_SSL_STATE GNUC_UNUSED(state)) {
203   -}
204   -
205   -static void set_timer(H3270 GNUC_UNUSED(*session), unsigned char GNUC_UNUSED(on)) {
206   -}
207   -
208 209 static void screen_disp(H3270 *session) {
209 210 CHECK_SESSION_HANDLE(session);
210 211 screen_update(session,0,session->view.rows*session->view.cols);
211 212 }
212 213  
213   -static void nop_int(H3270 GNUC_UNUSED(*session), int GNUC_UNUSED(width)) {
214   - return;
215   -}
216   -
217   -static void default_update_luname(H3270 GNUC_UNUSED(*session), const char GNUC_UNUSED(*name)) {
218   -}
219   -
220   -static void default_update_url(H3270 GNUC_UNUSED(*session), const char GNUC_UNUSED(*url)) {
221   -}
222   -
223   -static int default_action(H3270 GNUC_UNUSED(*hSession), const char GNUC_UNUSED(*name)) {
224   - return ENOENT;
225   -}
226   -
227 214 void lib3270_reset_callbacks(H3270 *hSession) {
228 215 // Default calls
229 216 memset(&hSession->cbk,0,sizeof(hSession->cbk));
230 217  
231   - hSession->cbk.update = update_char;
232   - hSession->cbk.update_model = update_model;
233   - hSession->cbk.update_cursor = update_cursor;
234   - hSession->cbk.set_selection = nop_char;
235   - hSession->cbk.ctlr_done = nop;
236   - hSession->cbk.changed = changed;
  218 + #pragma GCC diagnostic push
  219 + #pragma GCC diagnostic ignored "-Wincompatible-pointer-types"
  220 +
  221 + hSession->cbk.update = nop_void;
  222 + hSession->cbk.update_model = nop_void;
  223 + hSession->cbk.update_cursor = nop_void;
  224 + hSession->cbk.set_selection = nop_void;
  225 + hSession->cbk.ctlr_done = nop_void;
  226 + hSession->cbk.changed = nop_void;
237 227 hSession->cbk.erase = screen_disp;
238   - hSession->cbk.suspend = nop;
  228 + hSession->cbk.suspend = nop_void;
239 229 hSession->cbk.resume = screen_disp;
240   - hSession->cbk.update_oia = update_oia;
241   - hSession->cbk.update_selection = update_selection;
242   - hSession->cbk.cursor = set_cursor;
243   - hSession->cbk.update_ssl = update_ssl;
  230 + hSession->cbk.update_oia = nop_void;
  231 + hSession->cbk.update_selection = nop_void;
  232 + hSession->cbk.cursor = nop_void;
  233 + hSession->cbk.update_ssl = nop_void;
244 234 hSession->cbk.display = screen_disp;
245   - hSession->cbk.set_width = nop_int;
246   - hSession->cbk.update_status = (void (*)(H3270 *, LIB3270_MESSAGE)) nop_int;
247   - hSession->cbk.autostart = nop;
248   - hSession->cbk.set_timer = set_timer;
  235 + hSession->cbk.set_width = nop_void;
  236 + hSession->cbk.update_status = nop_void;
  237 + hSession->cbk.autostart = nop_void;
  238 + hSession->cbk.set_timer = nop_void;
249 239 hSession->cbk.print = print;
250 240 hSession->cbk.save = save;
251 241 hSession->cbk.load = load;
252   - hSession->cbk.update_luname = default_update_luname;
253   - hSession->cbk.update_url = default_update_url;
  242 + hSession->cbk.update_luname = nop_void;
  243 + hSession->cbk.update_url = nop_void;
254 244 hSession->cbk.action = default_action;
255 245 hSession->cbk.reconnect = lib3270_reconnect;
  246 + hSession->cbk.word_selected = nop_void;
  247 +
  248 + #pragma GCC diagnostic pop
256 249  
257 250 lib3270_set_popup_handler(hSession, NULL);
258 251 lib3270_set_log_handler(hSession,NULL,NULL);
... ... @@ -468,7 +461,7 @@ LIB3270_EXPORT char lib3270_get_session_id(H3270 *hSession) {
468 461  
469 462 struct lib3270_session_callbacks * lib3270_get_session_callbacks(H3270 *hSession, const char *revision, unsigned short sz) {
470 463  
471   - #define REQUIRED_REVISION "20210801"
  464 + #define REQUIRED_REVISION "20211118"
472 465  
473 466 if(revision && strcasecmp(revision,REQUIRED_REVISION) < 0) {
474 467 errno = EINVAL;
... ...
src/core/util.c
... ... @@ -50,6 +50,8 @@
50 50 #include <malloc.h>
51 51 #endif // defined
52 52  
  53 +#include <stdlib.h>
  54 +
53 55 #define my_isspace(c) isspace((unsigned char)c)
54 56  
55 57 /// @brief Cheesy internal version of sprintf that allocates its own memory.
... ...
src/include/lib3270/selection.h
  1 +/* SPDX-License-Identifier: LGPL-3.0-or-later */
  2 +
1 3 /*
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.
  4 + * Copyright (C) 2008 Banco do Brasil S.A.
16 5 *
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
  6 + * This program is free software: you can redistribute it and/or modify
  7 + * it under the terms of the GNU Lesser General Public License as published
  8 + * by the Free Software Foundation, either version 3 of the License, or
  9 + * (at your option) any later version.
20 10 *
21   - * Este programa está nomeado como selection.h 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)
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
27 15 *
  16 + * You should have received a copy of the GNU Lesser General Public License
  17 + * along with this program. If not, see <https://www.gnu.org/licenses/>.
28 18 */
29 19  
30 20 /**
... ... @@ -75,11 +65,26 @@ typedef struct _lib3270_selection {
75 65  
76 66 LIB3270_EXPORT int lib3270_unselect(H3270 *session);
77 67 LIB3270_EXPORT void lib3270_select_to(H3270 *session, int baddr);
78   -LIB3270_EXPORT int lib3270_select_word_at(H3270 *session, int baddr);
79   -LIB3270_EXPORT int lib3270_select_word(H3270 *session);
80   -LIB3270_EXPORT int lib3270_select_field_at(H3270 *session, int baddr);
81   -LIB3270_EXPORT int lib3270_select_field(H3270 *session);
82   -LIB3270_EXPORT int lib3270_select_all(H3270 *session);
  68 +
  69 +/**
  70 + * @brief Select word at position.
  71 + *
  72 + * @param hSession Session handle.
  73 + * @param baddr position.
  74 + *
  75 + * @return 0 if ok, non zero if failed
  76 + *
  77 + * @retval 0 The word was selected.
  78 + * @retval EINVAL baddr is out of the screen.
  79 + * @retval ENOTCONN The terminal is offline.
  80 + *
  81 + */
  82 + LIB3270_EXPORT int lib3270_select_word_at(H3270 *session, int baddr);
  83 +
  84 + LIB3270_EXPORT int lib3270_select_word(H3270 *session);
  85 + LIB3270_EXPORT int lib3270_select_field_at(H3270 *session, int baddr);
  86 + LIB3270_EXPORT int lib3270_select_field(H3270 *session);
  87 + LIB3270_EXPORT int lib3270_select_all(H3270 *session);
83 88  
84 89 /**
85 90 * @brief Get selection options.
... ... @@ -103,7 +108,7 @@ typedef enum _LIB3270_SELECTION_OPTIONS {
103 108 *
104 109 * @see lib3270_paste_next.
105 110 *
106   - * @return 0 if suceeded, negative if faile, > 0 if there's more data.
  111 + * @return 0 if suceeded, negative if fails, > 0 if there's more data.
107 112 *
108 113 * @retval 0 The entire string was pasted.
109 114 * @retval -EINVAL Invalid argument.
... ...
src/include/lib3270/session.h
... ... @@ -80,6 +80,8 @@ struct lib3270_session_callbacks {
80 80  
81 81 int (*reconnect)(H3270 *hSession,int seconds);
82 82  
  83 + void (*word_selected)(H3270 *hSession, int start, int end);
  84 +
83 85 };
84 86  
85 87 /**
... ...
src/mkfb/mkfb.c
... ... @@ -41,6 +41,7 @@
41 41 #define tmpfile w32_tmpfile
42 42 #elif defined( __APPLE__ )
43 43 #define tmpfile osx_tmpfile
  44 +#include <unistd.h>
44 45 #endif // OS
45 46  
46 47 #include <sys/stat.h>
... ...
src/network_modules/openssl/main.c
... ... @@ -33,6 +33,7 @@
33 33 */
34 34  
35 35 #include "private.h"
  36 +#include <openssl/asn1.h>
36 37  
37 38 static void openssl_network_reset(H3270 *hSession) {
38 39  
... ... @@ -291,6 +292,9 @@ static int openssl_network_connect(H3270 *hSession, LIB3270_NETWORK_STATE *state
291 292 #endif
292 293  
293 294 if(X509_cmp_current_time(next_update) == 1) {
  295 +
  296 + trace_ssl(hSession,"CRL is valid\n");
  297 + /*
294 298 int day, sec;
295 299 if(ASN1_TIME_diff(&day, &sec, NULL, next_update)) {
296 300 trace_ssl(hSession,"CRL is valid for %d day(s) and %d second(s)\n",day,sec);
... ... @@ -298,6 +302,7 @@ static int openssl_network_connect(H3270 *hSession, LIB3270_NETWORK_STATE *state
298 302 trace_ssl(hSession,"Can't get CRL next update, discarding it\n");
299 303 lib3270_openssl_crl_free(context);
300 304 }
  305 + */
301 306  
302 307 } else {
303 308 trace_ssl(hSession,"CRL is no longer valid\n");
... ...
src/selection/actions.c
  1 +/* SPDX-License-Identifier: LGPL-3.0-or-later */
  2 +
1 3 /*
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
  4 + * Copyright (C) 2008 Banco do Brasil S.A.
20 5 *
21   - * Este programa está nomeado como - e possui - linhas de código.
  6 + * This program is free software: you can redistribute it and/or modify
  7 + * it under the terms of the GNU Lesser General Public License as published
  8 + * by the Free Software Foundation, either version 3 of the License, or
  9 + * (at your option) any later version.
22 10 *
23   - * Contatos:
24   - *
25   - * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
26   - * erico.mendonca@gmail.com (Erico Mascarenhas Mendonça)
  11 + * This program is distributed in the hope that it will be useful,
  12 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14 + * GNU General Public License for more details.
27 15 *
  16 + * You should have received a copy of the GNU Lesser General Public License
  17 + * along with this program. If not, see <https://www.gnu.org/licenses/>.
28 18 */
29 19  
30 20 #include <internals.h>
... ... @@ -107,14 +97,20 @@ LIB3270_EXPORT int lib3270_select_word(H3270 *session) {
107 97 }
108 98  
109 99 LIB3270_EXPORT int lib3270_select_word_at(H3270 *session, int baddr) {
110   - int start, end;
  100 + int start, end, rc;
111 101  
112   - if(lib3270_get_word_bounds(session,baddr,&start,&end))
113   - return -1;
  102 + rc = lib3270_get_word_bounds(session,baddr,&start,&end);
  103 + if(rc)
  104 + return rc;
114 105  
115 106 trace("%s: baddr=%d start=%d end=%d",__FUNCTION__,baddr,start,end);
116 107  
117   - do_select(session,start,end,0);
  108 + rc = do_select(session,start,end,0);
  109 + if(rc)
  110 + return rc;
  111 +
  112 + // Notify word selected to allow testing for URL selection.
  113 + session->cbk.word_selected(session,start,end);
118 114  
119 115 return 0;
120 116 }
... ...
src/testprogram/testprogram.c
... ... @@ -75,6 +75,12 @@ int main(int argc, char *argv[]) {
75 75  
76 76 textdomain("lib3270");
77 77  
  78 + {
  79 + lib3270_autoptr(char) testfilename = lib3270_build_data_filename("test",NULL);
  80 + printf("\n\nFilename: '%s'\n\n", testfilename);
  81 + return 0;
  82 + }
  83 +
78 84 // #pragma GCC diagnostic push
79 85 // #pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant"
80 86 static struct option options[] = {
... ...
win/install-cross.sh
... ... @@ -19,22 +19,20 @@ install_packages() {
19 19 | xargs sudo zypper --non-interactive --verbose in
20 20  
21 21  
  22 + ## Instala apicativos e temas necessários
  23 + sudo zypper --non-interactive in \
  24 + gettext-tools \
  25 + automake
  26 +
  27 + while read FILE
  28 + do
  29 + sudo zypper --non-interactive in ${1}-${FILE}
  30 + done < ${TEMPFILE}
  31 +
  32 + rm -f ${TEMPFILE}
  33 +
22 34 }
23 35  
24   -## Instala apicativos e temas necessários
25   -#sudo zypper --non-interactive in \
26   -# gettext-tools \
27   -# automake
28   -#
29   -#while read FILE
30   -#do
31   -# sudo zypper --non-interactive in ${1}-${FILE}
32   -#done < ${TEMPFILE}
33   -#
34   -#rm -f ${TEMPFILE}
35   -#
36   -#}
37   -#
38 36  
39 37 if [ -z ${1} ]; then
40 38 echo "Use ${0} --32 for 32 bits cross-compiler"
... ...
win/lib3270.def
... ... @@ -121,230 +121,232 @@ EXPORTS
121 121 lib3270_get_option_list @120
122 122 lib3270_get_oversize @121
123 123 lib3270_get_pointer @122
124   - lib3270_get_program_message @123
125   - lib3270_get_region @124
126   - lib3270_get_revision @125
127   - lib3270_get_screen_size @126
128   - lib3270_get_selected @127
129   - lib3270_get_selected_text @128
130   - lib3270_get_selection @129
131   - lib3270_get_selection_bounds @130
132   - lib3270_get_selection_flags @131
133   - lib3270_get_selection_rectangle @132
134   - lib3270_get_session_callbacks @133
135   - lib3270_get_session_id @134
136   - lib3270_get_ssl_crl_text @135
137   - lib3270_get_ssl_peer_certificate_text @136
138   - lib3270_get_ssl_state @137
139   - lib3270_get_ssl_state_description @138
140   - lib3270_get_ssl_state_icon_name @139
141   - lib3270_get_ssl_state_message @140
142   - lib3270_get_string_at @141
143   - lib3270_get_string_at_address @142
144   - lib3270_get_string_properties_list @143
145   - lib3270_get_task_count @144
146   - lib3270_get_toggle @145
147   - lib3270_get_toggle_description @146
148   - lib3270_get_toggle_id @147
149   - lib3270_get_toggle_label @148
150   - lib3270_get_toggle_list @149
151   - lib3270_get_toggle_name @150
152   - lib3270_get_toggle_summary @151
153   - lib3270_get_toggles @152
154   - lib3270_get_trace_filename @153
155   - lib3270_get_trace_handler @154
156   - lib3270_get_translation_domain @155
157   - lib3270_get_typeahead @156
158   - lib3270_get_undera @157
159   - lib3270_get_unlock_delay @158
160   - lib3270_get_unsigned_properties_list @159
161   - lib3270_get_url @160
162   - lib3270_get_user_data @161
163   - lib3270_get_version @162
164   - lib3270_get_version_info @163
165   - lib3270_get_width @164
166   - lib3270_get_word_bounds @165
167   - lib3270_getpeername @166
168   - lib3270_getsockname @167
169   - lib3270_half_connected @168
170   - lib3270_has_active_script @169
171   - lib3270_has_selection @170
172   - lib3270_host_get_name @171
173   - lib3270_iconv_free @172
174   - lib3270_iconv_from_host @173
175   - lib3270_iconv_new @174
176   - lib3270_iconv_to_host @175
177   - lib3270_in_3270 @176
178   - lib3270_in_ansi @177
179   - lib3270_in_e @178
180   - lib3270_in_neither @179
181   - lib3270_in_sscp @180
182   - lib3270_in_tn3270e @181
183   - lib3270_input_string @182
184   - lib3270_is_as400 @183
185   - lib3270_is_connected @184
186   - lib3270_is_disconnected @185
187   - lib3270_is_formatted @186
188   - lib3270_is_protected @187
189   - lib3270_is_ready @188
190   - lib3270_is_secure @189
191   - lib3270_is_selected @190
192   - lib3270_is_tso @191
193   - lib3270_is_unlocked @192
194   - lib3270_kybdreset @193
195   - lib3270_load @194
196   - lib3270_main_iterate @195
197   - lib3270_malloc @196
198   - lib3270_move_cursor @197
199   - lib3270_move_selected_area @198
200   - lib3270_move_selection @199
201   - lib3270_newline @200
202   - lib3270_nextfield @201
203   - lib3270_nextword @202
204   - lib3270_pakey @203
205   - lib3270_parse_host_type @204
206   - lib3270_paste_next @205
207   - lib3270_paste_text @206
208   - lib3270_pconnected @207
209   - lib3270_pfkey @208
210   - lib3270_popup @209
211   - lib3270_popup_an_errno @210
212   - lib3270_popup_clone_printf @211
213   - lib3270_popup_dialog @212
214   - lib3270_popup_va @213
215   - lib3270_previousfield @214
216   - lib3270_previousword @215
217   - lib3270_print @216
218   - lib3270_print_all @217
219   - lib3270_print_copy @218
220   - lib3270_print_selected @219
221   - lib3270_property_get_by_name @220
222   - lib3270_property_get_description @221
223   - lib3270_property_get_label @222
224   - lib3270_property_get_name @223
225   - lib3270_property_get_summary @224
226   - lib3270_property_get_tooltip @225
227   - lib3270_realloc @226
228   - lib3270_receive @227
229   - lib3270_reconnect @228
230   - lib3270_register_action_group_listener @229
231   - lib3270_register_fd_handlers @230
232   - lib3270_register_io_controller @231
233   - lib3270_register_schange @232
234   - lib3270_register_timer_handlers @233
235   - lib3270_register_toggle_listener @234
236   - lib3270_remap_char @235
237   - lib3270_remove_poll @236
238   - lib3270_remove_poll_fd @237
239   - lib3270_reselect @238
240   - lib3270_reset_callbacks @239
241   - lib3270_reset_charset @240
242   - lib3270_reset_ft_callbacks @241
243   - lib3270_ring_bell @242
244   - lib3270_run_task @243
245   - lib3270_save @244
246   - lib3270_save_all @245
247   - lib3270_save_copy @246
248   - lib3270_save_selected @247
249   - lib3270_select_all @248
250   - lib3270_select_field @249
251   - lib3270_select_field_at @250
252   - lib3270_select_region @251
253   - lib3270_select_to @252
254   - lib3270_select_word @253
255   - lib3270_select_word_at @254
256   - lib3270_selection_get_length @255
257   - lib3270_selection_new @256
258   - lib3270_send @257
259   - lib3270_service_get_name @258
260   - lib3270_session_free @259
261   - lib3270_session_new @260
262   - lib3270_set_as400 @261
263   - lib3270_set_auto_reconnect @262
264   - lib3270_set_boolean_property @263
265   - lib3270_set_color_type @264
266   - lib3270_set_connected_initial @265
267   - lib3270_set_cursor_address @266
268   - lib3270_set_cursor_position @267
269   - lib3270_set_dft_buffersize @268
270   - lib3270_set_disconnected @269
271   - lib3270_set_field @270
272   - lib3270_set_has_copy @271
273   - lib3270_set_host_charset @272
274   - lib3270_set_host_type @273
275   - lib3270_set_host_type_by_name @274
276   - lib3270_set_int_property @275
277   - lib3270_set_lock_on_operator_error @276
278   - lib3270_set_log_filename @277
279   - lib3270_set_log_handler @278
280   - lib3270_set_lunames @279
281   - lib3270_set_model @280
282   - lib3270_set_model_name @281
283   - lib3270_set_model_number @282
284   - lib3270_set_numeric_lock @283
285   - lib3270_set_oversize @284
286   - lib3270_set_poll_state @285
287   - lib3270_set_popup_handler @286
288   - lib3270_set_session_id @287
289   - lib3270_set_string @288
290   - lib3270_set_string_at @289
291   - lib3270_set_string_at_address @290
292   - lib3270_set_string_property @291
293   - lib3270_set_syslog @292
294   - lib3270_set_toggle @293
295   - lib3270_set_trace_filename @294
296   - lib3270_set_trace_handler @295
297   - lib3270_set_tso @296
298   - lib3270_set_uint_property @297
299   - lib3270_set_unlock_delay @298
300   - lib3270_set_url @299
301   - lib3270_set_user_data @300
302   - lib3270_setup_session @301
303   - lib3270_ssl_get_crl_download @302
304   - lib3270_ssl_set_crl_download @303
305   - lib3270_state_get_name @304
306   - lib3270_strdup @305
307   - lib3270_strdup_printf @306
308   - lib3270_strip @307
309   - lib3270_sysreq @308
310   - lib3270_testpattern @309
311   - lib3270_toggle @310
312   - lib3270_toggle_get_by_name @311
313   - lib3270_toggle_get_description @312
314   - lib3270_toggle_get_from_id @313
315   - lib3270_toggle_get_label @314
316   - lib3270_toggle_get_name @315
317   - lib3270_toggle_get_summary @316
318   - lib3270_trace_data @317
319   - lib3270_trace_event @318
320   - lib3270_translate_char @319
321   - lib3270_translate_ft_message @320
322   - lib3270_translate_to_address @321
323   - lib3270_unregister_action_group_listener @322
324   - lib3270_unregister_schange @323
325   - lib3270_unregister_toggle_listener @324
326   - lib3270_unselect @325
327   - lib3270_unsigned_property_get_by_name @326
328   - lib3270_update_poll_fd @327
329   - lib3270_vsprintf @328
330   - lib3270_wait @329
331   - lib3270_wait_for_cstate @330
332   - lib3270_wait_for_keyboard_unlock @331
333   - lib3270_wait_for_ready @332
334   - lib3270_wait_for_string @333
335   - lib3270_wait_for_string_at @334
336   - lib3270_wait_for_string_at_address @335
337   - lib3270_wait_for_update @336
338   - lib3270_win32_create_regkey @337
339   - lib3270_win32_get_dword @338
340   - lib3270_win32_local_charset @339
341   - lib3270_win32_strerror @340
342   - lib3270_win32_translate_error_code @341
343   - lib3270_write_dstrace @342
344   - lib3270_write_event_trace @343
345   - lib3270_write_log @344
346   - lib3270_write_nettrace @345
347   - lib3270_write_rc @346
348   - lib3270_write_screen_trace @347
349   - lib3270_write_trace @348
350   - lib3270_write_va_log @349
  124 + lib3270_get_product_name @123
  125 + lib3270_get_program_message @124
  126 + lib3270_get_region @125
  127 + lib3270_get_revision @126
  128 + lib3270_get_screen_size @127
  129 + lib3270_get_selected @128
  130 + lib3270_get_selected_text @129
  131 + lib3270_get_selection @130
  132 + lib3270_get_selection_bounds @131
  133 + lib3270_get_selection_flags @132
  134 + lib3270_get_selection_rectangle @133
  135 + lib3270_get_session_callbacks @134
  136 + lib3270_get_session_id @135
  137 + lib3270_get_ssl_crl_text @136
  138 + lib3270_get_ssl_peer_certificate_text @137
  139 + lib3270_get_ssl_state @138
  140 + lib3270_get_ssl_state_description @139
  141 + lib3270_get_ssl_state_icon_name @140
  142 + lib3270_get_ssl_state_message @141
  143 + lib3270_get_string_at @142
  144 + lib3270_get_string_at_address @143
  145 + lib3270_get_string_properties_list @144
  146 + lib3270_get_task_count @145
  147 + lib3270_get_toggle @146
  148 + lib3270_get_toggle_description @147
  149 + lib3270_get_toggle_id @148
  150 + lib3270_get_toggle_label @149
  151 + lib3270_get_toggle_list @150
  152 + lib3270_get_toggle_name @151
  153 + lib3270_get_toggle_summary @152
  154 + lib3270_get_toggles @153
  155 + lib3270_get_trace_filename @154
  156 + lib3270_get_trace_handler @155
  157 + lib3270_get_translation_domain @156
  158 + lib3270_get_typeahead @157
  159 + lib3270_get_undera @158
  160 + lib3270_get_unlock_delay @159
  161 + lib3270_get_unsigned_properties_list @160
  162 + lib3270_get_url @161
  163 + lib3270_get_user_data @162
  164 + lib3270_get_version @163
  165 + lib3270_get_version_info @164
  166 + lib3270_get_width @165
  167 + lib3270_get_word_bounds @166
  168 + lib3270_getpeername @167
  169 + lib3270_getsockname @168
  170 + lib3270_half_connected @169
  171 + lib3270_has_active_script @170
  172 + lib3270_has_selection @171
  173 + lib3270_host_get_name @172
  174 + lib3270_iconv_free @173
  175 + lib3270_iconv_from_host @174
  176 + lib3270_iconv_new @175
  177 + lib3270_iconv_to_host @176
  178 + lib3270_in_3270 @177
  179 + lib3270_in_ansi @178
  180 + lib3270_in_e @179
  181 + lib3270_in_neither @180
  182 + lib3270_in_sscp @181
  183 + lib3270_in_tn3270e @182
  184 + lib3270_input_string @183
  185 + lib3270_is_as400 @184
  186 + lib3270_is_connected @185
  187 + lib3270_is_disconnected @186
  188 + lib3270_is_formatted @187
  189 + lib3270_is_protected @188
  190 + lib3270_is_ready @189
  191 + lib3270_is_secure @190
  192 + lib3270_is_selected @191
  193 + lib3270_is_tso @192
  194 + lib3270_is_unlocked @193
  195 + lib3270_kybdreset @194
  196 + lib3270_load @195
  197 + lib3270_main_iterate @196
  198 + lib3270_malloc @197
  199 + lib3270_move_cursor @198
  200 + lib3270_move_selected_area @199
  201 + lib3270_move_selection @200
  202 + lib3270_newline @201
  203 + lib3270_nextfield @202
  204 + lib3270_nextword @203
  205 + lib3270_pakey @204
  206 + lib3270_parse_host_type @205
  207 + lib3270_paste_next @206
  208 + lib3270_paste_text @207
  209 + lib3270_pconnected @208
  210 + lib3270_pfkey @209
  211 + lib3270_popup @210
  212 + lib3270_popup_an_errno @211
  213 + lib3270_popup_clone_printf @212
  214 + lib3270_popup_dialog @213
  215 + lib3270_popup_va @214
  216 + lib3270_previousfield @215
  217 + lib3270_previousword @216
  218 + lib3270_print @217
  219 + lib3270_print_all @218
  220 + lib3270_print_copy @219
  221 + lib3270_print_selected @220
  222 + lib3270_property_get_by_name @221
  223 + lib3270_property_get_description @222
  224 + lib3270_property_get_label @223
  225 + lib3270_property_get_name @224
  226 + lib3270_property_get_summary @225
  227 + lib3270_property_get_tooltip @226
  228 + lib3270_realloc @227
  229 + lib3270_receive @228
  230 + lib3270_reconnect @229
  231 + lib3270_register_action_group_listener @230
  232 + lib3270_register_fd_handlers @231
  233 + lib3270_register_io_controller @232
  234 + lib3270_register_schange @233
  235 + lib3270_register_timer_handlers @234
  236 + lib3270_register_toggle_listener @235
  237 + lib3270_remap_char @236
  238 + lib3270_remove_poll @237
  239 + lib3270_remove_poll_fd @238
  240 + lib3270_reselect @239
  241 + lib3270_reset_callbacks @240
  242 + lib3270_reset_charset @241
  243 + lib3270_reset_ft_callbacks @242
  244 + lib3270_ring_bell @243
  245 + lib3270_run_task @244
  246 + lib3270_save @245
  247 + lib3270_save_all @246
  248 + lib3270_save_copy @247
  249 + lib3270_save_selected @248
  250 + lib3270_select_all @249
  251 + lib3270_select_field @250
  252 + lib3270_select_field_at @251
  253 + lib3270_select_region @252
  254 + lib3270_select_to @253
  255 + lib3270_select_word @254
  256 + lib3270_select_word_at @255
  257 + lib3270_selection_get_length @256
  258 + lib3270_selection_new @257
  259 + lib3270_send @258
  260 + lib3270_service_get_name @259
  261 + lib3270_session_free @260
  262 + lib3270_session_new @261
  263 + lib3270_set_as400 @262
  264 + lib3270_set_auto_reconnect @263
  265 + lib3270_set_boolean_property @264
  266 + lib3270_set_color_type @265
  267 + lib3270_set_connected_initial @266
  268 + lib3270_set_cursor_address @267
  269 + lib3270_set_cursor_position @268
  270 + lib3270_set_dft_buffersize @269
  271 + lib3270_set_disconnected @270
  272 + lib3270_set_field @271
  273 + lib3270_set_has_copy @272
  274 + lib3270_set_host_charset @273
  275 + lib3270_set_host_type @274
  276 + lib3270_set_host_type_by_name @275
  277 + lib3270_set_int_property @276
  278 + lib3270_set_lock_on_operator_error @277
  279 + lib3270_set_log_filename @278
  280 + lib3270_set_log_handler @279
  281 + lib3270_set_lunames @280
  282 + lib3270_set_model @281
  283 + lib3270_set_model_name @282
  284 + lib3270_set_model_number @283
  285 + lib3270_set_numeric_lock @284
  286 + lib3270_set_oversize @285
  287 + lib3270_set_poll_state @286
  288 + lib3270_set_popup_handler @287
  289 + lib3270_set_session_id @288
  290 + lib3270_set_string @289
  291 + lib3270_set_string_at @290
  292 + lib3270_set_string_at_address @291
  293 + lib3270_set_string_property @292
  294 + lib3270_set_syslog @293
  295 + lib3270_set_toggle @294
  296 + lib3270_set_trace_filename @295
  297 + lib3270_set_trace_handler @296
  298 + lib3270_set_tso @297
  299 + lib3270_set_uint_property @298
  300 + lib3270_set_unlock_delay @299
  301 + lib3270_set_url @300
  302 + lib3270_set_user_data @301
  303 + lib3270_setup_session @302
  304 + lib3270_ssl_get_crl_download @303
  305 + lib3270_ssl_set_crl_download @304
  306 + lib3270_state_get_name @305
  307 + lib3270_strdup @306
  308 + lib3270_strdup_printf @307
  309 + lib3270_strip @308
  310 + lib3270_sysreq @309
  311 + lib3270_testpattern @310
  312 + lib3270_toggle @311
  313 + lib3270_toggle_get_by_name @312
  314 + lib3270_toggle_get_description @313
  315 + lib3270_toggle_get_from_id @314
  316 + lib3270_toggle_get_label @315
  317 + lib3270_toggle_get_name @316
  318 + lib3270_toggle_get_summary @317
  319 + lib3270_trace_data @318
  320 + lib3270_trace_event @319
  321 + lib3270_translate_char @320
  322 + lib3270_translate_ft_message @321
  323 + lib3270_translate_to_address @322
  324 + lib3270_unregister_action_group_listener @323
  325 + lib3270_unregister_schange @324
  326 + lib3270_unregister_toggle_listener @325
  327 + lib3270_unselect @326
  328 + lib3270_unsigned_property_get_by_name @327
  329 + lib3270_update_poll_fd @328
  330 + lib3270_vsprintf @329
  331 + lib3270_wait @330
  332 + lib3270_wait_for_cstate @331
  333 + lib3270_wait_for_keyboard_unlock @332
  334 + lib3270_wait_for_ready @333
  335 + lib3270_wait_for_string @334
  336 + lib3270_wait_for_string_at @335
  337 + lib3270_wait_for_string_at_address @336
  338 + lib3270_wait_for_update @337
  339 + lib3270_win32_create_regkey @338
  340 + lib3270_win32_get_dword @339
  341 + lib3270_win32_local_charset @340
  342 + lib3270_win32_set_string @341
  343 + lib3270_win32_strerror @342
  344 + lib3270_win32_translate_error_code @343
  345 + lib3270_write_dstrace @344
  346 + lib3270_write_event_trace @345
  347 + lib3270_write_log @346
  348 + lib3270_write_nettrace @347
  349 + lib3270_write_rc @348
  350 + lib3270_write_screen_trace @349
  351 + lib3270_write_trace @350
  352 + lib3270_write_va_log @351
... ...
win/x86_64/_service
... ... @@ -2,9 +2,10 @@
2 2  
3 3 <!-- https://github.com/openSUSE/obs-service-tar_scm/blob/master/tar_scm.py -->
4 4 <service name="tar_scm">
5   - <param name="changesgenerate">enable</param>
6   - <param name="versionformat">@PARENT_TAG@</param>
  5 + <param name="changesgenerate">enable</param>
7 6 <param name="url">https://github.com/PerryWerneck/lib3270.git</param>
  7 + <param name="revision">develop</param>
  8 + <param name="versionformat">@PARENT_TAG@+git%cd</param>
8 9 <param name="scm">git</param>
9 10 </service>
10 11  
... ...
win/x86_64/mingw64-lib3270.spec
... ... @@ -58,6 +58,7 @@ BuildRequires: mingw64-libopenssl-devel
58 58 BuildRequires: mingw64-zlib-devel
59 59 BuildRequires: mingw64(lib:iconv)
60 60 BuildRequires: mingw64(lib:intl)
  61 +BuildRequires: mingw64-gettext-tools
61 62  
62 63 %description
63 64 TN3270 access library, originally designed as part of the %{_product} application.
... ... @@ -124,7 +125,7 @@ make DESTDIR=%{buildroot} install
124 125 %dir %{_mingw64_datadir}/%{_product}
125 126  
126 127 %{_mingw64_bindir}/*.dll
127   -%{_mingw64_libdir}/*.dll
  128 +%exclude %{_mingw64_libdir}/*.dll
128 129  
129 130 %files devel
130 131 %defattr(-,root,root)
... ...