From 8996b7f3065777da8e87088ed3b0c6777faabbe7 Mon Sep 17 00:00:00 2001 From: perry.werneck@gmail.com Date: Fri, 12 Jul 2013 11:42:51 +0000 Subject: [PATCH] Melhorando exemplo rexx --- src/include/pw3270/class.h | 2 ++ src/plugins/rx3270/sample/object.rex | 22 ++++++++++++++++------ 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/src/include/pw3270/class.h b/src/include/pw3270/class.h index 6e1a0c2..5a8e504 100644 --- a/src/include/pw3270/class.h +++ b/src/include/pw3270/class.h @@ -66,6 +66,8 @@ #ifdef WIN32 exception(DWORD error, const char *fmt, ...); +#else + exception(int error, const char *fmt, ...); #endif // WIN32 virtual const char * what() const throw(); diff --git a/src/plugins/rx3270/sample/object.rex b/src/plugins/rx3270/sample/object.rex index 5a40870..40262c8 100644 --- a/src/plugins/rx3270/sample/object.rex +++ b/src/plugins/rx3270/sample/object.rex @@ -1,13 +1,24 @@ use arg uri -host = .rx3270~new("") -host~ScreenTrace(1) +if arg(1) <> "" then +do + + /* Has a host URI, create a new session and connect to the host */ + + host = .rx3270~new("") -if host~connect(uri,1) <> 0 then + if host~connect(uri,1) <> 0 then + do + say "Error connecting to "||uri + return -1 + end +end +else do - say "Error connecting to "||uri - return -1 + /* No host URI, use the first session */ + host = .rx3270~new("pw3270:A") + end if host~WaitForReady(60) <> 0 then @@ -24,7 +35,6 @@ do say "Timeout waiting for terminal ready" end - host~disconnect() return 0 -- libgit2 0.21.2