mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-22 22:41:30 +03:00
Two new ARexx commands:
GETTITLE - returns the current website title VERSION VERSION/N REVISION/N RELEASE/S - returns the version of NetSurf or checks it is newer than a supplied version/revision svn path=/trunk/netsurf/; revision=5765
This commit is contained in:
parent
3a5d7d6b64
commit
ae0b5ff460
@ -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;
|
||||
}
|
||||
|
2
amiga/dist/NetSurf.guide
vendored
2
amiga/dist/NetSurf.guide
vendored
@ -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).
|
||||
|
||||
|
@ -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 || ';'
|
||||
|
Loading…
Reference in New Issue
Block a user