summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xamiga/arexx.c92
-rwxr-xr-xamiga/dist/NetSurf.guide2
-rw-r--r--amiga/version.rexx3
3 files changed, 96 insertions, 1 deletions
diff --git a/amiga/arexx.c b/amiga/arexx.c
index 28164afc8..9c7222e32 100755
--- a/amiga/arexx.c
+++ b/amiga/arexx.c
@@ -23,12 +23,21 @@
#include "desktop/browser.h"
#include "amiga/gui.h"
+const char * const verarexx;
+const int verver;
+const int verrev;
+const char * const netsurf_version;
+const int netsurf_version_major;
+const int netsurf_version_minor;
+
enum
{
RX_OPEN=0,
RX_QUIT,
RX_TOFRONT,
- RX_GETURL
+ RX_GETURL,
+ RX_GETTITLE,
+ RX_VERSION
};
STATIC char result[100];
@@ -37,6 +46,8 @@ STATIC VOID rx_open(struct ARexxCmd *, struct RexxMsg *);
STATIC VOID rx_quit(struct ARexxCmd *, struct RexxMsg *);
STATIC VOID rx_tofront(struct ARexxCmd *, struct RexxMsg *);
STATIC VOID rx_geturl(struct ARexxCmd *, struct RexxMsg *);
+STATIC VOID rx_gettitle(struct ARexxCmd *, struct RexxMsg *);
+STATIC VOID rx_version(struct ARexxCmd *, struct RexxMsg *);
STATIC struct ARexxCmd Commands[] =
{
@@ -44,6 +55,8 @@ STATIC struct ARexxCmd Commands[] =
{"QUIT",RX_QUIT,rx_quit,NULL, 0, NULL, 0, 0, NULL },
{"TOFRONT",RX_TOFRONT,rx_tofront,NULL, 0, NULL, 0, 0, NULL },
{"GETURL",RX_GETURL,rx_geturl,NULL, 0, NULL, 0, 0, NULL },
+ {"GETTITLE",RX_GETTITLE,rx_gettitle,NULL, 0, NULL, 0, 0, NULL },
+ {"VERSION",RX_VERSION,rx_version,"VERSION/N,SVN=REVISION/N,RELEASE/S", 0, NULL, 0, 0, NULL },
{ NULL, 0, NULL, NULL, 0, NULL, 0, 0, NULL }
};
@@ -126,3 +139,80 @@ STATIC VOID rx_geturl(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((u
cmd->ac_Result = result;
}
+STATIC VOID rx_gettitle(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unused)))
+{
+ if(curbw)
+ {
+ strcpy(result,curbw->window->shared->win->Title);
+ }
+ else
+ {
+ strcpy(result,"\0");
+ }
+
+ cmd->ac_Result = result;
+}
+
+STATIC VOID rx_version(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unused)))
+{
+ if(cmd->ac_ArgList[2])
+ {
+ if(cmd->ac_ArgList[1])
+ {
+ if((netsurf_version_major > *(ULONG *)cmd->ac_ArgList[0]) || ((netsurf_version_minor >= *(ULONG *)cmd->ac_ArgList[1]) && (netsurf_version_major == *(ULONG *)cmd->ac_ArgList[0])))
+ {
+ strcpy(result,"1");
+ }
+ else
+ {
+ strcpy(result,"0");
+ }
+ }
+ else if(cmd->ac_ArgList[0])
+ {
+ if((netsurf_version_major >= *(ULONG *)cmd->ac_ArgList[0]))
+ {
+ strcpy(result,"1");
+ }
+ else
+ {
+ strcpy(result,"0");
+ }
+ }
+ else
+ {
+ strcpy(result,netsurf_version);
+ }
+ }
+ else
+ {
+ if(cmd->ac_ArgList[1])
+ {
+ if((verver > *(ULONG *)cmd->ac_ArgList[0]) || ((verrev >= *(ULONG *)cmd->ac_ArgList[1]) && (verver == *(ULONG *)cmd->ac_ArgList[0])))
+ {
+ strcpy(result,"1");
+ }
+ else
+ {
+ strcpy(result,"0");
+ }
+ }
+ else if(cmd->ac_ArgList[0])
+ {
+ if((verver >= *(ULONG *)cmd->ac_ArgList[0]))
+ {
+ strcpy(result,"1");
+ }
+ else
+ {
+ strcpy(result,"0");
+ }
+ }
+ else
+ {
+ strcpy(result,verarexx);
+ }
+ }
+
+ cmd->ac_Result = result;
+}
diff --git a/amiga/dist/NetSurf.guide b/amiga/dist/NetSurf.guide
index ab31d30c2..40c18026a 100755
--- a/amiga/dist/NetSurf.guide
+++ b/amiga/dist/NetSurf.guide
@@ -56,6 +56,8 @@ Commands are:
@{b}QUIT@{ub} Quits NetSurf
@{b}TOFRONT@{ub} Brings NetSurf's screen to the front
@{b}GETURL@{ub} Puts the URL displayed in the current window/tab into RESULT
+@{b}GETTITLE@{ub} Puts the title of the page displayed in the current window/tab into RESULT
+@{b}VERSION VERSION/N REVISION/N RELEASE/S@{ub} Returns the current version of NetSurf in RESULT. You can also do version checking by supplying a VERSION and optional REVISION to check against. If the version of NetSurf is the same or higher 1 will be returned, if it is older 0. If RELEASE is specified, the command operates on the release version rather than the internal version number.
The ARexx menu will be populated with scripts named #?.nsrx in @{"arexx_dir" link options 18}, up to a maximum of 20 entries. The titles of these entries will be the comments field of the file (or the filename if comments field is empty).
diff --git a/amiga/version.rexx b/amiga/version.rexx
index 58ccb982a..f5e085031 100644
--- a/amiga/version.rexx
+++ b/amiga/version.rexx
@@ -50,3 +50,6 @@ say '/* This file was automatically generated by version.rexx */'
say 'static const __attribute__((used)) char *verstag = "\0$VER: NetSurf' majorver || '.' || svnrev '(' || date || ')\0";'
say 'const char * const versvn = "SVN' svnrev || '";'
say 'const char * const verdate = "' || date || '";'
+say 'const char * const verarexx = "' || majorver || '.' || svnrev || '";'
+say 'const int verver =' majorver || ';'
+say 'const int verrev =' svnrev || ';'