Commit 07a80fd06cbb1b0728441886944b583d4e5011de

Authored by Perry Werneck
1 parent 8751048d
Exists in master and in 1 other branch develop

Adding lib3270 actions as commands on trace window.

Showing 1 changed file with 20 additions and 1 deletions   Show diff stats
src/trace/exec.c
... ... @@ -40,6 +40,7 @@
40 40 #include <lib3270/log.h>
41 41 #include <lib3270/trace.h>
42 42 #include <lib3270/properties.h>
  43 + #include <lib3270/actions.h>
43 44 #include <v3270.h>
44 45 #include <v3270/trace.h>
45 46 #include <internals.h>
... ... @@ -108,6 +109,8 @@
108 109  
109 110 int v3270_exec_command(GtkWidget *widget, const gchar *text)
110 111 {
  112 + size_t ix;
  113 +
111 114 g_return_val_if_fail(GTK_IS_V3270(widget),EINVAL);
112 115  
113 116 H3270 *hSession = v3270_get_session(widget);
... ... @@ -147,7 +150,23 @@
147 150 if(sep)
148 151 {
149 152 *(sep++) = 0;
150   - set_property(hSession,g_strstrip(cmdline),g_strstrip(sep));
  153 + return set_property(hSession,g_strstrip(cmdline),g_strstrip(sep));
  154 + }
  155 + else
  156 + {
  157 + // Check for lib3270 actions.
  158 + const LIB3270_ACTION_ENTRY *actions = lib3270_get_action_table();
  159 +
  160 + for(ix=0; actions[ix].name; ix++)
  161 + {
  162 + if(!g_ascii_strcasecmp(actions[ix].name,cmdline))
  163 + {
  164 + lib3270_trace_event(hSession,"Action: %s\n",actions[ix].name);
  165 + return actions[ix].call(hSession);
  166 + }
  167 +
  168 + }
  169 +
151 170 }
152 171  
153 172 return errno = ENOENT;
... ...