Author: bursa
Date: Thu Jul 5 05:29:09 2007
New Revision: 3383
URL:
http://source.netsurf-browser.org?rev=3383&view=rev
Log:
Add URL file (with the original URL) and Inventory file (listing URLs of objects) to Full
Saves.
Modified:
trunk/netsurf/riscos/save.c
trunk/netsurf/riscos/save_complete.c
Modified: trunk/netsurf/riscos/save.c
URL:
http://source.netsurf-browser.org/trunk/netsurf/riscos/save.c?rev=3383&am...
==============================================================================
--- trunk/netsurf/riscos/save.c (original)
+++ trunk/netsurf/riscos/save.c Thu Jul 5 05:29:09 2007
@@ -2,7 +2,7 @@
* This file is part of NetSurf,
http://netsurf-browser.org/
* Licensed under the GNU General Public License,
*
http://www.opensource.org/licenses/gpl-license
- * Copyright 2004 James Bursa <bursa(a)users.sourceforge.net>
+ * Copyright 2004-2007 James Bursa <bursa(a)users.sourceforge.net>
* Copyright 2005 Adrian Lees <adrianl(a)users.sourceforge.net>
*/
@@ -799,6 +799,11 @@
/* restore sprite name in case the save fails and we need to try again */
memcpy(sprite->name, name, 12);
+ /* save URL file with original URL */
+ snprintf(buf, sizeof buf, "%s.URL", path);
+ if (!ro_gui_save_link(c, LINK_ANT, buf))
+ return false;
+
return save_complete(c, path);
}
Modified: trunk/netsurf/riscos/save_complete.c
URL:
http://source.netsurf-browser.org/trunk/netsurf/riscos/save_complete.c?re...
==============================================================================
--- trunk/netsurf/riscos/save_complete.c (original)
+++ trunk/netsurf/riscos/save_complete.c Thu Jul 5 05:29:09 2007
@@ -3,7 +3,7 @@
* Licensed under the GNU General Public License,
*
http://www.opensource.org/licenses/gpl-license
* Copyright 2004 John M Bell <jmb202(a)ecs.soton.ac.uk>
- * Copyright 2004 James Bursa <bursa(a)users.sourceforge.net>
+ * Copyright 2004-2007 James Bursa <bursa(a)users.sourceforge.net>
*/
/** \file
@@ -14,6 +14,7 @@
#include <assert.h>
#include <ctype.h>
#include <errno.h>
+#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <regex.h>
@@ -55,6 +56,7 @@
static struct content * save_complete_list_find(const char *url);
static bool save_complete_list_check(struct content *content);
static void save_complete_list_dump(void);
+static bool save_complete_inventory(const char *path);
/**
* Save an HTML page with all dependencies.
@@ -69,6 +71,9 @@
bool result;
result = save_complete_html(c, path, true);
+
+ if (result)
+ result = save_complete_inventory(path);
/* free save_complete_list */
while (save_complete_list) {
@@ -114,9 +119,11 @@
if (save_complete_list_check(css))
continue;
- if (!save_complete_list_add(css)) {
- warn_user("NoMemory", 0);
- return false;
+ if (i != STYLESHEET_STYLE) {
+ if (!save_complete_list_add(css)) {
+ warn_user("NoMemory", 0);
+ return false;
+ }
}
if (!save_imported_sheets(css, path))
@@ -721,4 +728,35 @@
entry->content->url);
}
+
+/**
+ * Create the inventory file listing original URLs.
+ */
+
+bool save_complete_inventory(const char *path)
+{
+ char spath[256];
+ FILE *fp;
+
+ snprintf(spath, sizeof spath, "%s.Inventory", path);
+
+ fp = fopen(spath, "w");
+ if (!fp) {
+ LOG(("fopen(): errno = %i", errno));
+ warn_user("SaveError", strerror(errno));
+ return false;
+ }
+
+ struct save_complete_entry *entry;
+ for (entry = save_complete_list; entry; entry = entry->next)
+ fprintf(fp, "%x %s\n",
+ (unsigned int) entry->content,
+ entry->content->url);
+
+ fclose(fp);
+
+ return true;
+}
+
+
#endif