diff options
author | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2008-11-24 08:06:11 +0000 |
---|---|---|
committer | Chris Young <chris@unsatisfactorysoftware.co.uk> | 2008-11-24 08:06:11 +0000 |
commit | ae0b5ff460c3219ddd2be483a230ce8a91e4eacd (patch) | |
tree | ef628bab30ce3617ff4b6a99188f62d73dc4cf71 /amiga/arexx.c | |
parent | 3a5d7d6b644fe3dbea04bf9803f7b712832a10a4 (diff) | |
download | netsurf-ae0b5ff460c3219ddd2be483a230ce8a91e4eacd.tar.gz netsurf-ae0b5ff460c3219ddd2be483a230ce8a91e4eacd.tar.bz2 |
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
Diffstat (limited to 'amiga/arexx.c')
-rwxr-xr-x | amiga/arexx.c | 92 |
1 files changed, 91 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; +} |