summaryrefslogtreecommitdiff
path: root/amiga/arexx.c
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2009-01-10 21:33:34 +0000
committerChris Young <chris@unsatisfactorysoftware.co.uk>2009-01-10 21:33:34 +0000
commit2cb1775973270d97cc374901ce733eaeb9bc96c6 (patch)
treeef9b40b2045055dc7bb9c3733419dbe8355dd8ff /amiga/arexx.c
parent7098d2850dcd37313de48208c46f4749a22d1d22 (diff)
downloadnetsurf-2cb1775973270d97cc374901ce733eaeb9bc96c6.tar.gz
netsurf-2cb1775973270d97cc374901ce733eaeb9bc96c6.tar.bz2
Add SAVE command, which saves the source of the current page to the named file.
Template: SAVE FILENAME/A Will add additional options later. svn path=/trunk/netsurf/; revision=6027
Diffstat (limited to 'amiga/arexx.c')
-rwxr-xr-xamiga/arexx.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/amiga/arexx.c b/amiga/arexx.c
index 9c7222e32..6d5251773 100755
--- a/amiga/arexx.c
+++ b/amiga/arexx.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2008 Chris Young <chris@unsatisfactorysoftware.co.uk>
+ * Copyright 2008-9 Chris Young <chris@unsatisfactorysoftware.co.uk>
*
* This file is part of NetSurf, http://www.netsurf-browser.org/
*
@@ -22,6 +22,7 @@
#include <proto/intuition.h>
#include "desktop/browser.h"
#include "amiga/gui.h"
+#include <proto/dos.h>
const char * const verarexx;
const int verver;
@@ -37,7 +38,8 @@ enum
RX_TOFRONT,
RX_GETURL,
RX_GETTITLE,
- RX_VERSION
+ RX_VERSION,
+ RX_SAVE
};
STATIC char result[100];
@@ -48,6 +50,7 @@ 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 VOID rx_save(struct ARexxCmd *, struct RexxMsg *);
STATIC struct ARexxCmd Commands[] =
{
@@ -57,6 +60,7 @@ STATIC struct ARexxCmd Commands[] =
{"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 },
+ {"SAVE",RX_SAVE,rx_save,"FILENAME/A", 0, NULL, 0, 0, NULL },
{ NULL, 0, NULL, NULL, 0, NULL, 0, 0, NULL }
};
@@ -115,6 +119,20 @@ STATIC VOID rx_open(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unu
}
}
+STATIC VOID rx_save(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unused)))
+{
+ BPTR fh = 0;
+ ami_update_pointer(curbw->window->shared->win,GUI_POINTER_WAIT);
+ if(fh = FOpen(cmd->ac_ArgList[0],MODE_NEWFILE,0))
+ {
+ FWrite(fh,curbw->current_content->source_data,1,curbw->current_content->source_size);
+ FClose(fh);
+ SetComment(cmd->ac_ArgList[0],curbw->current_content->url);
+ }
+
+ ami_update_pointer(curbw->window->shared->win,GUI_POINTER_DEFAULT);
+}
+
STATIC VOID rx_quit(struct ARexxCmd *cmd, struct RexxMsg *rxm __attribute__((unused)))
{
ami_quit_netsurf();