summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--frontends/amiga/arexx.c32
-rw-r--r--frontends/amiga/options.h1
2 files changed, 32 insertions, 1 deletions
diff --git a/frontends/amiga/arexx.c b/frontends/amiga/arexx.c
index 05e780243..243e927f8 100644
--- a/frontends/amiga/arexx.c
+++ b/frontends/amiga/arexx.c
@@ -69,7 +69,8 @@ enum
RX_ACTIVE,
RX_CLOSE,
RX_HOTLIST,
- RX_SLABSTATS
+ RX_SLABSTATS,
+ RX_EXEC
};
static Object *arexx_obj = NULL;
@@ -98,6 +99,7 @@ RXHOOKF(rx_active);
RXHOOKF(rx_close);
RXHOOKF(rx_hotlist);
RXHOOKF(rx_slabstats);
+RXHOOKF(rx_exec);
STATIC struct ARexxCmd Commands[] =
{
@@ -118,6 +120,7 @@ STATIC struct ARexxCmd Commands[] =
{"CLOSE", RX_CLOSE, rx_close, "W=WINDOW/K/N,T=TAB/K/N", 0, NULL, 0, 0, NULL },
{"HOTLIST", RX_HOTLIST, rx_hotlist, "A=ACTION/A", 0, NULL, 0, 0, NULL },
{"SLABSTATS", RX_SLABSTATS, rx_slabstats, "FILE", 0, NULL, 0, 0, NULL },
+ {"EXEC", RX_EXEC, rx_exec, "W=WINDOW/K/N,T=TAB/K/N,COMMAND/A/F", 0, NULL, 0, 0, NULL },
{ NULL, 0, NULL, NULL, 0, NULL, 0, 0, NULL }
};
@@ -674,6 +677,33 @@ RXHOOKF(rx_hotlist)
}
}
+RXHOOKF(rx_exec)
+{
+ struct gui_window *gw = ami_gui_get_active_gw();
+ bool res = false;
+
+ if(nsoption_bool(arexx_allow_exec) == false) {
+ cmd->ac_RC = RETURN_FAIL;
+ return;
+ }
+
+ if((cmd->ac_ArgList[0]) && (cmd->ac_ArgList[1]))
+ gw = ami_find_tab(*(ULONG *)cmd->ac_ArgList[0], *(ULONG *)cmd->ac_ArgList[1]);
+
+ if(gw) {
+ NSLOG(netsurf, WARNING, "Executing js: %s", (char *)cmd->ac_ArgList[2]);
+ res = browser_window_exec(ami_gui_get_browser_window(gw),
+ (char *)cmd->ac_ArgList[2], strlen((char *)cmd->ac_ArgList[2]));
+ }
+
+ if(res == false) {
+ cmd->ac_RC = RETURN_ERROR;
+ } else {
+ cmd->ac_RC = RETURN_OK;
+ }
+
+}
+
RXHOOKF(rx_slabstats)
{
#ifndef __amigaos4__
diff --git a/frontends/amiga/options.h b/frontends/amiga/options.h
index f67a9b683..196b05709 100644
--- a/frontends/amiga/options.h
+++ b/frontends/amiga/options.h
@@ -47,6 +47,7 @@ NSOPTION_STRING(search_engines_file, "PROGDIR:Resources/SearchEngines")
NSOPTION_STRING(arexx_dir, "PROGDIR:Rexx")
NSOPTION_STRING(arexx_startup, "Startup.nsrx")
NSOPTION_STRING(arexx_shutdown, "Shutdown.nsrx")
+NSOPTION_BOOL(arexx_allow_exec, false)
NSOPTION_STRING(download_dir, NULL)
NSOPTION_BOOL(download_notify, true)
NSOPTION_BOOL(download_notify_progress, false)