diff --git a/android/.classpath b/android/.classpath
new file mode 100644
index 0000000..a4763d1
--- /dev/null
+++ b/android/.classpath
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/android/AndroidManifest.xml b/android/AndroidManifest.xml
new file mode 100644
index 0000000..bc94151
--- /dev/null
+++ b/android/AndroidManifest.xml
@@ -0,0 +1,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/Makefile b/android/Makefile
new file mode 100644
index 0000000..0daecf0
--- /dev/null
+++ b/android/Makefile
@@ -0,0 +1,40 @@
+#
+# "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
+# (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
+# aplicativos mainframe. Registro no INPI sob o nome G3270.
+#
+# Copyright (C) <2008>
+#
+# Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
+# os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
+# Free Software Foundation.
+#
+# Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
+# GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
+# A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
+# obter mais detalhes.
+#
+# Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
+# programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA, 02111-1307, USA
+#
+# Contatos:
+#
+# perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
+#
+
+JAVAH=javah
+NDKBUILD=/opt/android-ndk-r8/ndk-build
+CLASSPATH=br/com/bb/pw3270
+
+Debug: jni/lib3270jni.h
+ @$(NDKBUILD)
+
+clean:
+ @rm -fr obj
+ @rm -f jni/lib3270jni.h
+
+jni/lib3270jni.h: bin/classes/$(CLASSPATH)/lib3270.class
+ @echo $@ ...
+ @$(JAVAH) -o $@ -classpath bin/classes $(subst /,.,$(CLASSPATH)).lib3270
+
diff --git a/android/jni/Android.mk b/android/jni/Android.mk
new file mode 100644
index 0000000..cd3bd25
--- /dev/null
+++ b/android/jni/Android.mk
@@ -0,0 +1,39 @@
+#
+# "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
+# (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
+# aplicativos mainframe. Registro no INPI sob o nome G3270.
+#
+# Copyright (C) <2008>
+#
+# Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
+# os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
+# Free Software Foundation.
+#
+# Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
+# GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
+# A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
+# obter mais detalhes.
+#
+# Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
+# programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple
+# Place, Suite 330, Boston, MA, 02111-1307, USA
+#
+# Contatos:
+#
+# perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
+#
+
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+
+include ../src/lib3270/sources.mak
+
+LOCAL_CFLAGS=-I../src/include
+LOCAL_DEFAULT_CPP_EXTENSION := cpp
+LOCAL_MODULE := lib3270
+LOCAL_SRC_FILES := $(foreach SRC, $(TERMINAL_SOURCES), ../../src/lib3270/$(SRC)) \
+ main.cpp misc.cpp
+
+include $(BUILD_SHARED_LIBRARY)
+
diff --git a/android/jni/globals.h b/android/jni/globals.h
new file mode 100644
index 0000000..3560298
--- /dev/null
+++ b/android/jni/globals.h
@@ -0,0 +1,30 @@
+/*
+ * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
+ * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
+ * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270.
+ *
+ * Copyright (C) <2008>
+ *
+ * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
+ * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
+ * Free Software Foundation.
+ *
+ * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
+ * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
+ * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
+ * obter mais detalhes.
+ *
+ * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
+ * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA, 02111-1307, USA
+ *
+ * Este programa está nomeado como globals.h e possui - linhas de código.
+ *
+ * Contatos:
+ *
+ * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
+ *
+ */
+
+ #include "lib3270jni.h"
+ #include
diff --git a/android/jni/main.cpp b/android/jni/main.cpp
new file mode 100644
index 0000000..d23fd7b
--- /dev/null
+++ b/android/jni/main.cpp
@@ -0,0 +1,80 @@
+/*
+ * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
+ * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
+ * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270.
+ *
+ * Copyright (C) <2008>
+ *
+ * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
+ * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
+ * Free Software Foundation.
+ *
+ * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
+ * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
+ * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
+ * obter mais detalhes.
+ *
+ * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
+ * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA, 02111-1307, USA
+ *
+ * Este programa está nomeado como main.cpp e possui - linhas de código.
+ *
+ * Contatos:
+ *
+ * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
+ *
+ */
+
+ #include "globals.h"
+ #include
+
+/*--[ Defines ]--------------------------------------------------------------------------------------*/
+
+ typedef struct _info
+ {
+ JNIEnv * env;
+ jobject obj;
+
+ } INFO;
+
+/*--[ Implement ]------------------------------------------------------------------------------------*/
+
+JNIEXPORT jint JNICALL Java_br_com_bb_pw3270_lib3270_init(JNIEnv *env, jclass obj)
+{
+ H3270 * session = lib3270_session_new("");
+
+ return 0;
+}
+
+JNIEXPORT jint JNICALL Java_br_com_bb_pw3270_lib3270_processEvents(JNIEnv *env, jobject obj)
+{
+ INFO data = { env, obj };
+ H3270 * session = lib3270_get_default_session_handle();
+
+ session->widget = &data;
+ lib3270_main_iterate(session,1);
+ session->widget = 0;
+ return 0;
+}
+
+JNIEXPORT jboolean JNICALL Java_br_com_bb_pw3270_lib3270_isConnected(JNIEnv *env, jobject obj)
+{
+ return (lib3270_connected(lib3270_get_default_session_handle())) ? JNI_TRUE : JNI_FALSE;;
+}
+
+JNIEXPORT jboolean JNICALL Java_br_com_bb_pw3270_lib3270_isTerminalReady(JNIEnv *env, jobject obj)
+{
+ return JNI_FALSE;
+}
+
+JNIEXPORT void JNICALL Java_br_com_bb_pw3270_lib3270_setHost(JNIEnv *env, jobject obj, jstring hostname)
+{
+ lib3270_set_host(lib3270_get_default_session_handle(),env->GetStringUTFChars(hostname, 0));
+}
+
+JNIEXPORT jstring JNICALL Java_br_com_bb_pw3270_lib3270_getHost(JNIEnv *env, jobject obj)
+{
+ return env->NewStringUTF(lib3270_get_host(lib3270_get_default_session_handle()));
+}
+
diff --git a/android/jni/misc.cpp b/android/jni/misc.cpp
new file mode 100644
index 0000000..9c70dc6
--- /dev/null
+++ b/android/jni/misc.cpp
@@ -0,0 +1,46 @@
+/*
+ * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
+ * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
+ * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270.
+ *
+ * Copyright (C) <2008>
+ *
+ * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
+ * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
+ * Free Software Foundation.
+ *
+ * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
+ * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
+ * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
+ * obter mais detalhes.
+ *
+ * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
+ * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple
+ * Place, Suite 330, Boston, MA, 02111-1307, USA
+ *
+ * Este programa está nomeado como misc.cpp e possui - linhas de código.
+ *
+ * Contatos:
+ *
+ * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
+ *
+ */
+
+ #include "globals.h"
+
+/*--[ Implement ]------------------------------------------------------------------------------------*/
+
+JNIEXPORT jstring JNICALL Java_br_com_bb_pw3270_lib3270_getVersion(JNIEnv *env, jobject obj)
+{
+ return env->NewStringUTF(lib3270_get_version());
+}
+
+JNIEXPORT jstring JNICALL Java_br_com_bb_pw3270_lib3270_getRevision(JNIEnv *env, jobject obj)
+{
+ return env->NewStringUTF(lib3270_get_revision());
+}
+
+JNIEXPORT jstring JNICALL Java_br_com_bb_pw3270_lib3270_getEncoding(JNIEnv *env, jobject obj)
+{
+ return env->NewStringUTF(lib3270_get_charset(lib3270_get_default_session_handle()));
+}
diff --git a/android/lib3270NDK.cbp b/android/lib3270NDK.cbp
new file mode 100644
index 0000000..8fbfc77
--- /dev/null
+++ b/android/lib3270NDK.cbp
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/android/proguard-project.txt b/android/proguard-project.txt
new file mode 100644
index 0000000..f2fe155
--- /dev/null
+++ b/android/proguard-project.txt
@@ -0,0 +1,20 @@
+# To enable ProGuard in your project, edit project.properties
+# to define the proguard.config property as described in that file.
+#
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in ${sdk.dir}/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the ProGuard
+# include property in project.properties.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
diff --git a/android/project.properties b/android/project.properties
new file mode 100644
index 0000000..0840b4a
--- /dev/null
+++ b/android/project.properties
@@ -0,0 +1,14 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system edit
+# "ant.properties", and override values to adapt the script to your
+# project structure.
+#
+# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
+#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
+
+# Project target.
+target=android-15
diff --git a/android/res/layout/main.xml b/android/res/layout/main.xml
new file mode 100644
index 0000000..5591f21
--- /dev/null
+++ b/android/res/layout/main.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/android/src/br/com/bb/pw3270/PW3270Activity.java b/android/src/br/com/bb/pw3270/PW3270Activity.java
new file mode 100644
index 0000000..5726624
--- /dev/null
+++ b/android/src/br/com/bb/pw3270/PW3270Activity.java
@@ -0,0 +1,27 @@
+package br.com.bb.pw3270;
+
+import android.app.Activity;
+import android.os.Bundle;
+import android.widget.TextView;
+import android.widget.Button;
+
+public class PW3270Activity extends Activity {
+
+ lib3270 host;
+
+ /** Called when the activity is first created. */
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.main);
+
+ TextView text = (TextView) findViewById(R.id.text);
+ Button btn = (Button) findViewById(R.id.connect);
+
+
+
+ host = new lib3270();
+
+ text.setText(host.getVersion());
+ }
+}
\ No newline at end of file
diff --git a/android/src/br/com/bb/pw3270/lib3270.java b/android/src/br/com/bb/pw3270/lib3270.java
new file mode 100644
index 0000000..af385f8
--- /dev/null
+++ b/android/src/br/com/bb/pw3270/lib3270.java
@@ -0,0 +1,60 @@
+package br.com.bb.pw3270;
+
+import java.lang.Thread;
+
+public class lib3270 extends Thread
+{
+
+ static
+ {
+ System.loadLibrary("3270");
+ init();
+ }
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args)
+ {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * Connect to host, keep event loop running until disconnected.
+ */
+ public void run()
+ {
+ do_connect();
+ while(isConnected())
+ processEvents();
+ }
+
+ static private native int init();
+
+ private native int processEvents();
+ private native int do_connect();
+
+ // Misc calls
+ public native String getEncoding();
+
+ public native String getVersion();
+ public native String getRevision();
+
+ // Connect/Disconnect status
+ public native void setHost(String host);
+ public native String getHost();
+ public native boolean isConnected();
+ public native boolean isTerminalReady();
+
+ public void connect(String hostname)
+ {
+ setHost(hostname);
+ start();
+ }
+
+
+
+
+
+}
diff --git a/pw3270.cbp b/pw3270.cbp
index 8d66344..ef79a79 100644
--- a/pw3270.cbp
+++ b/pw3270.cbp
@@ -47,6 +47,7 @@
+
diff --git a/src/android/.classpath b/src/android/.classpath
deleted file mode 100644
index a4763d1..0000000
--- a/src/android/.classpath
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
diff --git a/src/android/AndroidManifest.xml b/src/android/AndroidManifest.xml
deleted file mode 100644
index bc94151..0000000
--- a/src/android/AndroidManifest.xml
+++ /dev/null
@@ -1,23 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/android/Makefile b/src/android/Makefile
deleted file mode 100644
index 0daecf0..0000000
--- a/src/android/Makefile
+++ /dev/null
@@ -1,40 +0,0 @@
-#
-# "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
-# (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
-# aplicativos mainframe. Registro no INPI sob o nome G3270.
-#
-# Copyright (C) <2008>
-#
-# Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
-# os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
-# Free Software Foundation.
-#
-# Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
-# GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
-# A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
-# obter mais detalhes.
-#
-# Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
-# programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple
-# Place, Suite 330, Boston, MA, 02111-1307, USA
-#
-# Contatos:
-#
-# perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
-#
-
-JAVAH=javah
-NDKBUILD=/opt/android-ndk-r8/ndk-build
-CLASSPATH=br/com/bb/pw3270
-
-Debug: jni/lib3270jni.h
- @$(NDKBUILD)
-
-clean:
- @rm -fr obj
- @rm -f jni/lib3270jni.h
-
-jni/lib3270jni.h: bin/classes/$(CLASSPATH)/lib3270.class
- @echo $@ ...
- @$(JAVAH) -o $@ -classpath bin/classes $(subst /,.,$(CLASSPATH)).lib3270
-
diff --git a/src/android/jni/Android.mk b/src/android/jni/Android.mk
deleted file mode 100644
index ec4f784..0000000
--- a/src/android/jni/Android.mk
+++ /dev/null
@@ -1,39 +0,0 @@
-#
-# "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
-# (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
-# aplicativos mainframe. Registro no INPI sob o nome G3270.
-#
-# Copyright (C) <2008>
-#
-# Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
-# os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
-# Free Software Foundation.
-#
-# Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
-# GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
-# A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
-# obter mais detalhes.
-#
-# Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
-# programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple
-# Place, Suite 330, Boston, MA, 02111-1307, USA
-#
-# Contatos:
-#
-# perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
-#
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-include ../lib3270/sources.mak
-
-LOCAL_CFLAGS=-I../include
-LOCAL_DEFAULT_CPP_EXTENSION := cpp
-LOCAL_MODULE := lib3270
-LOCAL_SRC_FILES := $(foreach SRC, $(TERMINAL_SOURCES), ../../lib3270/$(SRC)) \
- main.cpp misc.cpp
-
-include $(BUILD_SHARED_LIBRARY)
-
diff --git a/src/android/jni/globals.h b/src/android/jni/globals.h
deleted file mode 100644
index 3560298..0000000
--- a/src/android/jni/globals.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
- * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
- * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270.
- *
- * Copyright (C) <2008>
- *
- * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
- * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
- * Free Software Foundation.
- *
- * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
- * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
- * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
- * obter mais detalhes.
- *
- * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
- * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA, 02111-1307, USA
- *
- * Este programa está nomeado como globals.h e possui - linhas de código.
- *
- * Contatos:
- *
- * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
- *
- */
-
- #include "lib3270jni.h"
- #include
diff --git a/src/android/jni/main.cpp b/src/android/jni/main.cpp
deleted file mode 100644
index df2e44e..0000000
--- a/src/android/jni/main.cpp
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
- * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
- * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270.
- *
- * Copyright (C) <2008>
- *
- * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
- * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
- * Free Software Foundation.
- *
- * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
- * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
- * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
- * obter mais detalhes.
- *
- * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
- * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA, 02111-1307, USA
- *
- * Este programa está nomeado como main.cpp e possui - linhas de código.
- *
- * Contatos:
- *
- * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
- *
- */
-
- #include "globals.h"
- #include
-
-/*--[ Defines ]--------------------------------------------------------------------------------------*/
-
- typedef struct _info
- {
- JNIEnv * env;
- jobject obj;
-
- } INFO;
-
-/*--[ Implement ]------------------------------------------------------------------------------------*/
-
-JNIEXPORT jint JNICALL Java_br_com_bb_pw3270_lib3270_init(JNIEnv *env, jclass obj)
-{
- H3270 * session = lib3270_session_new("");
-
- return 0;
-}
-
-JNIEXPORT jint JNICALL Java_br_com_bb_pw3270_lib3270_processEvents(JNIEnv *env, jobject obj)
-{
- /*
- INFO data = { env, obj };
- H3270 * session = lib3270_get_default_session_handle();
-
- session->widget = &data;
- lib3270_main_iterate(session,1);
- session->widget = 0;
- */
- return 0;
-}
-
-JNIEXPORT jboolean JNICALL Java_br_com_bb_pw3270_lib3270_isConnected(JNIEnv *env, jobject obj)
-{
-// return (lib3270_connected(lib3270_get_default_session_handle())) ? JNI_TRUE : JNI_FALSE;;
- return JNI_FALSE;
-}
-
-JNIEXPORT jboolean JNICALL Java_br_com_bb_pw3270_lib3270_isTerminalReady(JNIEnv *env, jobject obj)
-{
- return JNI_FALSE;
-}
-
-JNIEXPORT void JNICALL Java_br_com_bb_pw3270_lib3270_setHost(JNIEnv *env, jobject obj, jstring hostname)
-{
-
-}
-
-JNIEXPORT jstring JNICALL Java_br_com_bb_pw3270_lib3270_getHost(JNIEnv *env, jobject obj)
-{
- return env->NewStringUTF("");
-}
-
diff --git a/src/android/jni/misc.cpp b/src/android/jni/misc.cpp
deleted file mode 100644
index 9c70dc6..0000000
--- a/src/android/jni/misc.cpp
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * "Software pw3270, desenvolvido com base nos códigos fontes do WC3270 e X3270
- * (Paul Mattes Paul.Mattes@usa.net), de emulação de terminal 3270 para acesso a
- * aplicativos mainframe. Registro no INPI sob o nome G3270. Registro no INPI sob o nome G3270.
- *
- * Copyright (C) <2008>
- *
- * Este programa é software livre. Você pode redistribuí-lo e/ou modificá-lo sob
- * os termos da GPL v.2 - Licença Pública Geral GNU, conforme publicado pela
- * Free Software Foundation.
- *
- * Este programa é distribuído na expectativa de ser útil, mas SEM QUALQUER
- * GARANTIA; sem mesmo a garantia implícita de COMERCIALIZAÇÃO ou de ADEQUAÇÃO
- * A QUALQUER PROPÓSITO EM PARTICULAR. Consulte a Licença Pública Geral GNU para
- * obter mais detalhes.
- *
- * Você deve ter recebido uma cópia da Licença Pública Geral GNU junto com este
- * programa; se não, escreva para a Free Software Foundation, Inc., 59 Temple
- * Place, Suite 330, Boston, MA, 02111-1307, USA
- *
- * Este programa está nomeado como misc.cpp e possui - linhas de código.
- *
- * Contatos:
- *
- * perry.werneck@gmail.com (Alexandre Perry de Souza Werneck)
- *
- */
-
- #include "globals.h"
-
-/*--[ Implement ]------------------------------------------------------------------------------------*/
-
-JNIEXPORT jstring JNICALL Java_br_com_bb_pw3270_lib3270_getVersion(JNIEnv *env, jobject obj)
-{
- return env->NewStringUTF(lib3270_get_version());
-}
-
-JNIEXPORT jstring JNICALL Java_br_com_bb_pw3270_lib3270_getRevision(JNIEnv *env, jobject obj)
-{
- return env->NewStringUTF(lib3270_get_revision());
-}
-
-JNIEXPORT jstring JNICALL Java_br_com_bb_pw3270_lib3270_getEncoding(JNIEnv *env, jobject obj)
-{
- return env->NewStringUTF(lib3270_get_charset(lib3270_get_default_session_handle()));
-}
diff --git a/src/android/lib3270NDK.cbp b/src/android/lib3270NDK.cbp
deleted file mode 100644
index 8fbfc77..0000000
--- a/src/android/lib3270NDK.cbp
+++ /dev/null
@@ -1,46 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/src/android/proguard-project.txt b/src/android/proguard-project.txt
deleted file mode 100644
index f2fe155..0000000
--- a/src/android/proguard-project.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-# To enable ProGuard in your project, edit project.properties
-# to define the proguard.config property as described in that file.
-#
-# Add project specific ProGuard rules here.
-# By default, the flags in this file are appended to flags specified
-# in ${sdk.dir}/tools/proguard/proguard-android.txt
-# You can edit the include path and order by changing the ProGuard
-# include property in project.properties.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# Add any project specific keep options here:
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
diff --git a/src/android/project.properties b/src/android/project.properties
deleted file mode 100644
index 0840b4a..0000000
--- a/src/android/project.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-# This file is automatically generated by Android Tools.
-# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
-#
-# This file must be checked in Version Control Systems.
-#
-# To customize properties used by the Ant build system edit
-# "ant.properties", and override values to adapt the script to your
-# project structure.
-#
-# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
-#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
-
-# Project target.
-target=android-15
diff --git a/src/android/res/layout/main.xml b/src/android/res/layout/main.xml
deleted file mode 100644
index 5591f21..0000000
--- a/src/android/res/layout/main.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/android/src/br/com/bb/pw3270/PW3270Activity.java b/src/android/src/br/com/bb/pw3270/PW3270Activity.java
deleted file mode 100644
index 5726624..0000000
--- a/src/android/src/br/com/bb/pw3270/PW3270Activity.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package br.com.bb.pw3270;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.widget.TextView;
-import android.widget.Button;
-
-public class PW3270Activity extends Activity {
-
- lib3270 host;
-
- /** Called when the activity is first created. */
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.main);
-
- TextView text = (TextView) findViewById(R.id.text);
- Button btn = (Button) findViewById(R.id.connect);
-
-
-
- host = new lib3270();
-
- text.setText(host.getVersion());
- }
-}
\ No newline at end of file
diff --git a/src/android/src/br/com/bb/pw3270/lib3270.java b/src/android/src/br/com/bb/pw3270/lib3270.java
deleted file mode 100644
index 1c0e357..0000000
--- a/src/android/src/br/com/bb/pw3270/lib3270.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package br.com.bb.pw3270;
-
-import java.lang.Thread;
-
-public class lib3270 extends Thread
-{
-
- static
- {
- System.loadLibrary("3270");
- init();
- }
-
- /**
- * @param args
- */
- public static void main(String[] args)
- {
- // TODO Auto-generated method stub
-
- }
-
- /**
- * Connect to host, keep event loop running until disconnected.
- */
- public void run()
- {
- while(isConnected())
- processEvents();
- }
-
- static private native int init();
- private native int processEvents();
-
- // Misc calls
- public native String getEncoding();
-
- public native String getVersion();
- public native String getRevision();
-
- // Connect/Disconnect status
- public native void setHost(String host);
- public native String getHost();
- public native boolean isConnected();
- public native boolean isTerminalReady();
-
-
-
-
-}
diff --git a/src/include/lib3270/session.h b/src/include/lib3270/session.h
index 2cb3b39..3a77487 100644
--- a/src/include/lib3270/session.h
+++ b/src/include/lib3270/session.h
@@ -96,6 +96,7 @@
int inlcr : 1;
int onlcr : 1;
int bsd_tm : 1;
+ int syncing : 1;
char * oversize;
@@ -174,6 +175,7 @@
// xio
void * ns_read_id;
void * ns_exception_id;
+
char reading;
char excepting;
diff --git a/src/lib3270/XtGlue.c b/src/lib3270/XtGlue.c
index e3f3ad0..77042e3 100644
--- a/src/lib3270/XtGlue.c
+++ b/src/lib3270/XtGlue.c
@@ -38,7 +38,7 @@
#include "globals.h"
#include "api.h"
-#include
+// #include
#if defined(_WIN32)
#include "appres.h"
@@ -179,8 +179,7 @@ static void * DefaultAddTimeOut(unsigned long interval_ms, H3270 *session, void
Trace("%s session=%p proc=%p",__FUNCTION__,session,proc);
- t_new = (timeout_t *)Malloc(sizeof(timeout_t));
- memset(t_new,0,sizeof(timeout_t));
+ t_new = (timeout_t *) lib3270_malloc(sizeof(timeout_t));
t_new->proc = proc;
t_new->session = session;
@@ -244,7 +243,7 @@ static void DefaultRemoveTimeOut(void * timer)
prev->next = t->next;
else
timeouts = t->next;
- Free(t);
+ lib3270_free(t);
return;
}
prev = t;
@@ -268,8 +267,7 @@ static void * DefaultAddInput(int source, H3270 *session, void (*fn)(H3270 *sess
Trace("%s session=%p proc=%p",__FUNCTION__,session,fn);
- ip = (input_t *) Malloc(sizeof(input_t));
- memset(ip,0,sizeof(input_t));
+ ip = (input_t *) lib3270_malloc(sizeof(input_t));
ip->source = source;
ip->condition = InputReadMask;
@@ -293,8 +291,7 @@ static void * DefaultAddExcept(int source, H3270 *session, void (*fn)(H3270 *ses
Trace("%s session=%p proc=%p",__FUNCTION__,session,fn);
- ip = (input_t *)Malloc(sizeof(input_t));
- memset(ip,0,sizeof(input_t));
+ ip = (input_t *) lib3270_malloc(sizeof(input_t));
ip->source = source;
ip->condition = InputExceptMask;
@@ -317,7 +314,7 @@ static void * DefaultAddOutput(int source, H3270 *session, void (*fn)(H3270 *ses
Trace("%s session=%p proc=%p",__FUNCTION__,session,fn);
- ip = (input_t *)Malloc(sizeof(input_t));
+ ip = (input_t *)lib3270_malloc(sizeof(input_t));
memset(ip,0,sizeof(input_t));
ip->source = source;
@@ -356,7 +353,7 @@ static void DefaultRemoveInput(void *id)
else
inputs = ip->next;
- Free(ip);
+ lib3270_free(ip);
inputs_changed = True;
}
@@ -545,7 +542,7 @@ static int DefaultProcessEvents(int block)
t->in_play = True;
(*t->proc)(t->session);
processed_any = True;
- Free(t);
+ lib3270_free(t);
} else
break;
}
diff --git a/src/lib3270/actions.c b/src/lib3270/actions.c
index 472c505..84e7f82 100644
--- a/src/lib3270/actions.c
+++ b/src/lib3270/actions.c
@@ -163,10 +163,10 @@ action_internal(XtActionProc action, enum iaction cause, const char *parm1,
// Free the parm copies.
switch (count) {
case 2:
- Free(parms[1]);
+ lib3270_free(parms[1]);
// fall through...
case 1:
- Free(parms[0]);
+ lib3270_free(parms[0]);
break;
default:
break;
diff --git a/src/lib3270/ansi.c b/src/lib3270/ansi.c
index 07dda82..6728a28 100644
--- a/src/lib3270/ansi.c
+++ b/src/lib3270/ansi.c
@@ -600,7 +600,7 @@ ansi_reset(int ig1 unused, int ig2 unused)
saved_altbuffer = False;
scroll_top = 1;
scroll_bottom = h3270.rows;
- Replace(tabs, (unsigned char *)Malloc((h3270.cols+7)/8));
+ Replace(tabs, (unsigned char *)lib3270_malloc((h3270.cols+7)/8));
for (i = 0; i < (h3270.cols+7)/8; i++)
tabs[i] = 0x01;
held_wrap = False;
diff --git a/src/lib3270/charset.c b/src/lib3270/charset.c
index d9c841a..63d37b0 100644
--- a/src/lib3270/charset.c
+++ b/src/lib3270/charset.c
@@ -227,7 +227,7 @@ enum cs_result charset_init(H3270 *session, const char *csname)
// Grab the non-Euro definition.
basename = xs_buffer("%.*s", (int) (strlen(csname) - ES_SIZE), csname);
cs = get_charset_def(basename);
- Free(basename);
+ lib3270_free(basename);
}
*/
if (!ccs)
@@ -251,8 +251,8 @@ enum cs_result charset_init(H3270 *session, const char *csname)
rc = resource_charset(csname, ccs, cftcs);
/* Free them. */
- Free(ccs);
- Free(cftcs);
+ lib3270_free(ccs);
+ lib3270_free(cftcs);
#if defined(DEBUG_CHARSET) /*[*/
if (rc == CS_OKAY)
@@ -340,7 +340,7 @@ static void set_cgcsgids(const char *spec)
}
n_ids++;
}
- Free(spec_copy);
+ lib3270_free(spec_copy);
if (n_ids > 0)
return;
}
@@ -681,7 +681,7 @@ static enum cs_result remap_chars(const char *csname, char *spec, remap_scope sc
remap_one(ebc, iso, scope, one_way);
}
}
- Free(spec);
+ lib3270_free(spec);
return rc;
}
diff --git a/src/lib3270/ft.c b/src/lib3270/ft.c
index af21147..89299d9 100644
--- a/src/lib3270/ft.c
+++ b/src/lib3270/ft.c
@@ -340,8 +340,7 @@ static void set_ft_state(H3270FT *session, LIB3270_FT_STATE state);
ft_last_cr = False;
ft_is_cut = False;
- ftHandle = malloc(sizeof(H3270FT));
- memset(ftHandle,0,sizeof(H3270FT));
+ ftHandle = lib3270_malloc(sizeof(H3270FT));
ftHandle->sz = sizeof(H3270FT);
ftHandle->host = session;
diff --git a/src/lib3270/ft_cut.c b/src/lib3270/ft_cut.c
index fc03b40..769bc36 100644
--- a/src/lib3270/ft_cut.c
+++ b/src/lib3270/ft_cut.c
@@ -36,7 +36,7 @@
*/
#include
-#include
+// #include
#include "globals.h"
@@ -340,7 +340,7 @@ cut_control_code(void)
}
else
{
- bp = buf = Malloc(81);
+ bp = buf = lib3270_malloc(81);
for (i = 0; i < 80; i++)
*bp++ = ebc2asc[h3270.ea_buf[O_CC_MESSAGE + i].cc];
@@ -360,7 +360,7 @@ cut_control_code(void)
strcpy(buf, N_( "Transfer cancelled by host" ) );
}
ft_complete(NULL,buf);
- Free(buf);
+ lib3270_free(buf);
break;
default:
@@ -528,7 +528,7 @@ static void cut_abort(unsigned short reason, const char *fmt, ...)
va_list args;
if(saved_errmsg)
- free(saved_errmsg);
+ lib3270_free(saved_errmsg);
/* Save the error message. */
va_start(args, fmt);
diff --git a/src/lib3270/ft_dft.c b/src/lib3270/ft_dft.c
index 06a99f3..9e619f2 100644
--- a/src/lib3270/ft_dft.c
+++ b/src/lib3270/ft_dft.c
@@ -55,7 +55,7 @@
#include "utilc.h"
#include
-#include
+// #include
extern unsigned char aid;
@@ -243,7 +243,7 @@ dft_data_insert(struct data_buffer *data_bufr)
unsigned char *dollarp;
/* Get storage to copy the message. */
- msgp = (unsigned char *)Malloc(my_length + 1);
+ msgp = (unsigned char *)lib3270_malloc(my_length + 1);
/* Copy the message. */
memcpy(msgp, data_bufr->data, my_length);
@@ -257,15 +257,15 @@ dft_data_insert(struct data_buffer *data_bufr)
/* If transfer completed ok, use our msg. */
if (memcmp(msgp, END_TRANSFER, strlen(END_TRANSFER)) == 0) {
- Free(msgp);
+ lib3270_free(msgp);
ft_complete(NULL,NULL);
} else if (lib3270_get_ft_state(&h3270) == FT_ABORT_SENT && abort_string != CN) {
- Free(msgp);
+ lib3270_free(msgp);
ft_complete(NULL,abort_string);
Replace(abort_string, CN);
} else {
ft_complete(NULL,(char *)msgp);
- Free(msgp);
+ lib3270_free(msgp);
}
} else if (my_length > 0) {
/* Write the data out to the file. */
@@ -459,7 +459,7 @@ dft_get_request(void)
dft_savebuf_len = obptr - obuf;
if (dft_savebuf_len > dft_savebuf_max) {
dft_savebuf_max = dft_savebuf_len;
- Replace(dft_savebuf, (unsigned char *)Malloc(dft_savebuf_max));
+ Replace(dft_savebuf, (unsigned char *)lib3270_malloc(dft_savebuf_max));
}
(void) memcpy(dft_savebuf, obuf, dft_savebuf_len);
aid = AID_SF;
@@ -494,7 +494,7 @@ static void dft_abort(unsigned short code, const char *fmt, ...)
va_list args;
if(abort_string)
- free(abort_string);
+ lib3270_free(abort_string);
va_start(args, fmt);
abort_string = xs_vsprintf(fmt, args);
diff --git a/src/lib3270/globals.h b/src/lib3270/globals.h
index f691c54..b77e997 100644
--- a/src/lib3270/globals.h
+++ b/src/lib3270/globals.h
@@ -318,7 +318,7 @@ LIB3270_INTERNAL struct trans_list *trans_list;
#define CN ((char *) NULL)
#define PN ((XtPointer) NULL)
-#define Replace(var, value) { Free(var); var = (value); }
+#define Replace(var, value) { lib3270_free(var); var = (value); }
/* Configuration change masks. */
#define NO_CHANGE 0x0000 /* no change */
diff --git a/src/lib3270/glue.c b/src/lib3270/glue.c
index b67883d..b58b0ca 100644
--- a/src/lib3270/glue.c
+++ b/src/lib3270/glue.c
@@ -563,7 +563,7 @@ parse_xrm(const char *arg, const char *where)
type = resources[i].type;
#if defined(C3270) /*[*/
if (address == NULL) {
- add_buf = Malloc(strlen(s) + 1);
+ add_buf = lib3270_malloc(strlen(s) + 1);
address = add_buf;
}
#endif /*]*/
@@ -619,7 +619,7 @@ parse_xrm(const char *arg, const char *where)
}
break;
case XRM_STRING:
- t = Malloc(strlen(s) + 1);
+ t = lib3270_malloc(strlen(s) + 1);
*(char **)address = t;
if (*s == '"') {
Boolean quoted = False;
@@ -675,7 +675,7 @@ parse_xrm(const char *arg, const char *where)
if (arbitrary) {
char *rsname;
- rsname = Malloc(rnlen + 1);
+ rsname = lib3270_malloc(rnlen + 1);
(void) strncpy(rsname, arg + match_len, rnlen);
rsname[rnlen] = '\0';
add_resource(rsname, hide);
@@ -702,7 +702,7 @@ read_resource_file(const char *filename, Boolean fatal)
}
/* Merge in what's in the file into the resource database. */
- where = Malloc(strlen(filename) + 64);
+ where = lib3270_malloc(strlen(filename) + 64);
ilen = 0;
while (fgets(buf + ilen, sizeof(buf) - ilen, f) != CN || ilen) {
@@ -783,7 +783,7 @@ read_resource_file(const char *filename, Boolean fatal)
/* Get ready for the next iteration. */
ilen = 0;
}
- Free(where);
+ lib3270_free(where);
return 0;
}
diff --git a/src/lib3270/host.c b/src/lib3270/host.c
index 441bc83..5ee7c02 100644
--- a/src/lib3270/host.c
+++ b/src/lib3270/host.c
@@ -52,7 +52,7 @@
#include "xioc.h"
#include
-#include
+// #include
#define RECONNECT_MS 2000 /* 2 sec before reconnecting to host */
#define RECONNECT_ERR_MS 5000 /* 5 sec before reconnecting to host */
@@ -124,10 +124,10 @@ hostfile_init(void)
ResHostsFile);
continue;
}
- h = (struct host *)Malloc(sizeof(*h));
+ h = (struct host *)lib3270_malloc(sizeof(*h));
if (!split_hier(NewString(name), &h->name,
&h->parents)) {
- Free(h);
+ lib3270_free(h);
continue;
}
h->hostname = NewString(hostname);
@@ -160,7 +160,7 @@ hostfile_init(void)
popup_an_errno(errno, "Cannot open " ResHostsFile " '%s'",
appres.hostsfile);
}
- Free(hostfile_name);
+ lib3270_free(hostfile_name);
// #if defined(X3270_DISPLAY)
// save_recent(CN);
@@ -465,7 +465,7 @@ split_host(H3270 *hSession, char *s, char *ansi, char *std_ds, char *passthru,
goto split_success;
split_fail:
- Free(r);
+ lib3270_free(r);
r = CN;
split_success:
@@ -803,7 +803,7 @@ LIB3270_EXPORT const char * lib3270_set_host(H3270 *h, const char *n)
trace("new hostname is \"%s\"",new_hostname);
if(h->full_current_host)
- free(h->full_current_host);
+ lib3270_free(h->full_current_host);
h->full_current_host = new_hostname;
diff --git a/src/lib3270/init.c b/src/lib3270/init.c
index 6c94bfc..a6e4e45 100644
--- a/src/lib3270/init.c
+++ b/src/lib3270/init.c
@@ -61,7 +61,7 @@ void lib3270_session_free(H3270 *h)
while(h->st_callbacks[f])
{
struct lib3270_state_callback *next = h->st_callbacks[f]->next;
- Free(h->st_callbacks[f]);
+ lib3270_free(h->st_callbacks[f]);
h->st_callbacks[f] = next;
}
}
diff --git a/src/lib3270/kybd.c b/src/lib3270/kybd.c
index d2e58ec..78954ff 100644
--- a/src/lib3270/kybd.c
+++ b/src/lib3270/kybd.c
@@ -222,9 +222,7 @@ static int enq_chk(void)
if(enq_chk())
return;
- ta = (struct ta *) Malloc(sizeof(*ta));
- memset(ta,0,sizeof(struct ta));
-
+ ta = (struct ta *) lib3270_malloc(sizeof(*ta));
ta->next = (struct ta *) NULL;
ta->type = TA_TYPE_KEY_AID;
ta->aid_code = aid_code;
@@ -257,8 +255,7 @@ static void enq_ta(H3270 *hSession, void (*fn)(H3270 *, const char *, const char
CHECK_SESSION_HANDLE(hSession);
- ta = (struct ta *) Malloc(sizeof(*ta));
- memset(ta,0,sizeof(struct ta));
+ ta = (struct ta *) lib3270_malloc(sizeof(*ta));
ta->session = hSession;
ta->next = (struct ta *) NULL;
ta->type = TA_TYPE_DEFAULT;
@@ -277,7 +274,7 @@ static void enq_ta(H3270 *hSession, void (*fn)(H3270 *, const char *, const char
else
{
ta_head = ta;
- status_typeahead(&h3270,True);
+ status_typeahead(hSession,True);
}
ta_tail = ta;
@@ -304,9 +301,8 @@ Boolean run_ta(void)
{
case TA_TYPE_DEFAULT:
ta->fn(ta->session,ta->parm[0],ta->parm[1]);
- Free(ta->parm[0]);
- Free(ta->parm[1]);
- Free(ta);
+ lib3270_free(ta->parm[0]);
+ lib3270_free(ta->parm[1]);
break;
case TA_TYPE_KEY_AID:
@@ -319,6 +315,8 @@ Boolean run_ta(void)
}
+ lib3270_free(ta);
+
return True;
}
@@ -334,10 +332,10 @@ flush_ta(void)
for (ta = ta_head; ta != (struct ta *) NULL; ta = next)
{
- Free(ta->parm[0]);
- Free(ta->parm[1]);
+ lib3270_free(ta->parm[0]);
+ lib3270_free(ta->parm[1]);
next = ta->next;
- Free(ta);
+ lib3270_free(ta);
any = True;
}
ta_head = ta_tail = (struct ta *) NULL;
@@ -3466,7 +3464,7 @@ void
clear_xks(void)
{
if (nxk) {
- Free(xk);
+ lib3270_free(xk);
xk = (struct xks *)NULL;
nxk = 0;
}
diff --git a/src/lib3270/localdefs.h b/src/lib3270/localdefs.h
index 4e94fb9..0883085 100644
--- a/src/lib3270/localdefs.h
+++ b/src/lib3270/localdefs.h
@@ -68,8 +68,8 @@ typedef struct _XtActionsRec{
// void * Calloc(size_t, size_t);
// void * Realloc(void *, size_t);
-#define Malloc(x) lib3270_malloc(x)
-#define Free(x) lib3270_free(x)
+// #define Malloc(x) lib3270_malloc(x)
+// #define Free(x) lib3270_free(x)
#define Calloc(e,n) lib3270_calloc(e,n,NULL)
#define Realloc(x,n) lib3270_realloc(x,n)
diff --git a/src/lib3270/macros.c b/src/lib3270/macros.c
index 4e8c46d..19f0283 100644
--- a/src/lib3270/macros.c
+++ b/src/lib3270/macros.c
@@ -33,7 +33,7 @@
#include
#include
#include
- #include
+// #include
#include
#include
#include
@@ -113,7 +113,7 @@
case 1: // Get entire screen
lib3270_get_screen_size(hSession,&rows,&cols);
qtd = (rows*(cols+1)+1);
- buffer = malloc(qtd+2);
+ buffer = lib3270_malloc(qtd+2);
memset(buffer,0,qtd+1);
start = qtd = 0;
@@ -165,7 +165,7 @@
return NULL;
}
- buffer = malloc(qtd+1);
+ buffer = lib3270_malloc(qtd+1);
screen_read(buffer, start, qtd);
*/
@@ -231,7 +231,7 @@
host = "-";
sz = strlen(luname)+strlen(state)+strlen(host)+4;
- rsp = malloc(sz+1);
+ rsp = lib3270_malloc(sz+1);
snprintf(rsp,sz,"%s %s %s",state,luname,host);
return rsp;
}
diff --git a/src/lib3270/paste.c b/src/lib3270/paste.c
index 52a5e2e..2d26de0 100644
--- a/src/lib3270/paste.c
+++ b/src/lib3270/paste.c
@@ -45,7 +45,7 @@
#endif
#include
-#include
+// #include
#include "3270ds.h"
#include "appres.h"
@@ -254,7 +254,7 @@ LIB3270_EXPORT int lib3270_paste(H3270 *h, const unsigned char *str)
if(h->paste_buffer)
{
- free(h->paste_buffer);
+ lib3270_free(h->paste_buffer);
h->paste_buffer = NULL;
}
@@ -296,6 +296,6 @@ LIB3270_ACTION(pastenext)
rc = lib3270_paste(hSession,(unsigned char *) ptr);
- free(ptr);
+ lib3270_free(ptr);
return rc;
}
diff --git a/src/lib3270/proxy.c b/src/lib3270/proxy.c
index 21c7b0e..0e78487 100644
--- a/src/lib3270/proxy.c
+++ b/src/lib3270/proxy.c
@@ -56,7 +56,7 @@
#else
- #include
+// #include
#include
#include
#include
@@ -306,7 +306,7 @@ parse_host_port(char *s, char **phost, char **pport)
*pport = NewString(colon + 1);
/* Copy out the hostname. */
- *phost = Malloc(hlen + 1);
+ *phost = lib3270_malloc(hlen + 1);
strncpy(*phost, hstart, hlen);
(*phost)[hlen] = '\0';
return 0;
@@ -347,7 +347,7 @@ proxy_passthru(int fd, char *host, unsigned short port)
{
char *buf;
- buf = Malloc(strlen(host) + 32);
+ buf = lib3270_malloc(strlen(host) + 32);
(void) sprintf(buf, "%s %u\r\n", host, port);
#if defined(X3270_TRACE) /*[*/
@@ -357,10 +357,10 @@ proxy_passthru(int fd, char *host, unsigned short port)
if (send(fd, buf, strlen(buf), 0) < 0) {
popup_a_sockerr(NULL,"Passthru Proxy: send error");
- Free(buf);
+ lib3270_free(buf);
return -1;
}
- Free(buf);
+ lib3270_free(buf);
return 0;
}
@@ -377,7 +377,7 @@ proxy_http(int fd, char *host, unsigned short port)
char *space;
/* Send the CONNECT request. */
- buf = Malloc(64 + strlen(host));
+ buf = lib3270_malloc(64 + strlen(host));
colon = strchr(host, ':');
sprintf(buf, "CONNECT %s%s%s:%u HTTP/1.1\r\n",
(colon? "[": ""),
@@ -392,7 +392,7 @@ proxy_http(int fd, char *host, unsigned short port)
if (send(fd, buf, strlen(buf), 0) < 0) {
popup_a_sockerr(NULL,"HTTP Proxy: send error");
- Free(buf);
+ lib3270_free(buf);
return -1;
}
@@ -409,7 +409,7 @@ proxy_http(int fd, char *host, unsigned short port)
if (send(fd, buf, strlen(buf), 0) < 0) {
popup_a_sockerr(NULL,"HTTP Proxy: send error");
- Free(buf);
+ lib3270_free(buf);
return -1;
}
@@ -421,10 +421,10 @@ proxy_http(int fd, char *host, unsigned short port)
if (send(fd, buf, strlen(buf), 0) < 0) {
popup_a_sockerr(NULL,"HTTP Proxy: send error");
- Free(buf);
+ lib3270_free(buf);
return -1;
}
- Free(buf);
+ lib3270_free(buf);
/*
* Process the reply.
@@ -498,7 +498,7 @@ proxy_telnet(int fd, char *host, unsigned short port)
{
char *buf;
- buf = Malloc(strlen(host) + 32);
+ buf = lib3270_malloc(strlen(host) + 32);
(void) sprintf(buf, "connect %s %u\r\n", host, port);
#if defined(X3270_TRACE) /*[*/
@@ -508,10 +508,10 @@ proxy_telnet(int fd, char *host, unsigned short port)
if (send(fd, buf, strlen(buf), 0) < 0) {
popup_a_sockerr(NULL,"TELNET Proxy: send error");
- Free(buf);
+ lib3270_free(buf);
return -1;
}
- Free(buf);
+ lib3270_free(buf);
return 0;
}
@@ -558,7 +558,7 @@ proxy_socks4(int fd, char *host, unsigned short port, int force_a)
/* Send the request to the server. */
if (use_4a) {
- buf = Malloc(32 + strlen(user) + strlen(host));
+ buf = lib3270_malloc(32 + strlen(user) + strlen(host));
s = buf;
*s++ = 0x04;
*s++ = 0x01;
@@ -578,14 +578,14 @@ proxy_socks4(int fd, char *host, unsigned short port, int force_a)
if (send(fd, buf, s - buf, 0) < 0) {
popup_a_sockerr(NULL,"SOCKS4 Proxy: send error");
- Free(buf);
+ lib3270_free(buf);
return -1;
}
- Free(buf);
+ lib3270_free(buf);
} else {
unsigned long u;
- buf = Malloc(32 + strlen(user));
+ buf = lib3270_malloc(32 + strlen(user));
s = buf;
*s++ = 0x04;
*s++ = 0x01;
@@ -603,11 +603,11 @@ proxy_socks4(int fd, char *host, unsigned short port, int force_a)
#endif /*]*/
if (send(fd, buf, s - buf, 0) < 0) {
- Free(buf);
+ lib3270_free(buf);
popup_a_sockerr(NULL,"SOCKS4 Proxy: send error");
return -1;
}
- Free(buf);
+ lib3270_free(buf);
}
/*
@@ -799,7 +799,7 @@ proxy_socks5(int fd, char *host, unsigned short port, int force_d)
}
/* Send the request to the server. */
- buf = Malloc(32 + strlen(host));
+ buf = lib3270_malloc(32 + strlen(host));
s = buf;
*s++ = 0x05; /* protocol version 5 */
*s++ = 0x01; /* CONNECT */
@@ -836,10 +836,10 @@ proxy_socks5(int fd, char *host, unsigned short port, int force_d)
if (send(fd, buf, s - buf, 0) < 0) {
popup_a_sockerr(NULL,"SOCKS5 Proxy: send error");
- Free(buf);
+ lib3270_free(buf);
return -1;
}
- Free(buf);
+ lib3270_free(buf);
/*
* Process the reply.
@@ -1009,7 +1009,7 @@ proxy_socks5(int fd, char *host, unsigned short port, int force_d)
nbuf,
rport);
#endif /*]*/
- Free(buf);
+ lib3270_free(buf);
return 0;
}
diff --git a/src/lib3270/resources.c b/src/lib3270/resources.c
index 9f52c18..3577406 100644
--- a/src/lib3270/resources.c
+++ b/src/lib3270/resources.c
@@ -118,7 +118,7 @@ void add_resource(const char *name, const char *value)
return;
}
}
- d = Malloc(sizeof(struct dresource));
+ d = lib3270_malloc(sizeof(struct dresource));
d->next = NULL;
d->name = name;
d->value = value;
@@ -175,7 +175,7 @@ const char * get_fresource(const char *fmt, ...)
name = xs_vsprintf(fmt, args);
va_end(args);
r = get_resource(name);
- Free(name);
+ lib3270_free(name);
return r;
}
diff --git a/src/lib3270/rpq.c b/src/lib3270/rpq.c
index 4edc475..a679006 100644
--- a/src/lib3270/rpq.c
+++ b/src/lib3270/rpq.c
@@ -282,7 +282,7 @@ select_rpq_terms(void)
* If there are override values, I'll get those from the ORIGINAL
* string so upper/lower case is preserved as necessary.
*/
- uplist = (char *) malloc(strlen(x3270rpq)+1);
+ uplist = (char *) lib3270_malloc(strlen(x3270rpq)+1);
assert(uplist != NULL);
p1 = uplist;
p2 = x3270rpq;
@@ -594,7 +594,7 @@ get_rpq_address(unsigned char *buf, const int maxlen)
#endif /*]*/
p1 = x3270rpq + kw->oride;
- rpqtext = (char *) malloc(strlen(p1) + 1);
+ rpqtext = (char *) lib3270_malloc(strlen(p1) + 1);
for (p2=rpqtext;*p1; p2++) {
if (*p1 == ':')
break;
@@ -729,7 +729,7 @@ static void rpq_warning(const char *fmt, ...)
{
va_start(a, fmt);
if (rpq_warnbuf == CN)
- rpq_warnbuf = Malloc(RPQ_WARNBUF_SIZE);
+ rpq_warnbuf = lib3270_malloc(RPQ_WARNBUF_SIZE);
if (rpq_wbcnt < RPQ_WARNBUF_SIZE)
{
diff --git a/src/lib3270/selection.c b/src/lib3270/selection.c
index 03ac089..497935a 100644
--- a/src/lib3270/selection.c
+++ b/src/lib3270/selection.c
@@ -29,7 +29,7 @@
#include "globals.h"
#include "appres.h"
- #include
+// #include
#include
#include
#include
@@ -382,7 +382,7 @@ static char * get_text(H3270 *hSession,unsigned char all)
if(!lib3270_connected(hSession))
return NULL;
- ret = malloc(buflen);
+ ret = lib3270_malloc(buflen);
baddr = 0;
for(row=0;row < hSession->rows;row++)
@@ -405,14 +405,14 @@ static char * get_text(H3270 *hSession,unsigned char all)
if(!sz)
{
- free(ret);
+ lib3270_free(ret);
return NULL;
}
ret[sz++] = 0;
if(sz != buflen)
- ret = realloc(ret,sz);
+ ret = lib3270_realloc(ret,sz);
return ret;
}
@@ -434,7 +434,7 @@ LIB3270_EXPORT char * lib3270_get_region(H3270 *h, int start_pos, int end_pos, u
if(start_pos < 0 || start_pos > maxlen || end_pos < 0 || end_pos > maxlen || end_pos < start_pos)
return NULL;
- text = malloc(maxlen);
+ text = lib3270_malloc(maxlen);
for(baddr=start_pos;baddr maxlen)
len = maxlen;
- buffer = malloc(len+1);
+ buffer = lib3270_malloc(len+1);
ptr = buffer;
// trace("len=%d buffer=%p",len,buffer);
diff --git a/src/lib3270/telnet.c b/src/lib3270/telnet.c
index 8708743..8211340 100644
--- a/src/lib3270/telnet.c
+++ b/src/lib3270/telnet.c
@@ -162,10 +162,7 @@ static unsigned char *sbbuf = (unsigned char *)NULL;
/* telnet sub-option buffer */
static unsigned char *sbptr;
static unsigned char telnet_state;
-static int syncing;
-#if !defined(_WIN32) /*[*/
-static unsigned long output_id = 0L;
-#endif /*]*/
+// static int syncing;
static char ttype_tmpval[13];
#if defined(X3270_TN3270E) /*[*/
@@ -514,7 +511,7 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo
#endif
if (netrbuf == (unsigned char *)NULL)
- netrbuf = (unsigned char *)Malloc(BUFSZ);
+ netrbuf = (unsigned char *)lib3270_malloc(BUFSZ);
#if defined(X3270_ANSI) /*[*/
if (!t_valid)
@@ -690,7 +687,7 @@ int net_connect(H3270 *session, const char *host, char *portname, Boolean ls, Bo
msg,
"%s",strerror(rc) );
- Free(msg);
+ lib3270_free(msg);
close_fail;
}
@@ -775,8 +772,7 @@ setup_lus(void)
* Allocate enough memory to construct an argv[] array for
* the LUs.
*/
- Replace(lus,
- (char **)Malloc((n_lus+1) * sizeof(char *) + strlen(h3270.luname) + 1));
+ Replace(lus,(char **)lib3270_malloc((n_lus+1) * sizeof(char *) + strlen(h3270.luname) + 1));
/* Copy each LU into the array. */
lu = (char *)(lus + n_lus + 1);
@@ -884,7 +880,7 @@ static void net_connected(H3270 *session)
ns_rrcvd = 0;
ns_bsent = 0;
ns_rsent = 0;
- syncing = 0;
+ session->syncing = 0;
tn3270e_negotiated = 0;
tn3270e_submode = E_NONE;
tn3270e_bound = 0;
@@ -898,10 +894,10 @@ static void net_connected(H3270 *session)
{
char *buf;
- buf = Malloc(strlen(session->hostname) + 32);
+ buf = lib3270_malloc(strlen(session->hostname) + 32);
(void) sprintf(buf, "%s %d\r\n", session->hostname, session->current_port);
(void) send(session->sock, buf, strlen(buf), 0);
- Free(buf);
+ lib3270_free(buf);
}
}
@@ -956,14 +952,17 @@ void net_disconnect(H3270 *session)
session->connected_lu = CN;
status_lu(&h3270,CN);
-#if !defined(_WIN32) /*[*/
- /* We have no more interest in output buffer space. */
- if (output_id != 0L)
+/*
+#if !defined(_WIN32)
+ // We have no more interest in output buffer space.
+ if(session->output_id != NULL)
{
- RemoveInput(output_id);
- output_id = 0L;
+ RemoveInput(session->output_id);
+ session->output_id = NULL;
}
-#endif /*]*/
+#endif
+*/
+
}
@@ -1232,7 +1231,8 @@ telnet_fsm(unsigned char c)
ansi_data = 4 + sl;
}
trace_dsn("%s",see_chr);
- if (!syncing) {
+ if (!h3270.syncing)
+ {
if (linemode && h3270.onlcr && c == '\n')
ansi_process((unsigned int) '\r');
ansi_process((unsigned int) c);
@@ -1295,14 +1295,14 @@ telnet_fsm(unsigned char c)
case SB:
telnet_state = TNS_SB;
if (sbbuf == (unsigned char *)NULL)
- sbbuf = (unsigned char *)Malloc(1024);
+ sbbuf = (unsigned char *)lib3270_malloc(1024);
sbptr = sbbuf;
break;
case DM:
trace_dsn("\n");
- if (syncing)
+ if (h3270.syncing)
{
- syncing = 0;
+ h3270.syncing = 0;
x_except_on(&h3270);
}
telnet_state = TNS_DATA;
@@ -1480,7 +1480,7 @@ telnet_fsm(unsigned char c)
status_lu(&h3270,h3270.connected_lu);
tb_len = 4 + tt_len + 2;
- tt_out = Malloc(tb_len + 1);
+ tt_out = lib3270_malloc(tb_len + 1);
(void) sprintf(tt_out, "%c%c%c%c%s%s%s%c%c",
IAC, SB, TELOPT_TTYPE, TELQUAL_IS,
h3270.termtype,
@@ -1494,7 +1494,7 @@ telnet_fsm(unsigned char c)
telquals[TELQUAL_IS],
tt_len, tt_out + 4,
cmd(SE));
- Free(tt_out);
+ lib3270_free(tt_out);
/* Advance to the next LU name. */
next_lu();
@@ -1536,7 +1536,7 @@ tn3270e_request(void)
tt_len += strlen(try_lu) + 1;
tb_len = 5 + tt_len + 2;
- tt_out = Malloc(tb_len + 1);
+ tt_out = lib3270_malloc(tb_len + 1);
t = tt_out;
t += sprintf(tt_out, "%c%c%c%c%c%s",
IAC, SB, TELOPT_TN3270E, TN3270E_OP_DEVICE_TYPE,
@@ -1559,7 +1559,7 @@ tn3270e_request(void)
(try_lu != CN && *try_lu) ? try_lu : "",
cmd(SE));
- Free(tt_out);
+ lib3270_free(tt_out);
}
/*
@@ -1884,7 +1884,7 @@ process_bind(unsigned char *buf, int buflen)
static int
process_eor(void)
{
- if (syncing || !(ibptr - ibuf))
+ if (h3270.syncing || !(ibptr - ibuf))
return(0);
#if defined(X3270_TN3270E) /*[*/
@@ -1968,15 +1968,17 @@ process_eor(void)
*/
void net_exception(H3270 *session)
{
+ CHECK_SESSION_HANDLE(session);
+
trace_dsn("RCVD urgent data indication\n");
- if (!syncing)
+ if (!session->syncing)
{
- syncing = 1;
+ session->syncing = 1;
if(session->excepting)
{
RemoveInput(session->ns_exception_id);
- session->excepting = False;
+ session->excepting = 0;
}
// x_except_off(session);
}
@@ -2105,7 +2107,7 @@ net_hexansi_out(unsigned char *buf, int len)
#endif /*]*/
/* Expand it. */
- tbuf = xbuf = (unsigned char *)Malloc(2*len);
+ tbuf = xbuf = (unsigned char *)lib3270_malloc(2*len);
while (len) {
unsigned char c = *buf++;
@@ -2119,7 +2121,7 @@ net_hexansi_out(unsigned char *buf, int len)
/* Send it to the host. */
net_rawout(xbuf, tbuf - xbuf);
- Free(xbuf);
+ lib3270_free(xbuf);
}
/*
@@ -2212,7 +2214,7 @@ static void
cooked_init(void)
{
if (lbuf == (unsigned char *)NULL)
- lbuf = (unsigned char *)Malloc(BUFSZ);
+ lbuf = (unsigned char *)lib3270_malloc(BUFSZ);
lbptr = lbuf;
lnext = 0;
backslashed = 0;
@@ -2486,7 +2488,7 @@ check_in3270(void)
/* Allocate the initial 3270 input buffer. */
if (new_cstate >= CONNECTED_INITIAL && !ibuf_size) {
- ibuf = (unsigned char *)Malloc(BUFSIZ);
+ ibuf = (unsigned char *)lib3270_malloc(BUFSIZ);
ibuf_size = BUFSIZ;
ibptr = ibuf;
}
@@ -2726,7 +2728,7 @@ net_output(void)
need_resize++;
}
if (need_resize) {
- Replace(xobuf, (unsigned char *)Malloc(xobuf_len));
+ Replace(xobuf, (unsigned char *)lib3270_malloc(xobuf_len));
}
/* Copy and expand IACs. */
diff --git a/src/lib3270/trace_ds.c b/src/lib3270/trace_ds.c
index 787dd61..56d80bd 100644
--- a/src/lib3270/trace_ds.c
+++ b/src/lib3270/trace_ds.c
@@ -421,7 +421,7 @@ static char * create_tracefile_header(const char *mode)
time_t clk;
// Create a buffer and redirect output.
- buf = Malloc(MAX_HEADER_SIZE);
+ buf = lib3270_malloc(MAX_HEADER_SIZE);
tracef_bufptr = buf;
// Display current status
@@ -583,7 +583,7 @@ static void tracefile_callback(Widget w, XtPointer client_data, XtPointer call_d
if (strchr(tfn, '\'') || ((int)strlen(tfn) > 0 && tfn[strlen(tfn)-1] == '\\'))
{
popup_an_error("Illegal file name: %s", tfn);
- Free(tfn);
+ lib3270_free(tfn);
return;
}
@@ -604,7 +604,7 @@ static void tracefile_callback(Widget w, XtPointer client_data, XtPointer call_d
if (tracef_max && !access(tfn, R_OK))
{
popup_an_error("Trace file '%s' already exists",tfn);
- Free(tfn);
+ lib3270_free(tfn);
return;
}
@@ -616,7 +616,7 @@ static void tracefile_callback(Widget w, XtPointer client_data, XtPointer call_d
if (tracef == (FILE *)NULL)
{
popup_an_errno(errno, tfn);
- Free(tfn);
+ lib3270_free(tfn);
return;
}
(void) SETLINEBUF(tracef);
@@ -629,7 +629,7 @@ static void tracefile_callback(Widget w, XtPointer client_data, XtPointer call_d
if(!tracewindow_handle)
tracewindow_handle = console_window_new( tfn, NULL );
- Free(tfn);
+ lib3270_free(tfn);
// We're really tracing, turn the flag on.
appres.toggle[trace_reason].value = True;
@@ -639,7 +639,7 @@ static void tracefile_callback(Widget w, XtPointer client_data, XtPointer call_d
// Display current status
buf = create_tracefile_header("started");
wtrace("%s", buf);
- Free(buf);
+ lib3270_free(buf);
}
@@ -696,7 +696,7 @@ tracefile_on(int reason, LIB3270_TOGGLE_TYPE tt)
{
tracefile_callback((Widget)NULL, tracefile, PN);
if (tracefile_buf != NULL)
- Free(tracefile_buf);
+ lib3270_free(tracefile_buf);
return;
}
#if defined(X3270_DISPLAY)
@@ -718,7 +718,7 @@ tracefile_on(int reason, LIB3270_TOGGLE_TYPE tt)
#endif
if (tracefile_buf != NULL)
- Free(tracefile_buf);
+ lib3270_free(tracefile_buf);
}
// Close the trace file.
@@ -856,10 +856,10 @@ screentrace_cb(char *tfn)
screentracef = fopen(tfn, "a");
if (screentracef == (FILE *)NULL) {
popup_an_errno(errno, tfn);
- Free(tfn);
+ lib3270_free(tfn);
return False;
}
- Free(tfn);
+ lib3270_free(tfn);
(void) SETLINEBUF(screentracef);
#if !defined(_WIN32)
(void) fcntl(fileno(screentracef), F_SETFD, 1);
@@ -941,7 +941,7 @@ void toggle_screenTrace(H3270 *session, struct toggle *t unused, LIB3270_TOGGLE_
if (tt == TT_INITIAL || tt == TT_ACTION) {
(void) screentrace_cb(NewString(tracefile));
if (tracefile_buf != NULL)
- Free(tracefile_buf);
+ lib3270_free(tracefile_buf);
return;
}
#if defined(X3270_DISPLAY)
@@ -965,7 +965,7 @@ void toggle_screenTrace(H3270 *session, struct toggle *t unused, LIB3270_TOGGLE_
}
if (tracefile_buf != NULL)
- Free(tracefile_buf);
+ lib3270_free(tracefile_buf);
}
*/
diff --git a/src/lib3270/utf8.c b/src/lib3270/utf8.c
index 44a6f55..44a691b 100644
--- a/src/lib3270/utf8.c
+++ b/src/lib3270/utf8.c
@@ -432,7 +432,7 @@ utf8_set_display_charsets(char *cslist, char *csname)
}
if (tok == CN) {
popup_an_error(NULL,"Invalid displayCharset specification");
- Free(dup);
+ lib3270_free(dup);
return False;
}
@@ -444,11 +444,11 @@ utf8_set_display_charsets(char *cslist, char *csname)
if (dcs[i] == CN) {
popup_an_error(NULL,"Unknown displayCharset specification '%s'",
csname);
- Free(dup);
+ lib3270_free(dup);
return False;
}
utf8_ix = i;
- Free(dup);
+ lib3270_free(dup);
return True;
}
*/
diff --git a/src/lib3270/util.c b/src/lib3270/util.c
index 0a54123..d3a7111 100644
--- a/src/lib3270/util.c
+++ b/src/lib3270/util.c
@@ -54,6 +54,10 @@
#include
#endif // _WIN32
+#ifdef HAVE_MALLOC_H
+ #include
+#endif
+
#ifndef ANDROID
#include
#endif // !ANDROID
@@ -177,7 +181,7 @@ char * xs_vsprintf(const char *fmt, va_list args)
nc = vsprintf(buf, fmt, args);
if (nc > sizeof(buf))
Error(NULL,"Internal buffer overflow");
- r = Malloc(nc + 1);
+ r = lib3270_malloc(nc + 1);
return strcpy(r, buf);
#endif /*]*/
}
@@ -210,7 +214,7 @@ xs_warning(const char *fmt, ...)
r = xs_vsprintf(fmt, args);
va_end(args);
Warning(NULL,r);
- Free(r);
+ lib3270_free(r);
}
void
@@ -223,7 +227,7 @@ xs_error(const char *fmt, ...)
r = xs_vsprintf(fmt, args);
va_end(args);
Error(NULL,r);
- Free(r);
+ lib3270_free(r);
}
/* Prettyprinter for strings with unprintable data. */
@@ -406,11 +410,11 @@ split_dbcs_resource(const char *value, char sep, char **part1, char **part2)
if (f_end == f_start) {
if (c == sep) {
if (*part1) {
- Free(*part1);
+ lib3270_free(*part1);
*part1 = NULL;
}
if (*part2) {
- Free(*part2);
+ lib3270_free(*part2);
*part2 = NULL;
}
return -1;
@@ -427,7 +431,7 @@ split_dbcs_resource(const char *value, char sep, char **part1, char **part2)
default:
return 3;
}
- *rp = Malloc(f_end - f_start + 1);
+ *rp = lib3270_malloc(f_end - f_start + 1);
strncpy(*rp, f_start, f_end - f_start);
(*rp)[f_end - f_start] = '\0';
f_end = CN;
@@ -539,7 +543,7 @@ var_subst(const char *s)
return NewString(s);
o_len = strlen(s) + 1;
- ob = Malloc(o_len);
+ ob = lib3270_malloc(o_len);
o = ob;
# define LBR '{'
# define RBR '}'
@@ -604,7 +608,7 @@ var_subst(const char *s)
state = VS_BASE;
continue; /* rescan */
}
- vn = Malloc(vn_len + 1);
+ vn = lib3270_malloc(vn_len + 1);
(void) strncpy(vn, vn_start, vn_len);
vn[vn_len] = '\0';
@@ -625,7 +629,7 @@ var_subst(const char *s)
}
#endif // !ANDROID
- Free(vn);
+ lib3270_free(vn);
if (state == VS_VNB) {
state = VS_BASE;
break;
@@ -670,7 +674,7 @@ tilde_subst(const char *s)
if (slash) {
int len = slash - s;
- mname = Malloc(len + 1);
+ mname = lib3270_malloc(len + 1);
(void) strncpy(mname, s, len);
mname[len] = '\0';
name = mname;
@@ -687,13 +691,13 @@ tilde_subst(const char *s)
p = getpwnam(name + 1);
/* Free any temporary copy. */
- Free(mname);
+ lib3270_free(mname);
/* Substitute and return. */
if (p == (struct passwd *)NULL)
r = NewString(s);
else {
- r = Malloc(strlen(p->pw_dir) + strlen(rest) + 1);
+ r = lib3270_malloc(strlen(p->pw_dir) + strlen(rest) + 1);
(void) strcpy(r, p->pw_dir);
(void) strcat(r, rest);
}
@@ -716,7 +720,7 @@ do_subst(const char *s, Boolean do_vars, Boolean do_tilde)
char *u;
u = tilde_subst(t);
- Free(t);
+ lib3270_free(t);
return u;
}
#endif /*]*/
@@ -871,7 +875,7 @@ rpf(rpf_t *r, char *fmt, ...)
void
rpf_free(rpf_t *r)
{
- Free(r->buf);
+ lib3270_free(r->buf);
r->buf = NULL;
r->alloc_len = 0;
r->cur_len = 0;
diff --git a/src/pw3270/v3270/accessible.c b/src/pw3270/v3270/accessible.c
index 85316a8..161258e 100644
--- a/src/pw3270/v3270/accessible.c
+++ b/src/pw3270/v3270/accessible.c
@@ -37,7 +37,7 @@
#include
#include
- #include
+// #include
#include "v3270.h"
#include "private.h"
#include "accessible.h"
@@ -393,7 +393,7 @@ static gchar * v3270_accessible_get_text_at_offset(AtkText *atk_text, gint offse
g_error_free(error);
}
- free(text);
+ lib3270_free(text);
return utfchar;
}
@@ -432,7 +432,7 @@ static gchar * v3270_accessible_get_text(AtkText *atk_text, gint start_pos, gint
g_error_free(error);
}
- free(text);
+ lib3270_free(text);
// trace("%s:\n%s\n",__FUNCTION__,utftext);
diff --git a/src/pw3270/v3270/iocallback.c b/src/pw3270/v3270/iocallback.c
index ac1ffae..78784ba 100644
--- a/src/pw3270/v3270/iocallback.c
+++ b/src/pw3270/v3270/iocallback.c
@@ -43,9 +43,9 @@
#include
#include "../globals.h"
-#ifdef HAVE_MALLOC_H
- #include
-#endif
+//#ifdef HAVE_MALLOC_H
+// #include
+//#endif
static int static_CallAndWait(int(*callback)(H3270 *session, void *), H3270 *session, void *parm);
static void * static_AddInput(int source, H3270 *session, void (*fn)(H3270 *session));
diff --git a/src/pw3270/v3270/selection.c b/src/pw3270/v3270/selection.c
index b73f211..eb43973 100644
--- a/src/pw3270/v3270/selection.c
+++ b/src/pw3270/v3270/selection.c
@@ -29,7 +29,7 @@
#include
#include
- #include
+// #include
#include "v3270.h"
#include "private.h"
#include
@@ -92,7 +92,7 @@ gchar * v3270_get_text(GtkWidget *widget, int offset, int len)
text = g_convert(str, -1, "UTF-8", lib3270_get_charset(terminal->host), NULL, NULL, NULL);
- free(str);
+ lib3270_free(str);
return text;
}
@@ -110,7 +110,7 @@ static gchar * v3270_get_selected(v3270 *widget)
if(text)
{
gchar *str = g_strdup(text);
- free(text);
+ lib3270_free(text);
return str;
}
return NULL;
@@ -255,7 +255,7 @@ const gchar * v3270_copy_append(GtkWidget *widget)
text = g_convert(str, -1, "UTF-8", lib3270_get_charset(terminal->host), NULL, NULL, NULL);
- free(str);
+ lib3270_free(str);
clip = g_strconcat(terminal->clipboard,"\n",text,NULL);
@@ -462,7 +462,7 @@ gchar * v3270_get_region(GtkWidget *widget, gint start_pos, gint end_pos, gboole
utftext = g_convert(str, -1, "UTF-8", lib3270_get_charset(GTK_V3270(widget)->host), NULL, NULL, NULL);
- free(str);
+ lib3270_free(str);
return utftext;
}
--
libgit2 0.21.2