/* * This file is part of NetSurf, http://netsurf.sourceforge.net/ * Licensed under the GNU General Public License, * http://www.opensource.org/licenses/gpl-license * Copyright 2004 John M Bell */ #include #include #include /* for __riscosify */ #include "libxml/HTMLtree.h" #include "oslib/osfile.h" #include "netsurf/utils/config.h" #include "netsurf/content/content.h" #include "netsurf/css/css.h" #include "netsurf/render/form.h" #include "netsurf/render/layout.h" #include "netsurf/riscos/gui.h" #include "netsurf/riscos/save_complete.h" #include "netsurf/utils/log.h" #include "netsurf/utils/url.h" #include "netsurf/utils/utils.h" #ifdef WITH_SAVE_COMPLETE /** \todo URL rewriting for @import rules * Objects used by embedded html pages * GUI */ struct url_entry { char *url; /**< Fully qualified URL, as per url_join output */ char *par; /**< Base URL of parent object */ int ptr; /**< Pointer to object's location in memory */ struct url_entry *next; /**< Next entry in list */ }; static void save_imported_sheets(struct content *c, char *p, char* fn, struct url_entry *imports); /*static char *leafname(const char *url); static int rewrite_stylesheet_urls(const char* sheet, int isize, char* buffer, int osize, struct url_entry *head);*/ static int rewrite_document_urls(xmlDoc *doc, struct url_entry *head, char *fname); static int rewrite_urls(xmlNode *n, struct url_entry *head, char *fname); static void rewrite_url(xmlNode *n, struct url_entry *head, char *fname, const char *attr); /* this is temporary. */ const char * const SAVE_PATH = ".savetest."; const char * const OBJ_DIR = "_files"; /** \todo this will probably want to take a filename */ void save_complete(struct content *c) { char *fname = 0, *spath; unsigned int i; struct url_entry urls = {0, 0, 0, 0}; /* sentinel at head */ struct url_entry *object; htmlParserCtxtPtr toSave; if (c->type != CONTENT_HTML) return; fname = "test"; /*get_filename(c->data.html.base_url);*/ spath = xcalloc(strlen(SAVE_PATH)+strlen(OBJ_DIR)+strlen(fname)+50, sizeof(char)); sprintf(spath, "%s%s%s", SAVE_PATH, fname, OBJ_DIR); xosfile_create_dir(spath, 77); /* save stylesheets, ignoring the base sheet and